/**
 * Products Section Component - Isolated Styles (BEM Naming)
 * Component prefix: ee-products-section
 */

/* Component Root - Isolated from global styles */
.ee-products-section {
    /* Reset inherited styles */
    all: initial;
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    
    /* Component styles */
    background: #f8f9fa;
    padding: 0;
    overflow-x: hidden;
}

.ee-products-section__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Full-width band for "Become a Sponsor" and "Register to Play" – breaks up the page, adds wow */
.ee-products-section__category-band {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-bottom: 2.25rem;
    position: relative;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.ee-products-section__category-band::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.ee-products-section__category-band-inner {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.25rem 1rem;
    width: 100%;
}

/* Sponsorships band: image from API (golf vs other defaults) or gradient when no image (color-only) */
.ee-products-section__category-band--sponsorships {
    background-image: var(--products-band-sponsors-bg, linear-gradient(135deg, #1a472a 0%, #2d5a3d 40%, #1e3d2a 100%));
}

.ee-products-section__category-band--sponsorships::after {
    background: linear-gradient(180deg, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.5) 100%);
}

/* Registration band: image from API (golf vs other defaults) or gradient when no image (color-only) */
.ee-products-section__category-band--registration {
    background-image: var(--products-band-registration-bg, linear-gradient(135deg, #0d2818 0%, #1a472a 50%, #0d2818 100%));
}

.ee-products-section__category-band--registration::after {
    background: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.6) 100%);
}

/* Band header typography: light text */
.ee-products-section__category-band .ee-products-section__category-header {
    border-bottom: none;
    padding: 0;
    margin-bottom: 0;
}

.ee-products-section__category-band .ee-products-section__category-icon {
    color: rgba(255,255,255,0.95);
}

/* Section header style: match Event Schedule title (default section header font/size) */
.ee-products-section__category-band .ee-products-section__category-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4), 0 0 24px rgba(0,0,0,0.2);
}

.ee-products-section__category-band .ee-products-section__category-subtitle {
    color: rgba(255,255,255,0.92);
    font-size: 0.9375rem;
}

/* When API provides header font color (--products-band-header-color on band) */
.ee-products-section__category-band--custom-header .ee-products-section__category-title,
.ee-products-section__category-band--custom-header .ee-products-section__category-subtitle {
    color: var(--products-band-header-color, #fff);
}

/* Filter buttons on band: light style */
.ee-products-section__category-band .ee-products-section__filter-btn {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
    color: #fff;
}

.ee-products-section__category-band .ee-products-section__filter-btn:hover {
    background: rgba(255,255,255,0.35);
    border-color: #fff;
    color: #fff;
}

.ee-products-section__category-band .ee-products-section__filter-btn--active {
    background: #fff;
    border-color: #fff;
    color: #1a472a;
}

.ee-products-section__loading {
    text-align: center;
    padding: 2rem;
    color: #333;
}

/* Product Category Section */
.ee-products-section__category {
    margin-bottom: 1.25rem;
    padding: 1.25rem 0;
}

.ee-products-section__category:not(:last-child) {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 1.25rem;
}

/* Category Header */
.ee-products-section__category-header {
    text-align: center;
    margin-bottom: 0.875rem;
    padding: 0.625rem 0;
    border-bottom: 2px solid #e9ecef;
}

.ee-products-section__category-icon {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* Section header style: match Event Schedule title (default section header font/size) */
.ee-products-section__category-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.ee-products-section__category-subtitle {
    font-size: 0.85rem;
    color: #6c757d;
    max-width: 600px;
    margin: 0 auto;
}

/* Category Variants (addons keep gradient; sponsorships/registration use band as header) */
.ee-products-section__category--sponsorships {
    background: transparent;
    border-top: none;
}

.ee-products-section__category--sponsorships .ee-products-section__category-icon {
    color: #ffc107;
}

.ee-products-section__category--registration {
    background: transparent;
    border-top: none;
}

.ee-products-section__category--registration .ee-products-section__category-icon {
    color: #007bff;
}

/* Space between band and cards is on the band (margin-bottom) so it stays correct when "Available Only" hides the first card(s) */

/* Space between section header and first product card (addons, no band) */
.ee-products-section__category--addons .ee-products-section__product-card:first-child {
    margin-top: 2.25rem;
}

.ee-products-section__category--addons {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-top: 2px solid #28a745;
}

.ee-products-section__category--addons .ee-products-section__category-icon {
    color: #28a745;
}

/* Product Filter Bar */
.ee-products-section__filter-bar {
    display: flex;
    gap: 0.625rem;
    margin-top: 0.875rem;
    flex-wrap: wrap;
    justify-content: center;
}

.ee-products-section__filter-btn {
    padding: 0.375rem 0.875rem;
    border: 1px solid #e9ecef;
    background: white;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    color: #6c757d;
    font-family: inherit;
}

.ee-products-section__filter-btn:hover {
    border-color: #007bff;
    color: #007bff;
}

.ee-products-section__filter-btn--active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

/* Product Card - clickable when available to open Enter Details form */
.ee-products-section__product-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.625rem 0.875rem;
    margin-bottom: 0.625rem;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    cursor: pointer;
}

.ee-products-section__product-card:hover {
    border-color: #007bff;
    box-shadow: 0 5px 20px rgba(0,123,255,0.15);
    transform: translateY(-2px);
}

.ee-products-section__product-card--sold-out {
    cursor: default;
    opacity: 0.85;
}

.ee-products-section__product-card--sold-out:hover {
    transform: none;
}

.ee-products-section__product-card--sold-out.ee-products-section__product-card--hidden {
    display: none;
}

.ee-products-section__product-card--registration-closed {
    cursor: default;
    opacity: 0.9;
}

.ee-products-section__product-card--registration-closed:hover {
    transform: none;
}

.ee-products-section__product-card--registration-closed.ee-products-section__product-card--hidden {
    display: none;
}

.ee-products-section__product-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.875rem;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.ee-products-section__product-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    flex: 1;
}

