/* ------------------------------------------------------------------ */
/*  CHECKOUT  (/payments/products)                                     */
/*  Dark-glass restyle matching                                        */
/*  assets/satelles-checkout-package/satelles-checkout-restyled.html   */
/*  Background (gradient + stars) comes from base.html's               */
/*  star_animation.html; tokens come from base.css.                    */
/* ------------------------------------------------------------------ */

/* Page title — centered intro block */
.checkout-header {
    max-width: 1100px;
    margin: 0 auto 36px auto;
    padding: 0 8px;
    text-align: center;
}
.checkout-header h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;            /* Medium */
    font-size: 42px;
    line-height: 50.4px;         /* 120% */
    letter-spacing: -0.8px;
    color: #FFCE76;
    margin: 0 0 12px 0;
}
/* Scoped under .checkout-header so it does NOT leak to other pages
   (.subtitle is also used by register/profile/OTP templates). */
.checkout-header .subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 25.6px;         /* 160% */
    letter-spacing: 0;
    color: var(--text-primary);
    max-width: 640px;
    margin: 0 auto;
}

/* Back button (shown when embedded Stripe checkout is mounted) */
#backBtn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin: 0 0 12px 0;
    box-shadow: none;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#backBtn:hover {
    background: var(--glass-hover);
    color: var(--text-primary);
}

/* Layout (2-col grid) */
.layout {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
}

/* ── PRODUCT LIST ── */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.product-card {
    /* Glass surface, gold-tinted border (matches .card in base.css) */
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 206, 118, 0.2);
    border-radius: 16px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(0, 0, 0, 0.4);
    color: var(--text-primary);

    padding: 18px 20px;
    display: grid;
    grid-template-columns: auto 72px 1fr auto auto;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: border-color 0.25s ease, box-shadow 0.25s ease,
                transform 0.15s ease, background 0.25s ease;
    user-select: none;
}

.product-card:hover {
    border-color: rgba(255, 206, 118, 0.45);
    box-shadow:
        0 12px 40px rgba(255, 102, 34, 0.18),
        inset 0 0 0 1px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

.product-card.selected {
    border-color: var(--gradient-bright);
    background:
        linear-gradient(135deg, rgba(255, 102, 34, 0.10), rgba(255, 170, 51, 0.06)),
        rgba(0, 0, 0, 0.55);
    box-shadow:
        0 0 0 1px rgba(255, 119, 34, 0.55),
        0 12px 40px rgba(255, 102, 34, 0.25),
        inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

/* Custom checkbox */
.check-wrap {
    width: 22px;
    height: 22px;
    border: 2px solid var(--glass-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
    background: var(--glass-bg);
}
.product-card.selected .check-wrap {
    background: linear-gradient(135deg, var(--gradient-orange), var(--gradient-bright));
    border-color: var(--gradient-bright);
}
.check-wrap svg {
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.15s, transform 0.15s;
}
.product-card.selected .check-wrap svg {
    opacity: 1;
    transform: scale(1);
}

/* Product image placeholder */
.product-img {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 170, 51, 0.35), transparent 60%),
        linear-gradient(135deg, rgba(255, 102, 34, 0.20), rgba(204, 51, 17, 0.20));
    border: 1px solid rgba(255, 206, 118, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.product-info { flex: 1; min-width: 0; }

.product-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.product-tag {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 170, 51, 0.18), rgba(255, 204, 102, 0.18));
    color: var(--text-accent);
    border: 1px solid rgba(255, 206, 118, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    white-space: nowrap;
}

.product-price {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-accent);
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
}

/* Qty stepper */
.qty-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.qty-btn:hover {
    background: var(--glass-hover);
    border-color: var(--text-accent);
    color: var(--text-accent);
}
.qty-num {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 18px;
    text-align: center;
}

/* ── CART PANEL ── */
.cart-panel {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 206, 118, 0.25);
    border-radius: 18px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    padding: 26px 24px;
    position: sticky;
    top: 30px;
}

