/* ==========================================================================
   ag-checkout.css
   Unified Glassmorphism styles for Cart, Checkout & Thank You
   Theme: revive-thrive-child – V4.2 Light Glass
   ========================================================================== */

/* --- Section: Base / Layout / Utilities --- */

.ag-container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 16px;
}

.ag-main {
  padding: 40px 0;
}

/* Reveal animation */
.ag-reveal-on-scroll {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.ag-reveal-on-scroll.ag-reveal-on-scroll--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Glass card primitive – فاتح */
.ag-glass-card,
.ag-cart-item,
.ag-cart-totals,
.ag-checkout-card,
.ag-checkout-sidebar,
.ag-thankyou-card,
.ag-mini-cart,
.ag-cart-empty__card {
  position: relative;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}

/* Headings / typography */
.ag-main h1,
.ag-main h2,
.ag-main h3,
.ag-main h4 {
  font-family: var(--ag-font-family-base);
  font-weight: 600;
  color: #0f172a;
  text-shadow: none;
}

.ag-main p,
.ag-main span,
.ag-main label {
  font-family: var(--ag-font-family-base);
  color: #334155;
}

/* --- Buttons ------------------------------------------------------------- */

.ag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.2s ease,
    border-color 0.3s ease,
    color 0.3s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.ag-btn--primary {
  background: linear-gradient(135deg, #667eea, #f093fb);
  border-color: rgba(248, 250, 252, 0.8);
  color: #020617;
}

.ag-btn--secondary {
  background: linear-gradient(
    135deg,
    rgba(148, 163, 184, 0.9),
    rgba(102, 126, 234, 0.7)
  );
  color: #0f172a;
}

.ag-btn--outline {
  background: transparent;
  color: #1e293b;
}

.ag-btn--lg {
  padding: 12px 24px;
  font-size: 15px;
}

.ag-btn--md {
  padding: 10px 20px;
}

.ag-btn--sm {
  padding: 8px 16px;
  font-size: 12px;
}

.ag-btn--full {
  width: 100%;
}

.ag-btn:hover {
  box-shadow: 0 0 24px rgba(102, 126, 234, 0.55);
  transform: translateY(-1px);
  border-color: rgba(148, 163, 184, 0.9);
}

.ag-btn:active {
  transform: translateY(0);
  box-shadow: 0 0 12px rgba(15, 23, 42, 0.4);
}

/* --- Form elements ------------------------------------------------------- */

.ag-main input[type="text"],
.ag-main input[type="email"],
.ag-main input[type="tel"],
.ag-main input[type="password"],
.ag-main input[type="number"],
.ag-main input[type="search"],
.ag-main textarea,
.ag-main select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}

.ag-main input::placeholder,
.ag-main textarea::placeholder {
  color: rgba(148, 163, 184, 0.9);
}

.ag-main input:focus,
.ag-main textarea:focus,
.ag-main select:focus {
  border-color: #667eea;
  box-shadow:
    0 0 0 1px rgba(102, 126, 234, 0.7),
    0 0 18px rgba(102, 126, 234, 0.5);
  background: rgba(255, 255, 255, 0.98);
}

/* --- Section: Cart ------------------------------------------------------- */

/* Page wrapper */
.ag-cart-page .ag-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Empty state */
.ag-cart-empty {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
}

.ag-cart-empty__card {
  padding: 32px 28px;
  text-align: center;
  max-width: 480px;
}

.ag-cart-empty__icon {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  margin: 0 auto 18px;
  background: radial-gradient(
    circle at 30% 0,
    rgba(102, 126, 234, 0.6),
    transparent
  );
}

/* Header */
.ag-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.ag-cart-header__title {
  font-size: 28px;
}

.ag-cart-header__subtitle {
  font-size: 14px;
  color: #64748b;
}

/* Layout */
.ag-cart__form {
  width: 100%;
}

.ag-cart__content {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1.1fr);
  gap: 24px;
}

/* Product list */
.ag-cart__products {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ag-cart__product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Cart item */
.ag-cart-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px 16px;
  align-items: center;
}

.ag-cart-item__media img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
}

