/* ============================================================================
   PRESTATIONS MODAL - RESPONSIVE OPTIMIZATION FOR ALL BROWSERS & DEVICES
   Optimized for MacBook Air/Pro, Windows Laptops & All Screen Sizes
   ============================================================================ */

/* ====================
   CRITICAL FIX: Base Modal Styles with Flexible Sizing
   ==================== */
   
.modal {
    /* Use relative units instead of fixed 1100px */
    width: clamp(320px, 92vw, 1100px) !important;
    max-width: 92vw !important;
    max-height: clamp(500px, 88vh, 900px) !important;
    
    /* Improved centering */
    margin: auto !important;
    
    /* Better overflow handling */
    display: flex !important;
    flex-direction: column !important;
}

.modal-header {
    /* Responsive padding using clamp */
    padding: clamp(20px, 3vh, 45px) clamp(30px, 5vw, 60px) clamp(15px, 2vh, 30px) !important;
    flex-shrink: 0 !important;
}

.modal-title {
    /* Fluid typography */
    font-size: clamp(1.5rem, 3vw + 0.5rem, 2.8rem) !important;
    letter-spacing: clamp(1px, 0.3vw, 4px) !important;
}

.modal-subtitle {
    font-size: clamp(0.85rem, 1.5vw, 1.1rem) !important;
}

.modal-content {
    /* Flexible padding and height */
    padding: clamp(20px, 3vh, 40px) clamp(30px, 4vw, 60px) !important;
    max-height: calc(88vh - clamp(180px, 25vh, 250px)) !important;
    
    /* Smooth scrolling */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
}

/* ====================
   BENEFITS GRID - PERFECT ALIGNMENT FIX
   ==================== */

.benefits-grid {
    display: grid !important;
    /* Responsive grid with minimum size that works on all screens */
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)) !important;
    gap: clamp(12px, 2vw, 24px) !important;
    
    /* Ensure all items have same height */
    grid-auto-rows: 1fr !important;
    align-items: stretch !important;
}

.benefit-card {
    /* Flexbox for perfect vertical alignment */
    display: flex !important;
    flex-direction: column !important;
    
    /* Ensure all cards have same height */
    height: 100% !important;
    min-height: 180px !important;
    
    /* Responsive padding */
    padding: clamp(15px, 2vh, 25px) clamp(12px, 1.5vw, 20px) !important;
    
    /* Better visual structure */
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(215, 232, 210, 0.3) !important;
    border-radius: 16px !important;
    transition: all 0.3s ease !important;
}

.benefit-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 30px rgba(175, 207, 186, 0.25) !important;
    border-color: var(--sage-green) !important;
}

.benefit-icon {
    /* Fixed size prevents shifting */
    width: clamp(2rem, 4vw, 2.5rem) !important;
    height: clamp(2rem, 4vw, 2.5rem) !important;
    font-size: clamp(1.5rem, 3vw, 2.2rem) !important;
    margin-bottom: clamp(8px, 1vh, 15px) !important;
    flex-shrink: 0 !important;
    
    /* Center the icon */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.benefit-title {
    font-size: clamp(0.85rem, 1.2vw, 1.05rem) !important;
    margin-bottom: clamp(6px, 0.8vh, 10px) !important;
    font-weight: 600 !important;
    color: var(--dark-green) !important;
    flex-shrink: 0 !important;
    
    /* Ensure consistent line height */
    line-height: 1.3 !important;
    min-height: 2.6em !important; /* 2 lines minimum */
}

.benefit-description {
    font-size: clamp(0.75rem, 1vw, 0.9rem) !important;
    line-height: 1.5 !important;
    color: var(--text-light) !important;
    
    /* This is the key: flex-grow makes all descriptions fill available space */
    flex-grow: 1 !important;
    
    /* Better text rendering */
    display: flex !important;
    align-items: flex-start !important;
}

/* ====================
   MODAL NAVIGATION
   ==================== */

.modal-navigation {
    padding: clamp(15px, 2vh, 25px) clamp(30px, 4vw, 60px) !important;
    gap: clamp(8px, 1vw, 15px) !important;
    flex-shrink: 0 !important;
    flex-wrap: wrap !important;
}

.nav-btn {
    padding: clamp(10px, 1.2vh, 14px) clamp(20px, 2.5vw, 30px) !important;
    font-size: clamp(0.8rem, 1vw, 0.95rem) !important;
}

.modal-navigation .cta-button {
    padding: clamp(12px, 1.5vh, 16px) clamp(24px, 3vw, 36px) !important;
    font-size: clamp(0.8rem, 1vw, 0.9rem) !important;
}

/* ====================
   CLOSE BUTTON
   ==================== */

.close-button,
.modal-close {
    width: clamp(40px, 5vw, 48px) !important;
    height: clamp(40px, 5vw, 48px) !important;
    font-size: clamp(24px, 3vw, 32px) !important;
}

/* ============================================================================
   SPECIFIC BREAKPOINTS - MacBook & Laptop Optimization
   ============================================================================ */

/* ====================
   MacBook Air 11"/13" & Small Laptops (1024px - 1366px)
   Critical for 1366x768, 1440x900
   ==================== */
@media (min-width: 1024px) and (max-width: 1366px) {
    .modal {
        width: 90vw !important;
        max-width: 90vw !important;
        max-height: 85vh !important;
    }
    
    .modal-content {
        max-height: calc(85vh - 220px) !important;
    }
    
    .benefits-grid {
        /* Force 3 columns on this screen size */
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 16px !important;
    }
    
    .benefit-card {
        min-height: 160px !important;
    }
    
    .step-content,
    .details-content {
        max-height: calc(85vh - 280px) !important;
    }
}

/* ====================
   MacBook Pro 13"/14" & Medium Laptops (1367px - 1512px)
   For 1440x900, 1512x982 (M1/M2)
   ==================== */
@media (min-width: 1367px) and (max-width: 1512px) {
    .modal {
        width: 88vw !important;
        max-width: 1050px !important;
        max-height: 87vh !important;
    }
    
    .benefits-grid {
        /* 4 columns optimal for this size */
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 18px !important;
    }
    
    .benefit-card {
        min-height: 170px !important;
    }
}

/* ====================
   MacBook Pro 15"/16" & Large Laptops (1513px - 1920px)
   For 1680x1050, 1920x1200
   ==================== */
@media (min-width: 1513px) and (max-width: 1920px) {
    .modal {
        width: 85vw !important;
        max-width: 1100px !important;
        max-height: 88vh !important;
    }
    
    .benefits-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
        gap: 22px !important;
    }
    
    .benefit-card {
        min-height: 190px !important;
    }
}

