/* =============================================
   RESPONSIVE DESIGN - VERSION AMÉLIORÉE
   Mobile First Approach avec optimisations modernes
============================================= */

/* =============================================
   VARIABLES RESPONSIVE
============================================= */
:root {
    --container-padding: 1rem;
    --section-padding-mobile: 3rem 0;
    --section-padding-tablet: 4rem 0;
    --section-padding-desktop: 5rem 0;
    --section-padding-large: 6rem 0;
}

/* =============================================
   BASE MOBILE STYLES (320px+)
============================================= */
@media (min-width: 320px) {
    .container {
        padding-left: var(--container-padding);
        padding-right: var(--container-padding);
    }
    
    .section-padding {
        padding: var(--section-padding-mobile);
    }
}

/* =============================================
   ULTRA LARGE SCREENS (1400px+) - 4K Support
============================================= */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-title {
        font-size: 4.5rem;
        line-height: 1.1;
    }
    
    .hero-name-highlight {
        font-size: 4.5rem;
        line-height: 1.1;
    }
    
    .hero-subtitle {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 3.5rem;
    }
    
    .section-padding {
        padding: var(--section-padding-large);
    }
    
    .project-card:hover {
        transform: translateY(-20px) scale(1.03);
    }
    
    .skill-card,
    .certificate-card {
        padding: 2.5rem;
    }
    
    .social-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
}

/* =============================================
   EXTRA LARGE SCREENS (1200px to 1399px)
============================================= */
@media (min-width: 1200px) and (max-width: 1399px) {
    .container {
        max-width: 1140px;
    }
    
    .hero-title {
        font-size: 4rem;
    }
    
    .hero-name-highlight {
        font-size: 4rem;
    }
    
    .hero-subtitle {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 3rem;
    }
    
    .section-padding {
        padding: var(--section-padding-desktop);
    }
    
    .project-card:hover {
        transform: translateY(-15px) scale(1.02);
    }
}

/* =============================================
   LARGE SCREENS (992px to 1199px) - Desktop
============================================= */
@media (min-width: 992px) and (max-width: 1199px) {
    .hero-title {
        font-size: 3.5rem;
    }
    
    .hero-name-highlight {
        font-size: 3.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.6rem;
    }
    
    .hero-description {
        font-size: 1.1rem;
        max-width: 600px;
        margin: 0 auto 2rem;
    }
    
    .project-card {
        margin-bottom: 2rem;
    }
    
    .project-card:hover {
        transform: translateY(-12px) scale(1.01);
    }
    
    .skill-card,
    .certificate-card {
        padding: 2rem;
    }
    
    .section-padding {
        padding: var(--section-padding-desktop);
    }
}

