/**
 * ========================================================================
 * INDUSLEARN - RESPONSIVE MOBILE STYLES
 * Styles pour une expérience mobile optimale
 * ========================================================================
 */

/* ==================== MOBILE NAV TOGGLE ==================== */
.mobile-nav-toggle {
    display: none;
    background: linear-gradient(135deg, #FF8C00 0%, #FFD700 100%);
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    font-size: 1.5rem;
    z-index: 1001;
    transition: all 0.3s ease;
}

.mobile-nav-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.4);
}

.mobile-nav-toggle .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: white;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-nav-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-nav-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ==================== TABLET STYLES (max-width: 1024px) ==================== */
@media (max-width: 1024px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Header */
    .header-content {
        flex-wrap: wrap;
        gap: 1rem;
        min-height: 90px;
    }
    
    .logo-section {
        gap: 1rem;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .logo {
        height: 50px;
    }
    
    .logo-right-absolute {
        height: 55px;
        right: 15px;
    }
    
    .site-branding {
        text-align: center;
    }
    
    .site-title {
        font-size: 1.5rem;
    }
    
    /* Navigation */
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    /* Hero */
    .hero {
        height: 450px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    /* Sections Grid */
    .sections-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Content Layout */
    .content-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        order: -1;
    }
}

/* ==================== MOBILE STYLES (max-width: 768px) ==================== */
@media (max-width: 768px) {
    /* Show mobile nav toggle */
    .mobile-nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    /* Header */
    .header {
        padding: 0.5rem 0;
    }
    
    .header-top {
        padding: 0.75rem 0;
    }
    
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    
    .logo-section {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .logo {
        height: 40px;
    }
    
    .logo-left {
        flex-shrink: 0;
    }
    
    .site-branding {
        text-align: center;
    }
    
    .logo-right-absolute {
        height: 45px;
        right: 60px;
    }
    
    .site-title {
        font-size: 1.1rem;
    }
    
    .site-tagline {
        font-size: 0.65rem;
        display: block;
    }
    
    .auth-links,
    .user-menu {
        display: none; /* Will show in mobile menu */
    }
    
    /* Mobile Navigation */
    .navbar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding-top: 80px;
        box-shadow: 5px 0 30px rgba(0, 0, 0, 0.3);
    }
    
    .navbar.active {
        left: 0;
    }
    
    .navbar .container {
        padding: 0;
    }
    
    .nav-menu {
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .nav-item {
        width: 100%;
    }
    
    .nav-link {
        width: 100%;
        justify-content: flex-start;
        padding: 1rem 1.25rem;
        border-radius: 10px;
        color: white;
        font-size: 1rem;
        background: rgba(255, 255, 255, 0.05);
        border-left: 3px solid transparent;
    }
    
    .nav-link:hover,
    .nav-link.active {
        background: rgba(255, 140, 0, 0.2);
        border-left-color: #FF8C00;
        transform: none;
    }
    
    .nav-icon {
        margin-right: 12px;
        font-size: 1.1rem;
        color: #FF8C00;
    }
    
    /* Mobile Menu Overlay */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .mobile-overlay.active {
        display: block;
        opacity: 1;
    }
    
    /* Hero Section */
    .hero {
        height: auto;
        min-height: 350px;
        padding: 3rem 1rem;
    }
    
    .hero-content {
        padding: 1.5rem;
    }
    
    .hero-title {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-button {
        padding: 1rem 2rem;
        font-size: 1rem;
    }
    
    /* Search Section */
    .search-section {
        padding: 1.5rem 0;
    }
    
    .search-bar {
        flex-direction: column;
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .search-input {
        width: 100%;
        padding: 1rem;
    }
    
    .search-button {
        width: 100%;
        justify-content: center;
        padding: 1rem;
    }
    
    /* Sections Grid */
    .sections-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .section-card {
        padding: 1.5rem;
    }
    
    .section-icon {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    /* Quick Access Menu Cards */
    .quick-menu-section {
        padding: 1rem !important;
        margin-top: 20px !important;
        margin-bottom: 20px !important;
    }
    
    .quick-menu-section .menu-header h2 {
        font-size: 1.5rem !important;
    }
    
    .quick-menu-section .menu-header p {
        font-size: 0.9rem !important;
    }
    
    .quick-menu-section > div:last-child {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .menu-card {
        padding: 20px 18px !important;
    }
    
    .menu-card h3 {
        font-size: 1.2rem !important;
    }
    
    .menu-card p {
        font-size: 0.85rem !important;
    }
    
    .menu-card i:first-child {
        font-size: 2.2rem !important;
    }
    
    /* ==================== CONTENT LAYOUT - SIDEBAR & CATEGORIES ==================== */
    .content-layout {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .content-page {
        padding: 1rem 0;
    }
    
    .content-page .container {
        padding: 0 0.75rem;
    }
    
    /* Sidebar as collapsible on mobile */
    .sidebar {
        position: relative;
        top: 0;
        order: -1;
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        border-radius: 16px;
        padding: 0;
        margin-bottom: 1rem;
        overflow: hidden;
    }
    
    .sidebar-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: linear-gradient(135deg, #FF8C00 0%, #e67e00 100%);
        color: white;
        margin: 0;
        padding: 1rem 1.25rem;
        font-size: 1.1rem;
        cursor: pointer;
        user-select: none;
    }
    
    .sidebar-title::after {
        content: '\f078';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        font-size: 0.85rem;
        transition: transform 0.3s ease;
    }
    
    .sidebar.collapsed .sidebar-title::after {
        transform: rotate(-90deg);
    }
    
    .category-list {
        background: #1e293b;
        max-height: 300px;
        overflow-y: auto;
        transition: max-height 0.3s ease, padding 0.3s ease;
        padding: 0.5rem;
    }
    
    .sidebar.collapsed .category-list {
        max-height: 0;
        padding: 0 0.5rem;
        overflow: hidden;
    }
    
    .category-item {
        margin-bottom: 0.25rem;
    }
    
    .category-link {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.875rem 1rem;
        color: #e2e8f0;
        font-weight: 500;
        font-size: 0.95rem;
        border-radius: 10px;
        transition: all 0.2s ease;
        background: rgba(255, 255, 255, 0.05);
        border-left: 3px solid transparent;
        min-height: 48px;
    }
    
    .category-link i {
        color: #FF8C00;
        width: 20px;
        text-align: center;
    }
    
    .category-link:hover {
        background: rgba(255, 140, 0, 0.15);
        color: #FF8C00;
        border-left-color: #FF8C00;
    }
    
    .category-link.active {
        background: linear-gradient(135deg, #FF8C00 0%, #e67e00 100%);
        color: white;
        border-left-color: transparent;
    }
    
    .category-link.active i {
        color: white;
    }
    
    /* Subcategories on mobile */
    .category-list .category-list {
        margin-left: 0.5rem !important;
        margin-top: 0.25rem !important;
        padding: 0;
        background: transparent;
    }
    
    .category-list .category-list .category-link {
        padding: 0.75rem 1rem 0.75rem 1.5rem;
        font-size: 0.9rem;
        background: rgba(255, 255, 255, 0.03);
    }
    
    /* Main Content on mobile */
    .main-content {
        padding: 1rem;
        border-radius: 16px;
    }
    
    /* Files Grid */
    .modern-files-grid,
    .files-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .file-card,
    .modern-file-card {
        margin-bottom: 0;
        border-radius: 12px;
    }
    
    /* Modern File Card Mobile Optimizations */
    .modern-file-card {
        display: flex;
        flex-direction: column;
    }
    
    .pdf-preview-container {
        height: 140px;
        border-radius: 12px 12px 0 0;
    }
    
    .file-card-header {
        padding: 0.75rem 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .file-type-badge {
        padding: 0.25rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .file-stats-mini {
        font-size: 0.8rem;
        gap: 0.75rem;
    }
    
    .file-card-body {
        padding: 0.75rem 1rem;
    }
    
    .modern-file-title {
        font-size: 1rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }
    
    .file-category-tag {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .file-metadata {
        font-size: 0.8rem;
    }
    
    .file-card-actions {
        padding: 0.75rem 1rem;
        display: flex;
        gap: 0.5rem;
    }
    
    .modern-btn {
        flex: 1;
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
        justify-content: center;
        min-height: 44px;
        border-radius: 8px;
    }
    
    .modern-btn span {
        display: inline;
    }
    
    .modern-btn i {
        margin-right: 0.5rem;
    }
    
    /* Cards */
    .tool-card,
    .method-card,
    .feature-card {
        padding: 1.25rem;
    }
    
    /* Page Headers */
    .page-header,
    .section-header {
        padding: 1.5rem 1rem;
        text-align: center;
    }
    
    .page-header h1,
    .page-title,
    .section-header h1 {
        font-size: 1.4rem;
        margin-bottom: 0.75rem;
    }
    
    .breadcrumb {
        font-size: 0.85rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .breadcrumb-note {
        font-size: 0.85rem;
        margin-top: 0.5rem;
    }
    
    /* Footer */
    .footer {
        padding: 2rem 0 1.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-section {
        padding: 1rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .footer-section:last-child {
        border-bottom: none;
    }
    
    .social-links {
        justify-content: center;
    }
    
    /* Buttons */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Modals */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 0.5rem;
        border-radius: 12px;
    }
    
    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
        top: 10px;
        right: 10px;
    }
    
    .pdf-viewer {
        height: 75vh;
    }
    
    /* Chatbot */
    .chatbot-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-toggle {
        width: 55px;
        height: 55px;
    }
    
    .chatbot-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        right: 15px;
        bottom: 85px;
        max-width: none;
        border-radius: 16px;
    }
    
    /* Decision Tools */
    .matrix-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }
    
    .matrix-table {
        font-size: 0.8rem;
    }
    
    .matrix-table th,
    .matrix-table td {
        padding: 0.5rem;
        min-width: 60px;
    }
    
    /* Analytics Charts */
    .chart-container {
        height: 250px;
    }
    
    /* Outils Industriels Grid */
    .tools-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .tool-card {
        padding: 1rem !important;
    }
    
    /* Empty State */
    .empty-state {
        padding: 2rem 1rem;
    }
    
    .empty-icon i {
        font-size: 3rem;
    }
    
    .empty-title {
        font-size: 1.2rem;
    }
    
    /* Ad containers */
    .ad-container {
        margin-top: 1rem;
        padding: 1rem;
        text-align: center;
    }
}

/* ==================== SMALL MOBILE (max-width: 480px) ==================== */
@media (max-width: 480px) {
    body {
        font-size: 0.9rem;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
    
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Header */
    .logo {
        height: 32px;
    }
    
    .logo-left {
        height: 30px;
    }
    
    .logo-section {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .logo-right-absolute {
        height: 35px;
        right: 50px;
    }
    
    .site-branding {
        min-width: 0;
    }
    
    .site-title {
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .site-tagline {
        font-size: 0.55rem;
    }
    
    .mobile-nav-toggle {
        padding: 8px 10px;
    }
    
    .mobile-nav-toggle .bar {
        width: 20px;
        height: 2px;
        margin: 3px auto;
    }
    
    /* Hero */
    .hero {
        min-height: 280px;
        padding: 2rem 0.75rem;
    }
    
    .hero-title {
        font-size: 1.35rem;
    }
    
    .hero-subtitle {
        font-size: 0.85rem;
    }
    
    .hero-button {
        padding: 0.75rem 1.25rem;
        font-size: 0.85rem;
    }
    
    /* Page Header */
    .page-header {
        padding: 1rem 0.75rem;
    }
    
    .page-title {
        font-size: 1.2rem !important;
    }
    
    .page-title i {
        font-size: 1.1rem;
    }
    
    .breadcrumb {
        font-size: 0.75rem;
    }
    
    /* Sidebar */
    .sidebar-title {
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }
    
    .category-link {
        padding: 0.75rem 0.875rem;
        font-size: 0.875rem;
        min-height: 44px;
    }
    
    /* Cards */
    .section-card {
        padding: 1rem;
    }
    
    .section-icon {
        font-size: 1.75rem;
    }
    
    .section-title {
        font-size: 1rem;
    }
    
    .section-description {
        font-size: 0.8rem;
    }
    
    /* File Cards */
    .pdf-preview-container {
        height: 120px;
    }
    
    .modern-file-title {
        font-size: 0.9rem;
    }
    
    .file-card-body {
        padding: 0.625rem 0.875rem;
    }
    
    .file-card-actions {
        padding: 0.625rem 0.875rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modern-btn {
        padding: 0.625rem 0.5rem;
        font-size: 0.8rem;
        width: 100%;
    }
    
    /* Main Content */
    .main-content {
        padding: 0.75rem;
        border-radius: 12px;
    }
    
    /* Menu Cards */
    .menu-card {
        padding: 15px 12px !important;
    }
    
    .menu-card h3 {
        font-size: 1.05rem !important;
    }
    
    .menu-card p {
        font-size: 0.8rem !important;
        line-height: 1.4 !important;
    }
    
    .menu-card i:first-child {
        font-size: 1.8rem !important;
    }
    
    /* Navigation items */
    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
    }
    
    /* Footer */
    .footer-section h3 {
        font-size: 1rem;
    }
    
    .footer-section p,
    .footer-section a {
        font-size: 0.85rem;
    }
    
    .footer-links li {
        margin-bottom: 0.5rem;
    }
    
    .footer-bottom p {
        font-size: 0.75rem;
    }
    
    /* Search */
    .search-input {
        padding: 0.875rem;
        font-size: 0.9rem;
    }
    
    .search-button {
        padding: 0.875rem;
        font-size: 0.9rem;
    }
    
    /* Empty state */
    .empty-icon i {
        font-size: 2.5rem;
    }
    
    .empty-title {
        font-size: 1.1rem;
    }
    
    /* Chatbot */
    .chatbot-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 90px);
        right: 10px;
        bottom: 75px;
    }
    
    .chatbot-header {
        padding: 0.75rem;
    }
    
    .chatbot-messages {
        padding: 0.75rem;
    }
    
    .chatbot-input-container {
        padding: 0.75rem;
    }
    
    /* Modal */
    .modal-content {
        width: 98%;
        margin: 0.25rem;
        border-radius: 10px;
    }
    
    .pdf-viewer {
        height: 80vh;
    }
}

/* ==================== LANDSCAPE MOBILE ==================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 280px;
        padding: 2rem 1rem;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .navbar {
        padding-top: 60px;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
    }
}

/* ==================== TOUCH DEVICE OPTIMIZATIONS ==================== */
@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets */
    .nav-link,
    .btn,
    .modern-btn {
        min-height: 44px;
    }
    
    /* Remove hover effects that don't work well on touch */
    .modern-file-card:hover {
        transform: none;
    }
    
    .section-card:hover {
        transform: none;
    }
    
    /* Keep active states for feedback */
    .nav-link:active {
        background: rgba(255, 140, 0, 0.3);
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    .modern-file-card:active {
        box-shadow: 0 8px 20px rgba(255, 140, 0, 0.2);
    }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .header,
    .navbar,
    .footer,
    .chatbot-widget,
    .mobile-nav-toggle,
    .mobile-overlay {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
}

/* ==================== EXTRA SMALL MOBILE (max-width: 360px) ==================== */
@media (max-width: 360px) {
    .logo-left {
        height: 28px;
    }
    
    .logo-right-absolute {
        height: 32px;
        right: 45px;
    }
    
    .site-title {
        font-size: 0.75rem;
    }
    
    .site-tagline {
        font-size: 0.5rem;
    }
    
    .logo-section {
        gap: 0.25rem;
    }
}

/* ==================== HIGH CONTRAST MODE ==================== */
@media (prefers-contrast: high) {
    :root {
        --orange: #E67300;
        --gray-600: #333;
    }
    
    .nav-link {
        border: 2px solid transparent;
    }
    
    .nav-link:focus {
        border-color: var(--orange);
        outline: none;
    }
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}