.ee-products-section__product-price-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
}

.ee-products-section__product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #007bff;
    margin: 0;
}

.ee-products-section__product-price-original {
    font-size: 1rem;
    font-weight: 600;
    color: #6c757d;
    text-decoration: line-through;
    margin: 0;
}

.ee-products-section__product-price--early-bird {
    color: #28a745;
}

.ee-products-section__early-bird-deadline {
    font-size: 0.75rem;
    color: #6c757d;
    margin: 0;
}

.ee-products-section__status-badge--early-bird {
    background: #17a2b8;
    color: white;
}

.ee-products-section__product-description {
    color: #495057;
    line-height: 1.6;
    margin-bottom: 0.875rem;
    font-size: 0.9rem;
}

.ee-products-section__product-description p {
    margin-bottom: 0.5rem;
}

.ee-products-section__product-description ul {
    margin-left: 1.25rem;
    font-size: 0.9rem;
}

.ee-products-section__status-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
}

.ee-products-section__status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ee-products-section__status-badge--sold-out {
    background: #dc3545;
    color: white;
}

.ee-products-section__status-badge--available {
    background: #28a745;
    color: white;
}

.ee-products-section__status-badge--closed {
    background: #6c757d;
    color: white;
}

.ee-products-section__status-badge--coming-soon {
    background: #ffc107;
    color: #000;
}

/* Expand Form Button */
.ee-products-section__expand-btn {
    width: 100%;
    padding: 0.75rem;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
    font-family: inherit;
}

.ee-products-section__expand-btn:hover,
.ee-products-section__expand-btn:focus {
    background: #e9ecef;
    color: #212529;
    border-color: #dee2e6;
}

.ee-products-section__expand-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Product Form */
.ee-products-section__product-form {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e9ecef;
}

.ee-products-section__product-form--collapsed {
    display: none;
}

.ee-products-section__form-field-group {
    margin-bottom: 0.875rem;
}

.ee-products-section__form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    display: block;
    font-size: 0.95rem;
}

.ee-products-section__form-label--required::after {
    content: " *";
    color: #dc3545;
}

.ee-products-section__form-control,
.ee-products-section__form-select {
    border: 2px solid #ced4da;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: all 0.3s;
    font-size: 1rem;
    width: 100%;
    font-family: inherit;
}

.ee-products-section__form-control:focus,
.ee-products-section__form-select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
    outline: none;
}

.ee-products-section__form-control--invalid,
.ee-products-section__form-select--invalid {
    border-color: #dc3545;
}

.ee-products-section__form-control--valid,
.ee-products-section__form-select--valid {
    border-color: #28a745;
}

/* Checkbox Group */
.ee-products-section__checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ee-products-section__checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.ee-products-section__checkbox-option:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.ee-products-section__checkbox-option input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #007bff;
}

.ee-products-section__checkbox-option input[type="checkbox"]:checked + label {
    font-weight: 600;
    color: #007bff;
}

.ee-products-section__checkbox-option:has(input[type="checkbox"]:checked) {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.05);
}

.ee-products-section__checkbox-option label {
    cursor: pointer;
    margin: 0;
    flex: 1;
    user-select: none;
}

