/* =========================================
   FUNDGURU CUSTOMER EVENT PORTAL STYLES
   Designed for dynamic modular rendering
   ========================================= */

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

:root {
    --bg-page: #ffffff;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --text-highlight: #10b981; /* Emerald Green */
    --accent-gold: #d4af37;
    
    --border-light: #e5e7eb;
    --border-dark: #374151;
    
    --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;
    
    --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 & NAV
   ========================================= */
.portal-hero {
    position: relative;
    width: 100%;
    height: 350px;
    background-color: #000;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0.6;
}

.hero-top-nav {
    position: absolute;
    top: 20px;
    right: 40px;
    z-index: 20;
}

.top-menu {
    display: flex;
    gap: 2rem;
}

.menu-link {
    color: #ffd700; /* Gold-ish matching design */
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    transition: var(--transition);
}

.menu-link:hover {
    color: #fff;
}

.hero-content {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 3rem 40px;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.hero-title { font-size: 3.5rem; 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; }

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hero-btn {
    padding: 0.75rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
}

.outline-btn {
    background: transparent;
    border: 2px solid #ffd700;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.outline-btn:hover { background: rgba(255,215,0,0.2); }

.solid-btn {
    background: transparent;
    border: 2px solid #ffd700;
    color: white;
    line-height: 1.2;
}
.solid-btn:hover { background: rgba(255,215,0,0.2); }


/* =========================================
   LAYOUT STRUCTURE
   ========================================= */
.portal-container {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr; max-width: 1000px;
    gap: 4rem;
    align-items: start;
}

@media (max-width: 968px) {
    .portal-container { grid-template-columns: 1fr; gap: 2rem; }
    .hero-content { flex-direction: column; align-items: flex-start; gap: 2rem; }
}

/* =========================================
   LEFT COLUMN
   ========================================= */
.portal-left {
    min-width: 0;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.about-text {
    font-size: 1.1rem;
    color: var(--text-main);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.goal-tracker {
    margin-bottom: 3rem;
}
.goal-header {
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-highlight);
}
.goal-amount { color: #d4af37; } /* Gold color for goal */
.goal-bar-bg {
    width: 100%;
    height: 28px;
    background: rgba(229, 231, 235, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 14px;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

/* Tooltip */
.goal-bar-bg::after {
    content: attr(data-sold);
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 10;
}
.goal-bar-bg:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

.goal-bar-fill {
    height: 100%;
    background: linear-gradient(180deg, #4ade80 0%, #16a34a 50%, #15803d 100%);
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.5), 0 0 10px rgba(22, 163, 74, 0.4);
    border-radius: 14px;
    transition: width 1s ease-in-out;
    position: relative;
}

/* Auction Section */
.auction-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.5rem;
}
.see-all-link {
    color: var(--text-main);
    text-decoration: underline;
    font-size: 0.95rem;
    font-weight: 500;
}

.auction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.auction-card {
    background: #2b5f30;
    border: 2px solid #d4af37; /* Gold border */
    border-radius: var(--radius-md);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    cursor: pointer;
}
.auction-card:hover { 
    transform: translateY(-8px) scale(1.02); 
    box-shadow: 0 12px 24px rgba(212, 175, 55, 0.4); 
    border-color: #fce68d; /* Brighter gold on hover */
}
.auction-placeholder {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    text-shadow: 0 2px 5px rgba(0,0,0,0.9);
    background: rgba(0,0,0,0.3); /* slight dark tint behind text for extra contrast */
    padding: 0.5rem;
    border-radius: 4px;
    width: 100%;
}


/* =========================================
   RIGHT COLUMN (ACCORDIONS & INFO)
   ========================================= */
.reserve-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.accordion-item {
    margin-bottom: 1rem;
}

.accordion-header {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    border: none;
}

.ticket-header {
    background: var(--text-highlight);
    color: white;
}
.ticket-header:hover { background: #059669; }

.donation-header {
    background: transparent;
    border: 2px dashed #d1d5db;
    color: var(--text-main);
}
.donation-header:hover { border-color: var(--text-highlight); }
.donation-header i { color: #9ca3af; }

.accordion-body {
    background: white;
    border: 1px solid var(--border-light);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 1.5rem;
    display: none; /* hidden by default */
}

.accordion-body.open {
    display: block;
}

/* Event Info Card */
.event-info-card {
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-top: 2rem;
}

.event-info-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-highlight);
    margin-bottom: 1rem;
}

.info-row {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
}
.info-row strong { color: var(--text-main); font-weight: 700; }
.info-row span, .info-row a { color: var(--text-muted); }
.address-link { text-decoration: underline; }

/* Tickets Inner Styling */
.ticket-option {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.highlight-ticket {
    border-color: var(--text-highlight);
    background: rgba(16,185,129,0.02);
}
.ticket-info h4 { font-size: 1rem; margin-bottom: 0.2rem; }
.highlight-ticket h4 { color: var(--text-highlight); }
.ticket-info p { font-size: 0.8rem; color: var(--text-muted); }
.ticket-price { font-weight: 700; font-size: 1.1rem; color: var(--text-highlight); }

.qty-control {
    display: flex; align-items: center; gap: 0.5rem;
    background: #f3f4f6; border-radius: 20px; padding: 0.2rem;
}
.qty-btn { width: 26px; height: 26px; border-radius: 50%; border: none; background: white; cursor: pointer; font-weight: 600; }
.qty-val { font-weight: 700; font-size: 0.9rem; min-width: 16px; text-align: center; }

/* Donation inner styling */
.donation-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}
.donate-btn {
    border: 1px solid var(--border-light);
    background: white;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
}
.donate-btn:hover { border-color: var(--text-highlight); }

/* Cart Summary & Checkout */
.cart-line-item { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.9rem; }
.cart-line-item.subtotal { 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: 1rem; margin-top: 0.5rem;
    font-size: 1.25rem; font-weight: 800;
}
.checkout-btn {
    width: 100%;
    background: var(--text-main);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    margin-top: 1rem;
    cursor: pointer;
    transition: var(--transition);
}
.checkout-btn:hover { background: #000; }

.mt-3 { margin-top: 1rem; }
.form-input {
    padding: 0.5rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

/* Phase 4.0do: field-state borders across ALL customer-portal forms.
   Amber resting -> gold on focus -> green once the field holds valid content
   and is blurred (tabbed away). Pure CSS (every targeted field has a
   placeholder, so :placeholder-shown drives "is it filled"; :not(:focus) means
   green only appears after you leave the field; :valid keeps a bad email amber).
   THEME RULE (Bill, 2026-05-30): show on every form in LIGHT mode, and on the
   fixed-white auction modal (#bid-modal) in ANY theme. Green-mode inline forms
   sit on dark --bg-card (#0f3322), so they keep their default look there.
   !important is required because vendor/sponsor fields carry inline borders
   (vendor also has inline focus/blur handlers) that would otherwise win. */
html[data-theme="light"] .form-input,
html[data-theme="light"] .custom-amount,
#bid-modal .form-input {
    border: 1.5px solid #f59e0b !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
html[data-theme="light"] .form-input:focus,
html[data-theme="light"] .custom-amount:focus,
#bid-modal .form-input:focus {
    outline: none !important;
    border-color: #d4af37 !important;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18) !important;
}
html[data-theme="light"] .form-input[placeholder]:not(:focus):not(:placeholder-shown):valid,
html[data-theme="light"] .custom-amount[placeholder]:not(:focus):not(:placeholder-shown):valid,
#bid-modal .form-input[placeholder]:not(:focus):not(:placeholder-shown):valid {
    border-color: #10b981 !important;
    box-shadow: none !important;
}

/* Phase 4.0dr: cart-drawer contact + custom-tip fields. The drawer is a fixed
   white card (.cart-drawer { background: white }) in BOTH themes, so per Bill's
   white-card rule these get the amber/gold/green treatment in ANY theme (not
   light-gated). The fields have no .form-input class and carry inline borders,
   so by-ID selectors + !important are required. All have placeholders. */
#cart-buyer-name, #cart-buyer-email, #cart-buyer-phone, #drawer-tip-custom-input {
    border: 1.5px solid #f59e0b !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#cart-buyer-name:focus, #cart-buyer-email:focus, #cart-buyer-phone:focus, #drawer-tip-custom-input:focus {
    outline: none !important;
    border-color: #d4af37 !important;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18) !important;
}
#cart-buyer-name[placeholder]:not(:focus):not(:placeholder-shown):valid,
#cart-buyer-email[placeholder]:not(:focus):not(:placeholder-shown):valid,
#cart-buyer-phone[placeholder]:not(:focus):not(:placeholder-shown):valid,
#drawer-tip-custom-input[placeholder]:not(:focus):not(:placeholder-shown):valid {
    border-color: #10b981 !important;
    box-shadow: none !important;
}

/* Footer */
.portal-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; }
.portal-footer h3 { font-size: 1.25rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.5rem; }
.portal-footer p { font-size: 0.95rem; margin-bottom: 1.5rem; line-height: 1.6; }
.footer-cta { color: var(--text-highlight); font-weight: 600; text-decoration: none; }

/* =========================================
   SPONSORS MARQUEE
   ========================================= */
.sponsor-marquee-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
    overflow: hidden;
}

.sponsor-marquee-title {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
}

.sponsor-marquee-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    white-space: nowrap;
}

.sponsor-marquee-container::before,
.sponsor-marquee-container::after {
    content: "";
    position: absolute;
    top: 0;
    width: 50px;
    height: 100%;
    z-index: 2;
}

.sponsor-marquee-container::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-page), transparent);
}

