/* =========================================
   FUNDGURU PUBLIC CHECKOUT STYLES
   Designed for high-conversion e-commerce
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-page: #f9fafb;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --text-highlight: #10b981; /* Emerald Green */
    --accent-blue: #3b82f6;
    
    --border-light: #e5e7eb;
    --border-hover: #10b981;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --transition: all 0.2s ease-in-out;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body { background-color: var(--bg-page); color: var(--text-main); line-height: 1.5; }

/* =========================================
   HERO BANNER
   ========================================= */
.checkout-hero {
    position: relative;
    width: 100%;
    height: 350px;
    background-color: #000;
}

.checkout-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.65;
}

.checkout-hero-content {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 3rem 2rem;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
    color: white;
}

.hero-title { font-size: 3rem; font-weight: 800; letter-spacing: -1px; margin-bottom: 0.5rem; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.hero-meta { display: flex; gap: 1.5rem; font-size: 1rem; color: rgba(255,255,255,0.9); font-weight: 500; }
.hero-meta i { color: var(--text-highlight); margin-right: 0.25rem; }

/* =========================================
   LAYOUT STRUCTURE
   ========================================= */
.checkout-container {
    max-width: 1200px;
    margin: -40px auto 4rem auto; /* Overlaps hero slightly */
    padding: 0 2rem;
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 968px) {
    .checkout-container { grid-template-columns: 1fr; }
}

/* =========================================
   FLOW CARDS (LEFT COLUMN)
   ========================================= */
.flow-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-light);
}

.flow-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.flow-step { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-highlight); font-weight: 700; margin-bottom: 0.25rem; }
.flow-title { font-size: 1.5rem; font-weight: 700; color: var(--text-main); }

/* Ticket Selection Grid */
.ticket-option {
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.ticket-option:hover { border-color: var(--text-highlight); background: rgba(16, 185, 129, 0.02); }

.ticket-info h4 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.ticket-info p { font-size: 0.85rem; color: var(--text-muted); }
.ticket-price { font-weight: 700; font-size: 1.25rem; color: var(--text-highlight); }

/* Quantity Controls */
.qty-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f3f4f6;
    border-radius: 30px;
    padding: 0.25rem;
}
.qty-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: white;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}
.qty-btn:hover { background: var(--text-highlight); color: white; }
.qty-val { font-weight: 700; font-size: 1rem; min-width: 20px; text-align: center; }

/* =========================================
   OPTIONAL TIP WIDGET (OPTION B)
   ========================================= */
.tip-widget {
    background: #f8fafc;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
}

.tip-message { font-size: 0.95rem; color: #475569; margin-bottom: 1.25rem; line-height: 1.5; }
.tip-message strong { color: var(--text-main); }

.tip-card-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tip-card {
    border: 1px solid var(--border-light);
    background: white;
    padding: 0.75rem 0.25rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    font-weight: 700;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}
.tip-card:hover { border-color: var(--text-highlight); background: rgba(16, 185, 129, 0.05); }
.tip-card.active {
    background: var(--text-highlight);
    color: white;
    border-color: var(--text-highlight);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

.tip-custom-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 1rem;
    margin-top: 0.5rem;
    display: none;
}
.tip-custom-input.visible { display: block; }

/* =========================================
   PAYMENT FORM MOCK
   ========================================= */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-label { font-size: 0.85rem; font-weight: 600; color: var(--text-main); }
.form-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
}
.form-input:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }

/* Phase 4.0dp: amber resting -> gold focus -> green once filled+valid+blurred,
   matching the customer-portal forms (event_portal.css 4.0do). Gated to
   data-theme="light": checkout.html is hardcoded light so it always shows;
   ticket_purchase.html ALSO loads this stylesheet and is theme-toggleable, so
   gating keeps its Green-mode forms on the default look. Every field (incl.
   card number / exp / cvc) has a placeholder, so :placeholder-shown works. */
html[data-theme="light"] .form-input,
html[data-theme="light"] .tip-custom-input {
    border: 1.5px solid #f59e0b;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
html[data-theme="light"] .form-input:focus,
html[data-theme="light"] .tip-custom-input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}
html[data-theme="light"] .form-input[placeholder]:not(:focus):not(:placeholder-shown):valid,
html[data-theme="light"] .tip-custom-input[placeholder]:not(:focus):not(:placeholder-shown):valid {
    border-color: #10b981;
    box-shadow: none;
}

/* =========================================
   ORDER SUMMARY (RIGHT COLUMN STICKY)
   ========================================= */
.cart-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--text-highlight);
    position: sticky;
    top: 2rem;
    overflow: hidden;
}

.cart-header {
    background: var(--text-highlight);
    color: white;
    padding: 1.5rem;
    font-weight: 600;
    display: flex; justify-content: space-between; align-items: center;
}

.cart-body { padding: 1.5rem; }

.cart-line-item { display: flex; justify-content: space-between; margin-bottom: 1rem; font-size: 0.95rem; }
.cart-line-item.subtotal { border-top: 1px solid var(--border-light); padding-top: 1rem; margin-top: 0.5rem; font-weight: 600; }
.cart-line-item.tip { color: var(--text-highlight); font-weight: 600;}

.cart-total {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 2px solid var(--border-light);
    padding-top: 1.5rem; margin-top: 0.5rem;
    font-size: 1.5rem; font-weight: 800;
}