/* ====================
   Large Desktop (1921px+)
   4K and Ultra-wide displays
   ==================== */
@media (min-width: 1921px) {
    .modal {
        width: 1200px !important;
        max-height: 90vh !important;
    }
    
    .benefits-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
        gap: 26px !important;
    }
}

/* ====================
   Tablet Optimization (769px - 1023px)
   iPad Pro, Surface, etc.
   ==================== */
@media (min-width: 769px) and (max-width: 1023px) {
    .modal {
        width: 92vw !important;
        max-height: 88vh !important;
    }
    
    .benefits-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .benefit-card {
        min-height: 150px !important;
    }
}

/* ====================
   Mobile Optimization (≤768px)
   ==================== */
@media (max-width: 768px) {
    .modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    
    .modal-header {
        padding: 20px 20px 15px !important;
    }
    
    .modal-title {
        font-size: 1.5rem !important;
        letter-spacing: 1.5px !important;
    }
    
    .modal-content {
        padding: 20px 20px 30px !important;
    }
    
    .benefits-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    .benefit-card {
        min-height: 140px !important;
        padding: 18px 16px !important;
    }
    
    .modal-navigation {
        padding: 15px 20px 20px !important;
    }
}

/* ============================================================================
   BROWSER-SPECIFIC OPTIMIZATIONS & FALLBACKS
   ============================================================================ */

/* Safari-specific fixes */
@supports (-webkit-backdrop-filter: blur(1px)) {
    .modal-overlay {
        -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
    }
    
    .modal {
        -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
    }
}

/* Firefox-specific fixes */
@-moz-document url-prefix() {
    .benefit-card {
        /* Firefox sometimes needs explicit height */
        min-height: 180px !important;
    }
}

/* Edge/IE fallback (no backdrop-filter support) */
@supports not (backdrop-filter: blur(1px)) {
    .modal-overlay {
        background: rgba(255, 255, 255, 0.95) !important;
    }
    
    .modal {
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 40px 150px rgba(0, 0, 0, 0.4) !important;
    }
}

/* ============================================================================
   ACCESSIBILITY & PERFORMANCE
   ============================================================================ */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .modal,
    .benefit-card,
    .nav-btn {
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .benefit-card {
        border: 2px solid currentColor !important;
    }
}

/* Dark mode support (future-proof) */
@media (prefers-color-scheme: dark) {
    .benefit-card {
        background: rgba(44, 62, 45, 0.1) !important;
        border-color: rgba(175, 207, 186, 0.3) !important;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .modal-overlay {
        position: relative !important;
        background: white !important;
    }
    
    .modal {
        box-shadow: none !important;
        max-height: none !important;
    }
    
    .modal-navigation,
    .close-button {
        display: none !important;
    }
}

/* ============================================================================
   END OF RESPONSIVE OPTIMIZATION
   ============================================================================ */