.sponsor-marquee-container::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-page), transparent);
}

.sponsor-marquee-track {
    display: inline-flex;
    align-items: center;
    gap: 4rem;
    animation: marquee 20s linear infinite;
    padding-right: 4rem; /* Match the gap so math is perfect */
}

.sponsor-marquee-track img {
    height: 50px;
    max-width: 150px;
    width: auto;
    object-fit: contain;
    opacity: 0.6;
    filter: grayscale(100%);
    transition: var(--transition);
}

.sponsor-marquee-track img:hover {
    opacity: 1;
    filter: grayscale(0%);
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* =========================================
   SUB-PAGE STYLES (Donors, Sponsors, Auction)
   ========================================= */
.subpage-container {
    max-width: 1200px;
    margin: 3rem auto 5rem auto;
    padding: 0 2rem;
}

/* Phase 4.0dq: consistent in-body fund-type page title (hydrated from the
   admin's per-module Title field). Sits under the Back-to-Portal link. */
.fund-page-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    margin: 0 0 1.5rem 0;
}
/* Phase 4.0dv: intro paragraph under a fund-page title (e.g. the sponsorship
   blurb moved out of the cramped banner meta-chip). */
.fund-page-subtitle {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-muted);
    max-width: 760px;
    margin: -0.75rem 0 2rem 0;
}
/* Phase 4.0dq: center a lone vendor card (grid layout) instead of left-pinning it. */
#dynamic-vendor-grid:has(> .sponsor-card-large:only-child) {
    justify-content: center;
    grid-template-columns: minmax(300px, 480px);
}

