/* ============================================
   VARIABLES GLOBALES - CK-INFO SAV
   ============================================ */
:root {
    /* Couleurs principales */
    --primary-color: #4A90E2;
    --secondary-color: #3D5A99;
    --accent-color: #5B9BD5;
    --background-color: #cccccc;
    --background-grey: #AAAAAA;
    --text-color: #333333;
    --text-dark: #2C3E50;
    --text-muted: #7f8c8d;
    --white: #FFFFFF;
    --border-color: #DDDDDD;
    --shadow: rgba(0, 0, 0, 0.1);
    
    /* Couleurs d'état */
    --success-color: #27AE60;
    --danger-color: #E74C3C;
    --warning-color: #F39C12;
    
    /* Gradients réutilisables */
    --gradient-primary: linear-gradient(135deg, #4A90E2 0%, #2C3E50 100%);
    --gradient-footer: linear-gradient(135deg, #2C3E50 0%, #2C3E50 100%);
    
    /* Espacements */
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 20px;
    --spacing-lg: 30px;
    --spacing-xl: 50px;
}

/* ============================================
   RESET ET BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    overflow-x: hidden; /* ✅ Empêche tout scroll horizontal */
}

body {
    font-family: Arial, Helvetica, sans-serif;
}


a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* ============================================
   HEADER - NAVBAR PRINCIPAL
   ============================================ */
.main-header {
    background-color: var(--primary-color);
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Logo */
.logo-container {
    flex-shrink: 0;
}

.logo {
    height: 60px;
    width: auto;
    display: block;
}

/* Menu principal */
.nav-menu {
    display: flex;
    gap: 0;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    padding: 20px 25px;
    color: var(--white);
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.nav-link:hover {
    background-color: var(--secondary-color);
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-toggle::after {
    content: ' ▼';
    font-size: 10px;
    margin-left: 5px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--white);
    min-width: 220px;
    box-shadow: 0 4px 10px var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    border-bottom: 1px solid var(--border-color);
}

.dropdown-menu li:last-child {
    border-bottom: none;
}

.dropdown-link {
    display: block;
    padding: 12px 20px;
    color: var(--text-color);
    transition: background-color 0.3s ease;
}

.dropdown-link:hover {
    background-color: var(--background-color);
    color: var(--primary-color);
}

/* Menu burger */
.burger-menu {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
}

.burger-bar {
    width: 25px;
    height: 3px;
    background-color: var(--white);
    transition: all 0.3s ease;
}

/* ============================================
   HEADER TECHNICIEN (pages backend)
   ============================================ */
.tech-header-simple {
    background: var(--gradient-primary);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px var(--shadow);
}

.tech-header-simple .header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.tech-header-simple .back-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    transition: all 0.3s;
}

.tech-header-simple .back-link:hover {
    color: white;
    gap: 12px;
}

.tech-header-simple h1 {
    font-size: 28px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================
   ✅ EN-TÊTE DE PAGE STYLÉ (Global)
   Utilisé sur toutes les pages formulaires
   ============================================ */
.page-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #4A90E2 0%, #5B9BD5 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.2);
    max-width: 100%;
    box-sizing: border-box;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: white;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    word-wrap: break-word;
}

.page-header h1 i {
    font-size: 36px;
    animation: fadeInScale 0.6s ease;
}

.page-header p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    font-weight: 400;
    line-height: 1.5;
    word-wrap: break-word;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */
.main-container,
.main-content,
.form-container {
    max-width: 100%; /* ✅ Reste dans le viewport */
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box; /* ✅ Inclut padding dans la largeur */
    overflow-x: hidden; /* ✅ Empêche le scroll horizontal */
}

.main-container {
    margin: 0 auto;
    min-height: calc(100vh - 200px);
}


.form-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h2 i {
    color: #667eea;
    font-size: 20px;
}

/* Form groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group .required {
    color: var(--danger-color);
    margin-left: 3px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    font-family: inherit;
    max-width: 100%; /* ✅ Reste dans l'écran */
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Form row (2 colonnes) */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-row .form-group.small {
    max-width: 150px;
}

/* ============================================
   BOUTONS GÉNÉRIQUES
   ============================================ */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* Actions de formulaire */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

/* ============================================
   ALERTES
   ============================================ */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--warning-color);
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge-non_receptionner { background-color: #007bff; color: #ffffff; }
.badge-receptionner { background-color: #0dcaf0; color: #ffffff; }
.badge-en_cours_de_traitement { background-color: #fd7e14; color: #212529; }
.badge-finalisation { background-color: #6f42c1; color: #ffffff; }
.badge-terminer { background-color: #28a745; color: #ffffff; }
.badge-archiver { background-color: #dc3545; color: #ffffff; }

/* ============================================
   FOOTER
   ============================================ */
.main-footer {
    background: var(--gradient-footer);
    color: var(--white);
    padding: 30px 20px;
    text-align: center;
    position: relative;
    bottom: 0;
    box-shadow: 0 -4px 10px var(--shadow);
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-content p {
    margin: 10px 0;
    font-size: 14px;
    color: #ecf0f1;
}

.footer-content strong {
    color: #3498db;
    font-weight: 700;
}

.footer-links {
    margin-top: 15px;
}

.footer-links a,
.footer-content a {
    color: #ecf0f1;
    text-decoration: none;
    margin: 0 10px;
    padding: 5px 10px;
    transition: all 0.3s;
    border-radius: 4px;
}

.footer-links a:hover,
.footer-content a:hover {
    color: #3498db;
    background-color: rgba(52, 152, 219, 0.1);
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 768px) {
    /* Navbar */
    .navbar {
        flex-wrap: wrap;
    }

    .burger-menu {
        display: flex;
        order: 2;
    }

    .logo-container {
        order: 1;
    }

    .nav-menu {
        order: 3;
        flex-direction: column;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .nav-menu.active {
        max-height: 800px;
    }

    .nav-item {
        width: 100%;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-link {
        padding: 15px 20px;
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        background-color: rgba(255, 255, 255, 0.1);
    }

    .dropdown.active .dropdown-menu {
        max-height: 500px;
    }

    .dropdown-link {
        color: var(--white);
        padding-left: 40px;
    }

    .dropdown-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }

    /* ✅ Responsive pour le page-header */
    .page-header {
        padding: 20px 15px;
        margin-bottom: 25px;
    }
    
    .page-header h1 {
        font-size: 24px;
        flex-direction: column;
        gap: 10px;
    }
    
    .page-header h1 i {
        font-size: 28px;
    }
    
    .page-header p {
        font-size: 14px;
    }

    /* Formulaires */
    .form-container {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-row .form-group.small {
        max-width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* ✅ Force les inputs à s'adapter sur mobile */
    .form-group input,
    .form-group select {
        font-size: 16px; /* Évite le zoom sur iOS */
        width: 100%;
    }
}