.ag-cart-item__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ag-cart-item__header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ag-cart-item__title {
  font-size: 15px;
  margin: 0;
}

.ag-cart-item__link {
  color: #0f172a;
  text-decoration: none;
}

.ag-cart-item__link:hover {
  text-decoration: underline;
}

.ag-cart-item__meta {
  font-size: 12px;
  color: #6366f1;
}

.ag-cart-item__details {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 12px;
  align-items: center;
}

.ag-cart-item__label {
  display: block;
  font-size: 11px;
  color: #9ca3af;
}

.ag-cart-item__value {
  font-size: 13px;
}

/* Qty stepper */
.ag-qty-stepper {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.6);
  overflow: hidden;
}

.ag-qty-stepper__btn {
  background: transparent;
  border: none;
  color: #0f172a;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.ag-qty-stepper__btn:hover {
  background: rgba(102, 126, 234, 0.2);
  color: #1d4ed8;
}

.ag-qty-stepper__input {
  background: transparent;
  border: none;
  width: 46px !important;
  text-align: center;
  color: #0f172a;
  padding: 0;
  font-size: 14px;
}

/* Remove link */
.ag-cart-item__actions {
  display: flex;
  align-items: flex-start;
}

.ag-cart-remove {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(248, 250, 252, 0.96);
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s ease;
}

.ag-cart-remove:hover {
  background: rgba(248, 113, 113, 0.9);
  border-color: rgba(248, 113, 113, 0.95);
  color: #fef2f2;
  transform: translateY(-1px);
}

/* Cart actions row */
.ag-cart__actions-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
}

.ag-cart__coupon {
  flex: 1 1 220px;
}

.ag-cart__coupon-label {
  font-size: 12px;
  margin-bottom: 4px;
  display: inline-block;
}

.ag-cart__coupon-fields {
  display: flex;
  gap: 10px;
}

.ag-cart__coupon-input {
  max-width: 200px;
}

.ag-cart__update {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Sidebar / totals */
.ag-cart__sidebar {
  position: relative;
}

.ag-cart-totals {
  padding: 18px 18px 20px;
}

.ag-cart-totals--sticky {
  position: sticky;
  top: 90px;
}

.ag-cart-totals__inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- Section: Mini Cart -------------------------------------------------- */

.ag-mini-cart {
  padding: 18px 16px;
  max-width: 360px;
}

.ag-mini-cart__products {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.ag-mini-cart-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  position: relative;
  align-items: center;
}

.ag-mini-cart-item__image img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
}

.ag-mini-cart-item__content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ag-mini-cart-item__title {
  font-size: 13px;
  margin: 0;
}

.ag-mini-cart-item__quantity {
  font-size: 11px;
  color: #6366f1;
}

.ag-mini-cart-item__bottom {
  font-size: 12px;
}

.ag-mini-cart-item__remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 999px;
}

.ag-mini-cart__footer {
  border-top: 1px solid rgba(148, 163, 184, 0.4);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ag-mini-cart__subtotal {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.ag-mini-cart__buttons .ag-btn {
  margin-top: 6px;
}

/* Empty mini cart */
.ag-mini-cart--empty .ag-mini-cart__empty {
  text-align: center;
}

.ag-mini-cart__empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

/* --- Section: Checkout --------------------------------------------------- */

.ag-checkout-page .ag-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header & steps */
.ag-checkout-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.ag-checkout-header__title {
  font-size: 30px;
}

.ag-checkout-steps {
  display: inline-flex;
  gap: 10px;
}

.ag-checkout-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.6);
  font-size: 12px;
  color: #64748b;
}

.ag-checkout-step__number {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #667eea, #f093fb);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #ffffff;
}

.ag-checkout-step--active {
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.95),
    rgba(240, 147, 251, 0.95)
  );
  border-color: transparent;
  color: #ffffff;
}

/* 2-column layout */
.ag-checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1.1fr);
  gap: 24px;
}

/* Left: customer details card */
.ag-checkout-card {
  padding: 22px 22px 18px;
}

.ag-checkout-card__header {
  margin-bottom: 10px;
}

.ag-checkout-card__title {
  font-size: 20px;
}

.ag-checkout-card__subtitle {
  font-size: 13px;
  color: #64748b;
}

