/* public/css/responsive.css */
/* ==================== RESPONSIVE BREAKPOINTS ==================== */

/* Extra Small Devices (Phones < 576px) */
@media (max-width: 575.98px) {
    /* Ajustements typographiques */
    html {
        font-size: 14px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    
    /* Hero Section Mobile Optimization */
    .hero-section {
        padding: 6rem 0 4rem;
        background-attachment: scroll !important;
        background-position: center center;
        min-height: auto;
    }
    
    .hero-title {
        font-size: 2.2rem !important;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem !important;
        line-height: 1.5;
        padding: 0;
    }
    
    /* Button Stacking on Mobile */
    .hero-section .btn {
        display: block;
        width: 100%;
        margin-bottom: 1rem;
        padding: 0.75rem 1rem;
    }
    
    .hero-section .btn + .btn {
        margin-left: 0 !important;
    }
    
    /* Navigation Optimization */
    .navbar {
        padding: 0.75rem 0;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .navbar-toggler {
        padding: 0.25rem 0.5rem;
        font-size: 1rem;
    }
    
    .navbar-collapse {
        background: rgba(26, 35, 126, 0.98);
        padding: 1rem;
        border-radius: var(--border-radius-md);
        margin-top: 0.5rem;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        backdrop-filter: blur(10px);
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        margin: 0.25rem 0;
        text-align: center;
        border-radius: var(--border-radius-sm);
        font-size: 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Section Titles */
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 2rem;
    }
    
    /* Cards Optimization */
    .feature-card {
        margin-bottom: 1.5rem;
        border-radius: var(--border-radius-md);
    }
    
    .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* Container padding */
    .container {
        padding: 0 1.5rem;
    }
    
    /* Stats Cards */
    .stats-card {
        margin-bottom: 1rem;
        padding: 1.5rem;
    }
    
    .stats-number {
        font-size: 2rem;
    }
    
    /* Row adjustments */
    .row {
        margin: 0 -0.75rem;
    }
    
    [class*="col-"] {
        padding: 0 0.75rem;
    }
    
    /* Footer Optimization */
    .footer {
        padding: 3rem 0 1.5rem;
        text-align: center;
    }
    
    .footer .col-lg-4, 
    .footer .col-lg-3, 
    .footer .col-md-6 {
        margin-bottom: 2rem;
    }
    
    .footer-links a, 
    .footer-links p {
        margin-bottom: 0.75rem;
    }
    
    /* Call to Action */
    .py-5 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    /* Image optimization */
    img {
        max-width: 100%;
        height: auto;
    }
}

/* Small Devices (Phones ≥ 576px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .stats-card {
        margin-bottom: 1.5rem;
    }
    
    .feature-card {
        margin-bottom: 1.5rem;
    }
    
    .navbar-collapse {
        background: rgba(26, 35, 126, 0.98);
        padding: 1.5rem;
        border-radius: var(--border-radius-md);
        margin-top: 0.75rem;
        backdrop-filter: blur(10px);
    }
    
    .container {
        padding: 0 2rem;
    }
}

/* Medium Devices (Tablets 768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .hero-title {
        font-size: 3rem;
    }
    
    .feature-card {
        margin-bottom: 1.5rem;
    }
    
    .stats-card {
        margin-bottom: 1.5rem;
    }
    
    /* Optimize buttons for touch */
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .container {
        padding: 0 2rem;
    }
}

/* Large Devices (Desktops 992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }
}

/* Extra Large Devices (Large Desktops ≥ 1200px) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* ==================== TOUCH DEVICE OPTIMIZATIONS ==================== */
@media (hover: none) and (pointer: coarse) {
    /* Optimize for touch screens */
    .nav-link, 
    .btn, 
    .card, 
    .stats-card,
    .feature-card {
        min-height: 44px;
        -webkit-tap-highlight-color: transparent;
    }
    
    .nav-link {
        padding: 12px 16px !important;
    }
    
    .btn {
        padding: 12px 20px !important;
    }
    
    /* Reduce hover effects on touch devices */
    .feature-card:hover {
        transform: translateY(-5px);
    }
    
    /* Improve touch feedback */
    .btn:active,
    .nav-link:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Disable hover states on touch */
    @media (hover: hover) {
        .feature-card:hover {
            transform: translateY(-10px);
        }
    }
}

/* ==================== DARK MODE SUPPORT ==================== */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #e0e0e0;
        --light-color: #1a1a1a;
    }
    
    body {
        background-color: #121212;
        color: var(--text-dark);
    }
    
    .feature-card,
    .card {
        background-color: #1e1e1e;
        color: var(--text-dark);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .card-text.text-muted,
    .text-muted {
        color: #b0b0b0 !important;
    }
    
    .bg-light {
        background-color: #1a1a1a !important;
    }
    
    .btn-light {
        background-color: #2d2d2d;
        border-color: #3d3d3d;
        color: var(--text-dark);
    }
    
    .btn-outline-light {
        color: var(--text-dark);
        border-color: var(--text-dark);
    }
    
    .hero-section::before {
        opacity: 0.1;
    }
}