.back-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 2rem;
    transition: var(--transition);
}
.back-link:hover { color: var(--text-highlight); }

/* Donors List */
.donor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}
.donor-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.donor-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--text-highlight); }
.donor-name { font-size: 1.1rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.5rem; }
.donor-tier { font-size: 0.85rem; color: var(--text-highlight); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.donor-tier.platinum { color: #d4af37; }
.donor-tier.gold { color: #f59e0b; }

/* Sponsor Grid */
.sponsor-grid-large {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}
.sponsor-card-large {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}
.sponsor-card-large:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.sponsor-card-large img {
    max-height: 100px;
    max-width: 80%;
    object-fit: contain;
    margin-bottom: 1.5rem;
}
.sponsor-tier-badge {
    background: #f3f4f6;
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Auction Catalog */
.auction-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2.5rem;
}
.catalog-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}
.catalog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.catalog-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
}
.catalog-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.catalog-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}
.catalog-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}
.catalog-bid-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}
.current-bid-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.current-bid-amount { font-size: 1.5rem; font-weight: 800; color: var(--text-highlight); }
.bid-btn {
    width: 100%;
    padding: 1rem;
    background: var(--text-main);
    color: white;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
}
.bid-btn:hover { background: var(--text-highlight); }

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-overlay.active {
    display: flex;
    opacity: 1;
}
.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}
.modal-overlay.active .modal-content {
    transform: translateY(0);
}
.modal-close {
    position: absolute;
    top: 1.5rem; right: 1.5rem;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
}
.modal-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 1rem; }
.modal-subtitle { color: var(--text-muted); margin-bottom: 2rem; font-size: 0.95rem; }