/* Add to Cart Button */
.ee-products-section__add-to-cart-btn {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    margin-top: 1.5rem;
    transition: all 0.3s;
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: #007bff;
    color: white;
}

.ee-products-section__add-to-cart-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,123,255,0.3);
}

.ee-products-section__add-to-cart-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ee-products-section__add-to-cart-btn--loading {
    pointer-events: none;
}

.ee-products-section__add-to-cart-btn--loading .fa-spinner {
    margin-right: 0.35em;
}

.ee-products-section__add-to-cart-btn--success {
    background: #28a745;
    border-color: #28a745;
    color: white;
    animation: ee-add-to-cart-success-pulse 0.4s ease;
}

.ee-products-section__add-to-cart-btn--success .fa-check {
    margin-right: 0.35em;
}

@keyframes ee-add-to-cart-success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .ee-products-section__add-to-cart-btn--success {
        animation: none;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .ee-products-section {
        padding: 1rem 0;
    }
    
    .ee-products-section__category {
        padding: 1rem 0;
    }
    
    /* Section header: scale down to match Event Schedule mobile */
    .ee-products-section__category-title {
        font-size: 1.25rem;
    }
    .ee-products-section__category-band .ee-products-section__category-title {
        font-size: 1.25rem;
    }
    
    .ee-products-section__product-card-header {
        flex-direction: column;
    }
    
    .ee-products-section__product-price-section {
        align-items: flex-start;
    }
    
    .ee-products-section__product-name {
        font-size: 1.5rem;
    }
    
    .ee-products-section__product-price {
        font-size: 1.75rem;
    }
}

/* Add-to-cart drawer (Phase 2) – slide-out from right, modern e‑commerce style */
.ee-add-to-cart-drawer-wrapper {
    position: fixed;
    inset: 0;
    z-index: 10000;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.ee-add-to-cart-drawer-wrapper--open {
    pointer-events: auto;
}
.ee-add-to-cart-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.22s ease;
}
.ee-add-to-cart-drawer-wrapper--open .ee-add-to-cart-drawer-backdrop {
    opacity: 1;
}
.ee-add-to-cart-drawer-backdrop--closing {
    opacity: 0;
}
.ee-add-to-cart-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 400px;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.22s ease;
}
.ee-add-to-cart-drawer-wrapper--open .ee-add-to-cart-drawer {
    transform: translateX(0);
}
.ee-add-to-cart-drawer--closing {
    transform: translateX(100%);
}
.ee-add-to-cart-drawer-inner {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: auto;
}
.ee-add-to-cart-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.ee-add-to-cart-drawer-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111;
    letter-spacing: -0.02em;
}
.ee-add-to-cart-drawer-close {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    background: none;
    color: #666;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ee-add-to-cart-drawer-close:hover {
    color: #111;
    background: #f5f5f5;
}
.ee-add-to-cart-drawer-message {
    font-size: 0.875rem;
    color: #444;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}
.ee-add-to-cart-drawer-message p { margin: 0 0 0.5rem 0; }
.ee-add-to-cart-drawer-message p:last-child { margin-bottom: 0; }
.ee-add-to-cart-drawer-addons {
    margin-bottom: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}
.ee-add-to-cart-drawer-addons-title {
    margin: 0 0 0.75rem 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.ee-add-to-cart-drawer-addons-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.ee-add-to-cart-drawer-addon {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
}
.ee-add-to-cart-drawer-addon-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}
.ee-add-to-cart-drawer-addon-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #222;
}
.ee-add-to-cart-drawer-addon-price {
    font-size: 0.8125rem;
    color: #555;
}
.ee-add-to-cart-drawer-addon-btn {
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #0066cc;
    background: transparent;
    border: 1px solid #0066cc;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.ee-add-to-cart-drawer-addon-btn:hover {
    background: #0066cc;
    color: #fff;
}
.ee-add-to-cart-drawer-actions {
    margin-top: auto;
    padding-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.ee-add-to-cart-drawer-continue {
    padding: 0.6rem 0;
    font-size: 0.9375rem;
    color: #0066cc;
    background: none;
    border: none;
    cursor: pointer;
    text-align: center;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.ee-add-to-cart-drawer-continue:hover {
    color: #004499;
}
.ee-add-to-cart-drawer-checkout {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary-color, #007bff);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.3s ease;
}
.ee-add-to-cart-drawer-checkout:hover {
    background: #0056b3;
}
.ee-add-to-cart-drawer-checkout i {
    margin-right: 0.35rem;
}
@media (max-width: 480px) {
    .ee-add-to-cart-drawer {
        max-width: none;
    }
}