/* ==================== ORIENTATION SPECIFIC STYLES ==================== */
@media (max-width: 767.98px) and (orientation: landscape) {
    .hero-section {
        padding: 4rem 0;
        min-height: auto;
    }
    
    .navbar {
        padding: 0.5rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .stats-card {
        padding: 1rem;
    }
    
    /* Optimize layout for landscape */
    .row {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .row::-webkit-scrollbar {
        display: none;
    }
    
    [class*="col-"] {
        flex: 0 0 auto;
        width: 85%;
    }
}

@media (max-width: 767.98px) and (orientation: portrait) {
    .hero-section {
        min-height: 80vh;
    }
}

/* ==================== HIGH DPI DISPLAYS ==================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-section {
        background-image: linear-gradient(rgba(13, 71, 161, 0.9), rgba(26, 35, 126, 0.95)),
                        url('https://images.unsplash.com/photo-1518834103328-93d45986dce1?ixlib=rb-4.0.3&auto=format&fit=crop&w=4000&q=80&dpr=2');
    }
    
    .feature-icon {
        -webkit-font-smoothing: antialiased;
    }
}

/* ==================== ACCESSIBILITY IMPROVEMENTS ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .feature-card:hover,
    .stats-card:hover {
        transform: none !important;
    }
    
    .fade-in {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ==================== HIGH CONTRAST MODE ==================== */
@media (prefers-contrast: high) {
    .hero-title,
    .section-title,
    .navbar-brand {
        text-shadow: 2px 2px 0 #000;
    }
    
    .btn {
        border-width: 2px;
    }
    
    .section-title::after {
        height: 3px;
    }
}

/* ==================== PERFORMANCE OPTIMIZATIONS ==================== */
/* Disable heavy effects on mobile */
@media (max-width: 767.98px) {
    .hero-section::before {
        background-size: 50px 50px;
    }
    
    .feature-card:hover {
        transform: translateY(-5px) !important;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12) !important;
    }
    
    .stats-card:hover {
        transform: translateY(-3px) !important;
    }
    
    /* Optimize images for mobile */
    img {
        max-width: 100%;
        height: auto;
    }
}

/* ==================== IOS SAFARI SPECIFIC FIXES ==================== */
@supports (-webkit-touch-callout: none) {
    .hero-section {
        background-attachment: scroll;
    }
    
    /* Fix for Safari 100vh issue */
    .hero-section {
        height: -webkit-fill-available;
    }
}

/* ==================== INTERNET EXPLORER FALLBACKS ==================== */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    .hero-section {
        background-attachment: scroll;
    }
    
    .feature-card {
        display: block;
    }
}

/* ==================== FIREFOX SPECIFIC FIXES ==================== */
@-moz-document url-prefix() {
    .navbar.scrolled {
        background: rgba(26, 35, 126, 0.95);
    }
}

/* ==================== UTILITY CLASSES FOR MOBILE ==================== */
.mobile-only {
    display: none !important;
}

.desktop-only {
    display: block !important;
}

@media (max-width: 767.98px) {
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
}

/* ==================== TOUCH-FRIENDLY FORMS ==================== */
@media (max-width: 767.98px) {
    input,
    select,
    textarea,
    button {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }
    
    .form-control {
        padding: 0.75rem;
        min-height: 44px;
    }
}