/* =============================================
   MEDIUM SCREENS (768px to 991px) - Tablets
============================================= */
@media (min-width: 768px) and (max-width: 991px) {
    /* Navbar Tablet */
    .navbar-custom {
        padding: 0.75rem 0;
        backdrop-filter: blur(15px);
    }
    
    .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
        padding: 2rem 1.5rem;
        border-radius: 0 0 20px 20px;
        margin-top: 0;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    body.dark-theme .navbar-collapse {
        background: rgba(15, 23, 42, 0.98);
        border-color: rgba(51, 65, 85, 0.5);
    }
    
    .nav-link {
        padding: 0.875rem 1.25rem !important;
        margin: 0.25rem 0;
        display: block;
        border-radius: 12px;
        transition: all 0.3s ease;
    }
    
    .nav-link:hover {
        transform: translateX(5px);
    }
    
    .theme-toggle {
        margin-top: 1.5rem;
    }
    
    /* Hero Section Tablet */
    .hero-title {
        font-size: 3rem;
        line-height: 1.2;
    }
    
    .hero-name-highlight {
        font-size: 3rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1.4rem;
    }
    
    .hero-description {
        font-size: 1rem;
        max-width: 500px;
        margin: 0 auto 2rem;
        line-height: 1.7;
    }
    
    .hero-buttons .btn {
        margin: 0.75rem 0.5rem;
        padding: 0.75rem 2rem;
        font-size: 1rem;
    }
    
    /* About Section Tablet */
    .about-image {
        margin-bottom: 3rem;
    }
    
    .info-item {
        padding: 1.25rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }
    
    /* Skills Grid Tablet */
    .skill-card {
        margin-bottom: 2rem;
        padding: 1.75rem;
        border-radius: 16px;
    }
    
    .skill-icon {
        width: 65px;
        height: 65px;
        font-size: 1.6rem;
    }
    
    /* Timeline Tablet */
    .timeline {
        padding-left: 35px;
    }
    
    .timeline-item::before {
        width: 14px;
        height: 14px;
        left: -32px;
    }
    
    /* Projects Tablet */
    .project-filters {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .filter-btn {
        margin: 0.25rem;
        padding: 0.625rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .project-card:hover {
        transform: translateY(-8px) scale(1.01);
    }
    
    .section-padding {
        padding: var(--section-padding-tablet);
    }
    
    /* Contact Section Tablet */
    .contact-info-cards {
        margin-bottom: 2rem;
    }
}

/* =============================================
   SMALL SCREENS (576px to 767px) - Large Phones
============================================= */
@media (min-width: 576px) and (max-width: 767px) {
    .section-padding {
        padding: 4rem 0;
    }
    
    .section-title {
        font-size: 2.25rem;
        margin-bottom: 1.5rem;
    }
    
    /* Hero Section Large Phone */
    .hero-section {
        padding-top: 80px;
        min-height: 100vh;
    }
    
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.25;
        margin-bottom: 1rem;
    }
    
    .hero-name-highlight {
        font-size: 2.5rem;
        line-height: 1.25;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
        margin-bottom: 1.25rem;
    }
    
    .hero-description {
        font-size: 1rem;
        padding: 0 1.5rem;
        line-height: 1.6;
        margin-bottom: 2rem;
    }
    
    .hero-buttons .btn {
        display: block;
        width: 85%;
        margin: 0.75rem auto;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        border-radius: 12px;
    }
    
    .btn-professional,
    .btn-outline-professional {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
    
    .hero-social {
        margin-top: 2.5rem;
    }
    
    .social-icon {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
        margin: 0 0.375rem;
    }
    
    /* About Section Large Phone */
    .info-item {
        margin-bottom: 1.25rem;
        padding: 1rem;
        border-radius: 10px;
    }
    
    .progress {
        height: 8px;
        border-radius: 4px;
    }
    
    /* Skills Cards Large Phone */
    .skill-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
        border-radius: 14px;
    }
    
    .skill-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    /* Timeline Large Phone */
    .timeline {
        padding-left: 28px;
    }
    
    .timeline-item {
        margin-bottom: 1.75rem;
    }
    
    .timeline-item::before {
        left: -28px;
        width: 12px;
        height: 12px;
    }
    
    /* Certificates Large Phone */
    .certificate-card {
        margin-bottom: 1.75rem;
        padding: 1.75rem;
        border-radius: 14px;
    }
    
    .certificate-icon {
        width: 75px;
        height: 75px;
        font-size: 1.8rem;
    }
    
    /* Projects Large Phone */
    .project-image {
        height: 220px;
        border-radius: 12px 12px 0 0;
    }
    
    .project-content {
        padding: 1.5rem;
    }
    
    .project-content h4 {
        font-size: 1.15rem;
        margin-bottom: 0.75rem;
    }
    
    .project-card:hover {
        transform: translateY(-6px) scale(1.01);
    }
    
    /* Contact Large Phone */
    .contact-form-modern {
        padding: 2rem 1.5rem;
        border-radius: 16px;
    }
    
    .contact-info-card {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* Footer Large Phone */
    .footer {
        padding: 2.5rem 0;
        margin-top: 4rem;
    }
    
    /* Back to Top Large Phone */
    .back-to-top {
        width: 48px;
        height: 48px;
        bottom: 24px;
        right: 24px;
        font-size: 1.1rem;
    }
}

/* =============================================
   EXTRA SMALL SCREENS (480px and below) - Standard Phones
============================================= */
@media (max-width: 480px) {
    body {
        font-size: 0.95rem;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .section-padding {
        padding: 3.5rem 0;
    }
    
    .section-title {
        font-size: 1.9rem;
        margin-bottom: 1.25rem;
    }
    
    .title-divider {
        width: 50px;
        height: 3px;
    }
    
    /* Navbar Mobile */
    .navbar-brand {
        font-size: 1.3rem;
    }
    
    .brand-text {
        font-size: 1.5rem;
    }
    
    /* Hero Section Mobile */
    .hero-section {
        min-height: 100vh;
        padding: 80px 0 40px;
    }
    
    .hero-badge {
        padding: 0.5rem 1.25rem;
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
        border-radius: 25px;
    }
    
    .hero-title {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .hero-name-highlight {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .hero-description {
        font-size: 0.9rem;
        line-height: 1.6;
        padding: 0 0.5rem;
    }
    
    .hero-buttons {
        margin-top: 1.5rem;
    }
    
    .hero-buttons .btn {
        font-size: 0.9rem;
        padding: 0.7rem 1.25rem;
        width: 90%;
        margin: 0.5rem auto;
        border-radius: 10px;
    }
    
    .scroll-indicator {
        bottom: 20px;
    }
    
    /* About Section Mobile */
    .about-content h3 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }
    
    .info-item {
        padding: 12px;
        flex-direction: column;
        text-align: center;
        border-radius: 10px;
    }
    
    .info-item i {
        margin-right: 0;
        margin-bottom: 0.5rem;
        font-size: 1.3rem;
    }
    
    .skill-item {
        margin-bottom: 1.25rem;
    }
    
    .progress {
        height: 6px;
    }
    
    /* Skills Section Mobile */
    .skill-card {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
        border-radius: 12px;
    }
    
    .skill-card h4 {
        font-size: 1rem;
    }
    
    .skill-list li {
        font-size: 0.85rem;
        padding: 0.3rem 0;
    }
    
    /* CV Section Mobile */
    .cv-section-title {
        font-size: 1.2rem;
    }
    
    .timeline {
        padding-left: 20px;
    }
    
    .timeline::before {
        left: 10px;
    }
    
    .timeline-item::before {
        left: -22px;
        width: 10px;
        height: 10px;
    }
    
    .timeline-date {
        font-size: 0.85rem;
    }
    
    .timeline-content h5 {
        font-size: 1rem;
    }
    
    .timeline-content p {
        font-size: 0.85rem;
    }
    
    /* Certificates Section Mobile */
    .certificate-icon {
        width: 70px;
        height: 70px;
        font-size: 1.6rem;
    }
    
    .certificate-card h4 {
        font-size: 1rem;
    }
    
    .certificate-card p {
        font-size: 0.85rem;
    }
    
    .certificate-card .btn {
        font-size: 0.85rem;
        padding: 0.4rem 1rem;
    }
    
    /* Projects Section Mobile */
    .project-filters {
        margin-bottom: 2rem;
    }
    
    .filter-btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
        margin: 0.2rem;
        border-radius: 20px;
    }
    
    .project-card {
        margin-bottom: 1.5rem;
        border-radius: 12px;
    }
    
    .project-image {
        height: 180px;
    }
    
    .project-content {
        padding: 1rem;
    }
    
    .project-content h4 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .project-content p {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
    
    .tag {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
        border-radius: 12px;
    }
    
    /* Contact Section Mobile */
    .contact-info-card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .contact-icon-wrapper {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .contact-info-card h4 {
        font-size: 1rem;
    }
    
    .contact-info-card p {
        font-size: 0.85rem;
    }
    
    .contact-form-modern {
        padding: 1.5rem;
        border-radius: 15px;
    }
    
    .form-label-modern {
        font-size: 0.85rem;
    }
    
    .form-control-modern {
        padding: 0.75rem 0.75rem 0.75rem 2.5rem;
        font-size: 0.9rem;
        border-radius: 8px;
    }
    
    .form-icon-modern {
        font-size: 0.9rem;
        left: 0.75rem;
    }
    
    .btn-contact-modern {
        font-size: 0.95rem;
        padding: 0.75rem 1.5rem;
        border-radius: 25px;
    }
    
    /* Footer Mobile */
    .footer {
        padding: 2rem 0;
        margin-top: 3rem;
    }
    
    .footer-social a {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .footer p {
        font-size: 0.85rem;
        margin-top: 1rem;
    }
    
    /* Modals Mobile */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
    
    .modal-body iframe {
        height: 60vh;
        border-radius: 8px;
    }
    
    /* Buttons Mobile */
    .btn {
        font-size: 0.9rem;
        padding: 0.6rem 1.25rem;
        border-radius: 8px;
    }
    
    .btn-sm {
        font-size: 0.8rem;
        padding: 0.35rem 0.75rem;
    }
    
    /* Back to Top Mobile */
    .back-to-top {
        width: 42px;
        height: 42px;
        font-size: 1rem;
        bottom: 20px;
        right: 20px;
    }
}

/* =============================================
   VERY SMALL SCREENS (360px and below) - Minimal Phones
============================================= */
@media (max-width: 360px) {
    body {
        font-size: 0.85rem;
    }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-name-highlight {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .hero-buttons .btn {
        width: 100%;
        margin: 0.25rem 0;
        padding: 0.65rem 1rem;
        font-size: 0.85rem;
    }
    
    .social-icon {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
        margin: 0 0.25rem;
    }
    
    .back-to-top {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
        bottom: 15px;
        right: 15px;
    }
}

/* =============================================
   LANDSCAPE MODE ADJUSTMENTS
============================================= */
@media (max-height: 600px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 60px 0;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-name-highlight {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-description {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-social {
        margin-top: 1.5rem;
    }
    
    .scroll-indicator {
        display: none;
    }
    
    .section-padding {
        padding: 2.5rem 0;
    }
}

/* =============================================
   TOUCH DEVICE OPTIMIZATIONS
============================================= */
@media (hover: none) and (pointer: coarse) {
    .hover-lift:hover,
    .hover-grow:hover,
    .hover-glow:hover {
        transform: none;
        box-shadow: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .project-card:hover {
        transform: none;
    }
    
    /* Enhanced touch targets */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }
    
    .nav-link {
        min-height: 44px;
        padding: 0.75rem 1rem !important;
    }
    
    .social-icon {
        min-width: 44px;
        min-height: 44px;
    }
    
    .back-to-top {
        min-width: 48px;
        min-height: 48px;
    }
}

/* =============================================
   HIGH DPI DISPLAYS
============================================= */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-name-highlight {
        text-rendering: optimizeLegibility;
    }
    
    .section-title {
        text-rendering: optimizeLegibility;
    }
    
    /* Sharper borders and shadows */
    .skill-card,
    .certificate-card,
    .project-card {
        box-shadow: 
            0 1px 3px rgba(0, 0, 0, 0.12),
            0 1px 2px rgba(0, 0, 0, 0.24);
    }
}

/* =============================================
   PRINT STYLES
============================================= */
@media print {
    .navbar-custom,
    .back-to-top,
    .progress-container,
    .theme-toggle,
    .scroll-indicator,
    .hero-buttons,
    .social-icon,
    .footer-social,
    .project-overlay {
        display: none !important;
    }
    
    .hero-section {
        min-height: auto;
        padding: 2rem 0;
        background: none !important;
        color: black !important;
        page-break-inside: avoid;
    }
    
    .section-padding {
        padding: 1.5rem 0;
    }
    
    * {
        box-shadow: none !important;
        text-shadow: none !important;
        background: white !important;
        color: black !important;
    }
    
    .hero-name-highlight {
        color: #333 !important;
        background: none !important;
        -webkit-text-fill-color: #333 !important;
    }
}

/* =============================================
   ACCESSIBILITY ENHANCEMENTS
============================================= */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
    
    .scroll-indicator {
        animation: none;
    }
}

@media (prefers-contrast: high) {
    .hero-name-highlight {
        color: #000 !important;
        text-shadow: none;
    }
    
    .btn-professional {
        background: #000 !important;
        border-color: #000 !important;
    }
    
    .btn-outline-professional {
        border-color: #000 !important;
        color: #000 !important;
    }
}