.cart-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-badge {
    background: linear-gradient(135deg, var(--gradient-orange), var(--gradient-bright));
    color: rgba(0, 0, 0, 0.9);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    min-width: 26px;
    text-align: center;
}

.cart-items { margin-bottom: 18px; min-height: 40px; }

.cart-empty {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-style: italic;
    text-align: center;
    padding: 18px 0;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 0;
    font-size: 0.92rem;
    color: var(--text-secondary);
    animation: slideIn 0.2s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.cart-item-name  { color: var(--text-primary); font-weight: 400; }
.cart-item-qty   { color: var(--text-muted); font-size: 0.8rem; margin-left: 4px; }
.cart-item-price { color: var(--text-accent); font-weight: 500; font-family: 'Space Grotesk', sans-serif; }

.cart-divider {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 16px 0 12px;
    opacity: 1;
}

.cart-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 12px 0 20px;
}
.cart-total span:last-child { color: var(--text-accent); }

/* Blue CTA button — same blue gradient as landing.css .btn-primary
   (landing.css is page-scoped, so the gradient is restated here). */
.btn-checkout {
    width: 100%;
    padding: 14px 24px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.20);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.00) 0%, rgba(255, 255, 255, 0.06) 100%),
        linear-gradient(0deg, #0040FF 0%, #11B5F0 152.63%),
        rgba(255, 255, 255, 0.01);
    box-shadow: 0 5px 9px 0 rgba(255, 255, 255, 0.08) inset;
    backdrop-filter: blur(60px);
    -webkit-backdrop-filter: blur(60px);
    color: #FFFFFF;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease,
                box-shadow 0.3s ease, transform 0.3s ease, color 0.3s ease;
}
.btn-checkout:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.30);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.00) 0%, rgba(255, 255, 255, 0.10) 100%),
        linear-gradient(0deg, #0040FF 0%, #11B5F0 152.63%),
        rgba(255, 255, 255, 0.02);
    transform: translateY(-1px);
    box-shadow: 0 5px 9px 0 rgba(255, 255, 255, 0.12) inset;
}
.btn-checkout:disabled {
    background: var(--glass-bg);
    color: var(--text-muted);
    border-color: var(--glass-border);
    cursor: default;
    transform: none;
    box-shadow: none;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Embedded Stripe checkout container */
#checkout {
    display: none;
    padding: 20px;
    max-width: 1100px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 206, 118, 0.25);
    border-radius: 20px;
    box-shadow:
        0 20px 80px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

/* ── RESPONSIVE ── */
@media (max-width: 820px) {
    .layout { grid-template-columns: 1fr; }
    .cart-panel { position: static; }

    /* Smaller, still on-brand title on tablets/phones */
    .checkout-header h1 {
        font-size: 32px;
        line-height: 1.2;
    }

    /* Let full product names wrap instead of truncating */
    .product-name {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}
@media (max-width: 560px) {
    .product-card {
        grid-template-columns: auto 56px 1fr;
        grid-template-rows: auto auto;
        column-gap: 14px;
        row-gap: 12px;
        padding: 16px;
    }

    /* Row 1: checkbox + image + (name/description) */
    .check-wrap { grid-row: 1; grid-column: 1; }
    /* Match the 56px grid column so the icon can't overflow into the
       product name (base width is 72px → 16px of bleed otherwise). */
    .product-img {
        grid-row: 1;
        grid-column: 2;
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
    .product-info { grid-row: 1; grid-column: 3; }

    /* Row 2: tag on the left, price on the right — separate columns
       so they never overlap and stay readable down to ~360px. */
    .product-tag {
        grid-row: 2;
        grid-column: 1 / 3;
        justify-self: start;
        align-self: center;
    }
    .qty-wrap {
        grid-row: 2;
        grid-column: 3;
        justify-self: end;
        align-self: center;
    }
    .product-price {
        font-size: 1.15rem;
        text-align: right;
        min-width: 0;
    }
}