.ag-checkout-details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.ag-checkout-details-grid__col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Terms */
.ag-checkout-terms {
  margin-top: 12px;
  font-size: 12px;
}

/* Footer button */
.ag-checkout-card__footer {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

/* Right: sticky order review sidebar */
.ag-checkout-sidebar {
  padding: 18px 18px 20px;
}

.ag-checkout-sidebar--sticky {
  position: sticky;
  top: 90px;
}

.ag-checkout-sidebar__title {
  font-size: 18px;
  margin-bottom: 12px;
}

.ag-checkout-review {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Order review (review-order.php) */
.ag-order-review {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Items */
.ag-order-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ag-order-item {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto;
  gap: 10px;
  font-size: 13px;
}

.ag-order-item__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ag-order-item__title {
  font-weight: 500;
}

.ag-order-item__meta {
  font-size: 12px;
  color: #6366f1;
}

.ag-order-item__summary {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ag-order-item__quantity-inner {
  color: #64748b;
}

.ag-order-item__subtotal {
  font-weight: 500;
}

/* Totals */
.ag-order-totals {
  border-top: 1px solid rgba(148, 163, 184, 0.4);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ag-order-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.ag-order-total-row__label {
  color: #64748b;
}

.ag-order-total-row--grand .ag-order-total-row__value {
  font-size: 16px;
  font-weight: 600;
}

/* Payment section */
.ag-order-payment {
  margin-top: 14px;
}

.ag-order-payment .woocommerce-checkout-payment,
.ag-order-payment #payment {
  background: transparent;
  border-radius: 14px;
  padding: 0;
}

/* --- Section: Thank You / Success Dashboard ----------------------------- */

.ag-thankyou-page .ag-container {
  display: flex;
  justify-content: center;
  padding-top: 40px;
  padding-bottom: 40px;
}

.ag-thankyou {
  width: 100%;
  max-width: 720px;
}

.ag-thankyou-card {
  padding: 26px 26px 22px;
  animation: ag-fade-in-up 0.5s ease forwards;
}

.ag-thankyou-card__header {
  text-align: center;
  margin-bottom: 18px;
}

.ag-thankyou-card__title {
  font-size: 24px;
}

.ag-thankyou-card__subtitle {
  font-size: 14px;
  color: #64748b;
}

/* Success / error icons via CSS */
.ag-thankyou-card__icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  border-radius: 999px;
  position: relative;
}

.ag-thankyou-card__icon--success {
  background: radial-gradient(circle at 30% 0, #4ade80, transparent),
    radial-gradient(circle at 70% 100%, #22c55e, transparent);
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.7);
}

.ag-thankyou-card__icon--error {
  background: radial-gradient(circle at 30% 0, #f97373, transparent),
    radial-gradient(circle at 70% 100%, #ef4444, transparent);
  box-shadow: 0 0 24px rgba(248, 113, 113, 0.8);
}

/* Grid of order details */
.ag-thankyou-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  margin-bottom: 18px;
}

.ag-thankyou-grid__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ag-thankyou-grid__label {
  font-size: 12px;
  color: #64748b;
}

.ag-thankyou-grid__value {
  font-size: 14px;
}

.ag-thankyou-card__extra {
  margin-top: 8px;
}

.ag-thankyou-card__footer {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* --- Section: Animations ------------------------------------------------- */

@keyframes ag-fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Section: Responsive ------------------------------------------------- */

@media (max-width: 992px) {
  .ag-cart__content,
  .ag-checkout-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ag-cart-totals--sticky,
  .ag-checkout-sidebar--sticky {
    position: static;
  }

  .ag-checkout-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .ag-thankyou-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .ag-main {
    padding: 28px 0;
  }

  .ag-cart-item {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .ag-cart-item__actions {
    grid-column: 2 / -1;
    justify-content: flex-end;
  }

  .ag-cart-header__title {
    font-size: 22px;
  }

  .ag-checkout-card,
  .ag-checkout-sidebar,
  .ag-cart-totals,
  .ag-mini-cart,
  .ag-thankyou-card {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .ag-cart__coupon-fields {
    flex-direction: column;
  }
}