.checkout-btn {
    width: 100%;
    background: var(--text-main);
    color: white;
    border: none;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex; justify-content: center; align-items: center; gap: 0.5rem;
}
.checkout-btn:hover { background: #000; transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2); }
.checkout-btn:active { transform: translateY(0); }

.secure-badge { text-align: center; font-size: 0.8rem; color: var(--text-muted); margin-top: 1rem; }
.secure-badge i { color: var(--text-highlight); }

/* =========================================
   MARKETING FOOTER
   ========================================= */
.checkout-footer {
    max-width: 800px;
    margin: 4rem auto 2rem auto;
    text-align: center;
    padding: 3rem 2rem;
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
}
.footer-logo {
    height: 48px;
    width: auto;
    margin-bottom: 1.5rem;
    opacity: 0.8;
    transition: var(--transition);
}
.footer-logo:hover { opacity: 1; }
.checkout-footer h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}
.checkout-footer p {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}
.footer-cta {
    display: inline-block;
    color: var(--text-highlight);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition);
}
.footer-cta:hover { color: var(--text-main); text-decoration: underline; }


/* =========================================
   GLOBAL CART DRAWER
   ========================================= */
.floating-cart {
    position: fixed;
    top: 380px;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--text-highlight);
    color: white;
    border-radius: 50%;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16,185,129,0.4);
    z-index: 998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.floating-cart:hover {
    transform: scale(1.05);
}
.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444; /* Red */
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.cart-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.cart-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.cart-drawer {
    position: fixed;
    top: 0; right: -450px;
    width: 450px;
    max-width: 100vw;
    height: 100%;
    background: white;
    z-index: 1000;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}
.cart-drawer.open {
    right: 0;
}

.cart-drawer-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cart-drawer-header h2 { font-size: 1.25rem; font-weight: 800; }
.cart-drawer-header button {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
}

.cart-items-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.cart-item-details { flex-grow: 1; }
.cart-item-name { font-weight: 700; color: var(--text-main); margin-bottom: 0.25rem; }
.cart-item-type { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.5rem; }
.cart-item-qty {
    display: flex; align-items: center; gap: 0.5rem;
}
.cart-item-qty button {
    width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border-light); background: white; cursor: pointer; font-weight: 600;
}
.cart-item-price {
    font-weight: 700; color: var(--text-highlight);
    display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between;
}
.cart-item-remove {
    background: transparent; border: none; color: #ef4444; cursor: pointer; font-size: 0.9rem;
}

.cart-drawer-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-light);
    background: #f9fafb;
    /* Phase 4.0r — let the footer scroll internally when the Stripe Payment Element mounts.
       Without this, the Pay button can fall below the viewport at 100% zoom because the
       footer's natural content height exceeds the remaining drawer space. */
    overflow-y: auto;
    min-height: 0;
    max-height: calc(100vh - 90px);   /* leave room for the drawer header */
    -webkit-overflow-scrolling: touch;
}
.cart-summary-row {
    display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.9rem;
}
.cart-summary-row.tip-row { color: var(--text-highlight); font-weight: 600; }
.cart-summary-row.fee-row { color: var(--text-muted); }
.cart-summary-row.total-row {
    font-size: 1.25rem; font-weight: 800; border-top: 2px solid var(--border-light); padding-top: 1rem; margin-top: 0.5rem;
}
.cart-checkout-btn {
    width: 100%; padding: 1rem; background: var(--text-main); color: white; border: none; border-radius: var(--radius-md); font-weight: 700; font-size: 1.1rem; margin-top: 1.5rem; cursor: pointer; transition: background 0.2s;
}
.cart-checkout-btn:hover { background: #000; }

/* =========================================
   CART DRAWER TIP GRID
   ========================================= */
.tip-card-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.35rem;
    margin-bottom: 0.5rem;
    width: 100%;
}
.tip-card {
    border: 1px solid var(--border-subtle);
    background: white;
    padding: 0.5rem 0.25rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    color: var(--text-main);
}
.tip-card:hover { border-color: #f59e0b; background: rgba(234, 179, 8, 0.05); }
.tip-card.active {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
    box-shadow: 0 4px 6px rgba(234, 179, 8, 0.2);
}
.tip-custom-input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    display: none;
}


/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 768px) {
    /* Adjust main containers for mobile screens */
    body {
        padding-top: 0;
    }
    
    .portal-container, .checkout-container {
        padding: 1rem;
        width: 100%;
        margin-top: 0;
    }
    
    /* Hero Banners */
    .portal-hero, .checkout-hero {
        height: 250px;
    }
    
    .hero-title {
        font-size: 2.2rem !important;
    }
    
    /* Goal Tracker */
    .goal-tracker {
        padding: 1rem !important;
        margin-bottom: 2rem !important;
        flex-direction: column;
        align-items: flex-start !important;
    }
    .goal-tracker > div:first-child {
        margin-bottom: 0.5rem;
    }
    
    /* Action Cards */
    .fundraiser-actions-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* The floating cart */
    .floating-cart {
        top: auto !important;
        bottom: 2rem !important;
        right: 1.5rem !important;
        width: 65px !important;
        height: 65px !important;
        box-shadow: 0 5px 20px rgba(16, 185, 129, 0.6) !important;
        z-index: 9999 !important; /* Ensure it stays on top of everything on mobile */
    }
    
    .cart-badge {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.8rem !important;
    }
    
    /* Cart Drawer */
    .cart-drawer {
        width: 100vw !important;
        right: -100vw !important;
    }
    
    .cart-drawer.open {
        right: 0 !important;
    }
}


@media (max-width: 768px) {
    /* Checkout / Ticket Purchase specific fixes */
    .form-grid {
        grid-template-columns: 1fr !important;
    }
    
    .ticket-option {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
    
    .qty-control {
        align-self: flex-end;
    }
    
    #raffle-order-bump > div:nth-child(2) {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    #raffle-order-bump > div:nth-child(2) > div:last-child {
        align-self: flex-end;
        margin-top: 0.5rem;
    }
}
