/* Base Styles */
:root {
    --primary: #E43B3B;
    --primary-dark: #C53030;
    --secondary: #F4C550;
    --accent: #3BA16D;
    --text: #2D3748;
    --text-light: #718096;
    --bg: #FFFFFF;
    --bg-secondary: #F7FAFC;
    --border: #E2E8F0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --text: #FFFFFF;
    --text-light: #CBD5E0;
    --bg: #1A202C;
    --bg-secondary: #2D3748;
    --border: #4A5568;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    background-color: var(--bg);
    box-shadow: var(--shadow);
    z-index: 100;
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    text-decoration: none;
}

.logo img {
    width: 32px;
    height: 32px;
}

.search-bar {
    display: flex;
    flex: 1;
    max-width: 400px;
}

.search-bar input {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem 0 0 0.25rem;
    outline: none;
}

.search-bar button {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0 0.25rem 0.25rem 0;
    cursor: pointer;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a:hover {
    color: var(--primary);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    cursor: pointer;
}

/* Hero Section */
.hero {
    padding: 4rem 0;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg) 100%);
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero-title {
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero-title span {
    color: var(--primary);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.hero-search {
    display: flex;
    gap: 0.5rem;
}

.hero-search input {
    flex: 1;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    outline: none;
}

.hero-image img {
    width: 100%;
    max-width: 400px;
}

/* Features */
.features {
    padding: 4rem 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    text-align: center;
    padding: 2rem;
    background: var(--bg);
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem;
}

/* Documents */
.documents {
    padding: 4rem 0;
    background: var(--bg-secondary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.document-card {
    background: var(--bg);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.document-card:hover {
    transform: translateY(-5px);
}

.document-thumbnail {
    position: relative;
    height: 120px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.document-content {
    padding: 1rem;
}

.document-content h3 {
    margin-bottom: 0.5rem;
}

.document-author {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.document-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg-tertiary);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    padding: 3rem 0;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.footer-col h3,
.footer-col h4 {
    margin-bottom: 1rem;
}

.footer-col a {
    display: block;
    color: var(--text-light);
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.footer-col a:hover {
    color: var(--primary);
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    padding: 1rem;
}

.auth-card {
    background: var(--bg);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
}

.auth-links {
    text-align: center;
    margin: 1.5rem 0;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
}

.auth-social {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.social-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-google {
    background: #DB4437;
    color: white;
}

.btn-facebook {
    background: #4267B2;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .nav-links {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-search {
        flex-direction: column;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

/* Pages d'authentification */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: var(--bg-secondary);
}

.auth-card {
    background: var(--bg);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

/* Page de document */
.document-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    padding: 2rem 0;
}

@media (max-width: 768px) {
    .document-container {
        grid-template-columns: 1fr;
    
}

/* Zone de dépôt pour l'upload */
.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: 0.5rem;
    padding: 3rem;
    text-align: center;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.upload-dropzone:hover {
    border-color: var(--primary);
}
/* Responsive Mobile First */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 1rem;
    }

    .hero-title {
        font-size: 2rem !important;
    }

    .documents-grid {
        grid-template-columns: 1fr !important;
    }

    /* Touch-friendly buttons */
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
    }

    /* Mobile navigation */
    .mobile-menu {
        display: block !important;
    }

    .desktop-menu {
        display: none !important;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .documents-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
    /* Responsive Mobile First */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 1rem;
    }

    .hero-title {
        font-size: 2rem !important;
    }

    .documents-grid {
        grid-template-columns: 1fr !important;
    }

    /* Touch-friendly buttons */
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
    }

    /* Mobile navigation */
    .mobile-menu {
        display: block !important;
    }

    .desktop-menu {
        display: none !important;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .documents-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
        }
    /* ==================== */
/* RESPONSIVE MOBILE */
/* ==================== */

/* 📱 Smartphones (portrait) */
@media (max-width: 480px) {
    /* Container principal */
    .container {
        padding: 0 15px;
        margin: 0 auto;
    }
    
    /* Navbar mobile */
    .navbar {
        flex-direction: column;
        padding: 10px;
        gap: 15px;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .nav-links a {
        padding: 12px;
        text-align: center;
        border-radius: 8px;
        background: var(--bg-secondary);
    }
    
    /* Hero section */
    .hero {
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 2rem !important;
        line-height: 1.2;
        text-align: center;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        text-align: center;
    }
    
    /* Search bar mobile */
    .search-bar {
        width: 100%;
        flex-direction: column;
    }
    
    .search-bar input {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Documents grid */
    .documents-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .document-card {
        margin-bottom: 1rem;
    }
    
    /* Buttons touch-friendly */
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
        font-size: 16px;
    }
    
    /* Forms mobile */
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* Évite le zoom automatique sur iOS */
        padding: 12px;
    }
}

/* 📱 Smartphones (paysage) */
@media (min-width: 481px) and (max-width: 767px) {
    .documents-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .navbar {
        flex-wrap: wrap;
    }
}

/* 📱 Tablettes */
@media (min-width: 768px) and (max-width: 1024px) {
    .documents-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .container {
        max-width: 95%;
    }
}

/* ==================== */
/* AMÉLIORATIONS MOBILE */
/* ==================== */

/* Éviter le zoom sur les inputs */
@media screen and (max-width: 767px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Touch targets minimum 44px */
.touch-button {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Scroll mobile smooth */
html {
    -webkit-overflow-scrolling: touch;
}

/* Optimisation de la performance mobile */
@media (max-width: 767px) {
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Réduire les animations sur mobile */
    .document-card {
        transform: none !important;
    }
}

/* ==================== */
/* MENU MOBILE */
/* ==================== */

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    cursor: pointer;
}

.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    height: 100vh;
    background: var(--bg);
    z-index: 1000;
    padding: 2rem;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.mobile-nav.active {
    left: 0;
}

.mobile-nav a {
    display: block;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
}

/* Afficher le menu mobile seulement sur petit écran */
@media (max-width: 768px) {
    .desktop-menu {
        display: none !important;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .mobile-nav {
        display: block;
    }
}

/* ==================== */
/* ORIENTATION PAYSAGE */
/* ==================== */

@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 1rem 0;
        min-height: auto;
    }
    
    .navbar {
        padding: 5px 0;
    }
}

/* ==================== */
/* ANDROID SPECIFIQUE */
/* ==================== */

/* Correction pour Chrome Android */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    input[type="range"] {
        overflow: hidden;
    }
}

/* Éviter le zoom sur les selects */
select {
    font-size: 16px;
}

/* ==================== */
/* ACCESSIBILITÉ MOBILE */
/* ==================== */

/* Agrandir les zones cliquables */
@media (max-width: 767px) {
    a, button {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Espacement pour les pouces */
    .thumb-friendly {
        padding: 15px 0;
        margin: 10px 0;
    }
}

/* ==================== */
/* MESSAGE MOBILE SPECIFIQUE */
/* ==================== */

.mobile-only {
    display: none;
}

@media (max-width: 767px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    /* Message pour rotation */
    .rotate-message {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: var(--primary);
        color: white;
        text-align: center;
        padding: 10px;
        z-index: 2000;
    }
    
    @media (max-height: 400px) and (orientation: landscape) {
        .rotate-message {
            display: block;
        }
    }
}