/* =========================================
   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: -520px;
    width: 520px;
    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;
    overflow-x: hidden; /* defensive: never let cart contents force horizontal scroll */
}
.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; word-break: break-word; overflow-wrap: anywhere; }
.cart-item-type { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.5rem; word-break: break-word; overflow-wrap: anywhere; }
.cart-meta-list { font-size: 0.82rem; color: var(--text-muted); background: #f9fafb; border: 1px solid var(--border-light); border-radius: 6px; padding: 0.5rem 0.7rem; margin: 0.25rem 0 0.6rem; display: flex; flex-direction: column; gap: 0.25rem; }
.cart-meta-row { line-height: 1.4; word-break: break-word; overflow-wrap: anywhere; }
.cart-meta-label { font-weight: 700; color: var(--text-main); margin-right: 0.25rem; text-transform: none; letter-spacing: normal; }
.cart-meta-value { color: var(--text-main); }
.cart-meta-inline { text-transform: none; letter-spacing: normal; word-break: break-word; overflow-wrap: anywhere; }
.cart-item-details { min-width: 0; flex-grow: 1; max-width: calc(100% - 90px); }
.cart-item-qty {
    /* Phase 4.0jh: proper stepper pill. The old loose +/- used theme-variable
       borders that vanish on the white drawer in green theme - "a + and a -
       with nothing around it". Fixed inks; reads as one quantity control. */
    display: inline-flex; align-items: center; gap: 0;
    border: 1.5px solid #d1d5db; border-radius: 999px; overflow: hidden;
    background: #f9fafb; margin-top: 0.35rem;
}
.cart-item-qty button {
    width: 30px; height: 28px; border: none; border-radius: 0; background: #f3f4f6;
    cursor: pointer; font-weight: 800; font-size: 0.95rem; color: #111827;
    display: flex; align-items: center; justify-content: center; transition: background 0.15s ease;
    font-family: inherit;
}
.cart-item-qty button:hover { background: #e5e7eb; }
.cart-item-qty span {
    min-width: 34px; text-align: center; font-weight: 800; color: #111827;
    font-size: 0.92rem; background: #ffffff; align-self: stretch;
    display: inline-flex; align-items: center; justify-content: center;
    border-left: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;
}
.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;
}
.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 {
    /* Phase 4.0it.3: the drawer is a WHITE card in both themes, but
       var(--text-main) is near-white in the green theme - the button was
       invisible until hover. Pin drawer ink to fixed dark-on-white. */
    width: 100%; padding: 1rem; background: #111827; 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; }

/* Phase 4.0it.3 - same fix for every text element inside the white drawer:
   theme variables follow the PAGE theme, the drawer doesn't. Fixed greys. */
.cart-drawer .cart-item-name { color: #111827; }
.cart-drawer .cart-item-type { color: #6b7280; }
.cart-drawer .cart-meta-list { background: #f3f4f6; border-color: #e5e7eb; }
.cart-drawer .cart-meta-label { color: #111827; }
.cart-drawer .cart-meta-value { color: #374151; }
.cart-drawer .cart-summary-row { color: #374151; }
.cart-drawer .cart-summary-row.total-row { color: #111827; }

/* =========================================
   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) {
    .modal-content {
        padding: 1.5rem !important;
        margin: 1rem !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        width: calc(100% - 2rem) !important;
    }
}


/* =========================================
   Phase 4.0bp - Customer portal redesign
   Option C identity-card hero + Light/Green theme toggle + bonus polish.
   Additions only - existing .hero-* rules left in place for backward compat.
   ========================================= */

/* --- Light + Green theme palettes (visitor toggle persists to fundguru-portal-theme) --- */
html[data-theme="green"] {
    --bg-page: #0a2616;
    --bg-card: #0f3322;
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --text-highlight: #10b981;
    --border-light: rgba(255,255,255,0.10);
}
html[data-theme="light"] {
    --bg-page: #ffffff;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --text-highlight: #10b981;
    --border-light: #e5e7eb;
}

/* --- Hero scrim + emerald fallback --- */
.portal-hero-scrim {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0) 35%, rgba(0,0,0,0.55) 100%);
    pointer-events: none;
    z-index: 1;
}
.portal-hero-no-banner {
    background: radial-gradient(circle at 25% 20%, #1d9e75 0%, #0f6e56 45%, #085041 100%);
}
.portal-hero-no-banner .hero-bg { display: none; }

/* --- Bottom-left identity card --- */
.portal-hero-identity-card {
    position: absolute; bottom: 28px; left: 32px; right: 32px;
    display: flex; align-items: flex-end; gap: 20px;
    color: #fff; z-index: 5;
}
/* Phase 4.0bq: logo tile is transparent so admin's logo art floats over the
   banner. Drop-shadow on the img provides legibility against bright photos. */
.portal-hero-logo-tile {
    width: 90px; height: 90px; flex-shrink: 0;
    background: transparent; border-radius: 0;
    padding: 0; box-shadow: none;
    display: flex; align-items: center; justify-content: center;
    overflow: visible;
}
.portal-hero-logo-tile img {
    max-width: 100%; max-height: 100%; object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.7));
}
.portal-hero-logo-tile .portal-org-initials {
    font-size: 1.6rem; font-weight: 700; color: #0a5d40;
}
.portal-hero-identity-body { flex: 1; min-width: 0; }
.portal-hero-eyebrow {
    font-size: 0.72rem; opacity: 0.9; text-transform: uppercase;
    letter-spacing: 1.5px; margin: 0 0 4px 0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
/* Phase 4.0bq: !important defeats the inline text-align:center set by legacy
   hydration JS (js/event_portal.js line ~261) which targets all H1 elements. */
.portal-hero-title-v2 {
    font-size: 2.4rem; font-weight: 700; line-height: 1.1;
    margin: 0 0 14px 0; text-shadow: 0 3px 10px rgba(0,0,0,0.7);
    color: #fff;
    text-align: left !important;
}
.portal-meta-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.portal-meta-chip {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.85rem; padding: 5px 12px;
    background: rgba(255,255,255,0.18); backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.3); border-radius: 999px;
    color: #fff; text-decoration: none;
}
.portal-meta-chip:hover { background: rgba(255,255,255,0.28); }

/* --- Top-right nav + theme toggle cluster --- */
.portal-hero-nav-cluster {
    position: absolute; top: 22px; right: 28px;
    display: flex; align-items: center; gap: 14px;
    z-index: 10;
}
.portal-hero-nav-cluster .portal-nav-links {
    display: flex; gap: 16px;
}
.portal-hero-nav-cluster .portal-nav-links a {
    color: #fff; font-size: 0.85rem; font-weight: 500;
    text-decoration: none; opacity: 0.95;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    transition: opacity 0.15s;
}
.portal-hero-nav-cluster .portal-nav-links a:hover { opacity: 1; text-decoration: underline; }
.portal-nav-divider { width: 1px; height: 16px; background: rgba(255,255,255,0.4); }
.portal-theme-toggle {
    display: inline-flex; gap: 0;
    background: rgba(0,0,0,0.45); border-radius: 999px;
    padding: 2px; border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}
.portal-theme-toggle button {
    background: none; border: none; cursor: pointer;
    padding: 5px 11px; border-radius: 999px;
    color: rgba(255,255,255,0.85); font-size: 0.75rem; font-weight: 500;
    display: inline-flex; align-items: center; gap: 4px;
    transition: background 0.15s, color 0.15s;
}
.portal-theme-toggle button.is-active {
    background: #fff; color: #0a5d40;
}

/* --- Goal tracker 50% milestone marker --- */
.portal-goal-bar-wrap {
    position: relative; width: 100%; height: 10px;
    background: var(--border-light); border-radius: 5px;
}
.portal-goal-milestone {
    position: absolute; left: 50%; top: -4px; bottom: -4px;
    width: 2px; background: rgba(0,0,0,0.3); pointer-events: none;
}
.portal-goal-milestone-balloon {
    position: absolute; left: 50%; top: -26px;
    transform: translateX(-50%);
    background: #0f6e56; color: #fff;
    font-size: 0.7rem; font-weight: 500;
    padding: 2px 8px; border-radius: 4px;
    white-space: nowrap; pointer-events: none;
}

/* --- Sponsor strip grayscale --- */
.portal-sponsor-static {
    max-height: 80px; max-width: 160px; object-fit: contain;
    filter: grayscale(100%); opacity: 0.55;
    transition: filter 0.3s, opacity 0.3s, transform 0.3s;
    cursor: pointer;
}
.portal-sponsor-static:hover {
    filter: grayscale(0%); opacity: 1;
    transform: scale(1.08);
}


/* =========================================
   Phase 4.0bw - Brighten banner in light mode.
   Default .hero-bg has opacity 0.6 (looks murky on a bright photo when
   the page theme is light). Restore full opacity in light mode and
   lighten the scrim so the photo really shines.
   ========================================= */
html[data-theme="light"] .hero-bg {
    opacity: 1;
}
html[data-theme="light"] .portal-hero-scrim {
    background: linear-gradient(180deg, transparent 0%, transparent 55%, rgba(0,0,0,0.30) 100%);
}


/* =========================================
   Phase 4.0bx - Fix invisible text inside fixed-white cards in green mode.
   These card classes all hardcode `background: white;` so they stay white
   regardless of page theme. But their inner text uses var(--text-main) /
   var(--text-muted), which my Phase 4.0bp green-mode palette sets to white
   and muted-gray-on-dark - producing white-on-white inside the cards.

   Fix: re-scope the text variables inside each white surface so children
   see dark values whatever the page theme. Cards stay white, text stays
   dark, no markup changes needed.
   ========================================= */
.sponsor-card-large,
.catalog-card,
.donor-card,
.accordion-body,
.tip-card,
.modal-content {
    --text-main: #111827;
    --text-muted: #6b7280;
    color: var(--text-main);
}

/* Phase 4.0dl: Option C hero mobile layout. Placed at END of file so it wins
   the cascade over the base (non-media) .portal-hero-* rules above — media
   queries do NOT add specificity, so an earlier-placed media block was being
   overridden by the later base position:absolute rules (that bug left the nav
   wrapping but the clusters still absolute, overlapping the title). Clean
   centered vertical stack: nav links -> theme toggle -> logo -> title -> chips. */
@media (max-width: 768px) {
    .portal-hero {
        height: auto !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 18px 14px 24px;
    }
    .portal-hero-nav-cluster {
        position: static !important;
        top: auto; right: auto;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        width: 100%;
        margin: 0 0 16px;
    }
    .portal-hero-nav-cluster .portal-nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px 16px;
    }
    .portal-nav-divider { display: none; }
    .portal-theme-toggle { margin: 2px auto 0; }
    .portal-hero-identity-card {
        position: static !important;
        left: auto; right: auto; bottom: auto;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
        width: 100%;
        margin: 0;
    }
    .portal-hero-logo-tile { width: 50px !important; height: 50px !important; }
    .portal-hero-identity-body { flex: none; text-align: center; }
    .portal-hero-eyebrow { text-align: center; }
    .portal-hero .portal-hero-title-v2 {
        font-size: 1.5rem !important;
        text-align: center !important;
        margin: 0 0 10px;
    }
    .portal-meta-chips { justify-content: center; }
}
