/* ==========================================================================
   VARIABLES GLOBALES ET COULEURS (Charte Graphique Moderne & Logistique)
   ========================================================================== */
:root {
    --bg-main: #f8fafc;        /* Fond de page ultra-clair, reposant pour les yeux */
    --bg-card: #ffffff;        /* Fond des formulaires et blocs */
    --text-dark: #0f172a;      /* Texte principal (Bleu nuit presque noir) */
    --text-muted: #64748b;     /* Texte secondaire (Gris doux) */
    
    /* Couleurs de marque */
    --primary: #0f2d4a;        /* Bleu Marine profond (Sécurité, Confiance) */
    --primary-light: #1e4b75;  /* Bleu plus clair pour les hovers */
    --accent: #e05a36;         /* Orange Corail original (Rappelle les colis/l'action) */
    --accent-light: #fbeeea;   /* Fond corail très léger pour les états actifs */
    
    /* États */
    --valid: #10b981;          /* Vert moderne pour les inputs valides */
    --invalid: #ef4444;        /* Rouge moderne pour les erreurs */
    
    /* Structure */
    --radius: 12px;            /* Arrondis modernes et doux */
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

/* ==========================================================================
   STYLE GÉNÉRAL
   ========================================================================== */
* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-dark);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   CONTENEUR & STRUCTURE RESPONSIVE
   ========================================================================== */
.container {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

h1, h2, h3, h4 {
    color: var(--primary);
    margin-top: 0;
    font-weight: 700;
}

h1 { font-size: 2rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }
/* ==========================================================================
   EN-TÊTE ET NAVIGATION (Injection du Bleu Marine)
   ========================================================================== */
header {
    background-color: var(--primary); /* Fond Bleu Marine profond */
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

/* Le titre ou logo Colismaximo dans le header */
.connexion {
    background-color: var(--primary); /* Fond Bleu Marine profond */
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}
.connexion a {
    color: #ffffff !important; /* Texte en blanc sur le fond marine */
   
    font-weight: 800;
    letter-spacing: -0.5px;
    
}

/* Liste du menu */
.nav-menu ul {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    list-style: none;
    gap: 8px;
}

.nav-menu li {
    float: none; /* On nettoie l'ancien float */
    margin: 0;
}

/* Liens du menu par défaut */
.nav-menu a {
    display: inline-block;
    color: #cbd5e1; /* Gris clair pour les liens non actifs */
    font-size: 15px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: none;
}

/* Au survol des liens du menu */
.nav-menu a:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1); /* Léger effet de brillance */
}

/* Onglet actif (La page où l'on se trouve) */
.nav-menu a.active {
    background-color: var(--accent); /* Ton orange corail original */
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Style pour les boutons "noactive" si tu veux une variante */
.nav-menu a.noactive {
    background-color: transparent;
    color: #cbd5e1;
}
/* ==========================================================================
   LIENS ET BOUTONS DE NAVIGATION
   ========================================================================== */
a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}

a:hover {
    color: var(--accent);
}

/* Styles pour les onglets ou boutons de navigation */
a.active {
    background-color: var(--accent);
    color: white !important;
    border-radius: var(--radius);
    font-weight: 600;
}

a.noactive {
    background-color: #e2e8f0;
    color: var(--text-dark);
    border-radius: var(--radius);
}
/* ==========================================================================
   BLOC FORMULAIRE
   ========================================================================== */
form {
    background: var(--bg-card); /* Fond blanc */
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow); /* Légère ombre pour le décoller du fond */
    border: 1px solid #e2e8f0;
}
/* ==========================================================================
   FORMULAIRES (Champs, Select, Textarea modernes)
   ========================================================================== */
form ul {
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr; /* 1 colonne par défaut sur mobile */
    gap: 1.5rem;
}

form li {
    list-style: none;
    display: flex;
    flex-direction: column; /* Label au-dessus du champ */
    width: 100%;
}

form label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* Base commune pour tous les champs de saisie */
form input[type="text"],
form input[type="number"],
form select,
form textarea {
    width: 300px;
    background-color: #f8fafc; /* Gris très léger au repos */
    border: 1.5px solid #e2e8f0;
}

form input:focus, form select:focus, form textarea:focus {
    background-color: #ffffff; /* Devient blanc au focus */
    border-color: var(--accent); /* Bordure orange au focus pour rappeler l'action */
    box-shadow: 0 0 0 3px rgba(224, 90, 54, 0.15);
}

/* États au focus et validation */
form input:focus, form select:focus, form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 45, 74, 0.15);
}

input:invalid:not(:placeholder-shown) {
    border-color: var(--invalid);
    background-color: #fff1f2;
}

input:valid:not(:placeholder-shown) {
    border-color: var(--valid);
}

form textarea {
    height: 120px;
    resize: vertical;
}

/* ==========================================================================
   BOUTONS D'ACTION (Submit)
   ========================================================================== */
.submit, .btn-action {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: auto;
    min-width: 150px;
    padding: 12px 24px;
    background-color: var(--accent); /* Originalité Orange */
    color: white;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(224, 90, 54, 0.2);
    transition: all 0.2s ease;
}

.submit:hover, .btn-action:hover {
    background-color: #c84825;
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(224, 90, 54, 0.3);
}

.submit:active, .btn-action:active {
    transform: translateY(1px);
}

/* ==========================================================================
   BOUTONS RADIO DE FRET PERSONNALISÉS
   ========================================================================== */
.fret-options {
    display: flex;
    gap: 12px;
    margin-top: 0.25rem;
    width: 100%;
}

.fret-options input[type="radio"] {
    display: none;
}

.fret-options input[type="radio"] + label {
    flex: 1;
    display: block;
    padding: 14px;
    text-align: center;
    background-color: #f1f5f9;
    color: var(--text-dark);
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.fret-options input[type="radio"]:checked + label {
    background-color: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(224, 90, 54, 0.1);
}

/* ==========================================================================
   TABLEAUX, TICKETS ET CODES QR
   ========================================================================== */
table {
    width: 50%;
    margin: 1.5rem 0;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

table th {
    background-color: var(--primary);
    color: white;
    padding: 14px;
    font-weight: 600;
}

table td {
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
    color: var(--text-muted);
}

table tr:last-child td {
    border-bottom: none;
}

/* Style ticket de caisse / Colis moderne */
.ticket-colis {
    width: 100%;
    max-width: 340px;
    padding: 24px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius);
    text-align: center;
    margin: 2rem auto;
    background: var(--bg-card);
    box-shadow: var(--shadow);
}

/* ==========================================================================
   MEDIA QUERIES : ADAPTATION ORDINATEUR (Écrans > 768px)
   ========================================================================== */
@media screen and (min-width: 768px) {
    /* Le formulaire passe sur deux colonnes sur PC pour éviter d'être trop étiré */
    form ul {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Les champs plus larges (comme le textarea ou le bouton de validation) reprennent toute la largeur */
    form li.full-width, form li:last-child {
        grid-column: span 2;
    }
    
    /* Gestion du menu latéral pour ordinateur (en grille ou flex plutôt qu'en absolute) */
    .menuLateral {
        position: static; /* Plus de bug de défilement */
        width: 80%;
        max-width: 250px;
        border: 1px solid #e2e8f0;
        border-radius: var(--radius);
        background-color: var(--bg-card);
        padding: 1rem;
        box-shadow: var(--shadow);
    }
    
    table {
        width: 50%; /* Un peu plus centré sur grand écran */
    }
}
/* Positionnement des éléments */
#chat-button {
    position: fixed; bottom: 20px; right: 20px;
    background-color: #007bff; color: white; padding: 15px 20px;
    border-radius: 30px; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    font-family: Arial, sans-serif; font-weight: bold; z-index: 1000;
}
#chat-box {
    position: fixed; bottom: 80px; right: 20px;
    width: 350px; height: 450px; background-color: white;
    border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex; flex-direction: column; font-family: Arial, sans-serif; z-index: 1000;
    transition: all 0.3s ease;
}
.chat-hidden { display: none !important; }

/* Design interne */
#chat-header { background-color: #007bff; color: white; padding: 15px; border-radius: 10px 10px 0 0; display: flex; justify-content: space-between; }
#chat-logs { flex: 1; padding: 15px; overflow-y: auto; background-color: #f8f9fa; display: flex; flex-direction: column; gap: 10px; }
#chat-input-area { display: flex; padding: 10px; border-top: 1px solid #ddd; }
#user-input { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 4px; outline: none; }
#chat-input-area button { background-color: #007bff; color: white; border: none; padding: 8px 15px; margin-left: 5px; border-radius: 4px; cursor: pointer; }

/* Bulles de message */
.message { padding: 8px 12px; border-radius: 15px; max-width: 80%; word-wrap: break-word; font-size: 14px; }
.user-message { background-color: #007bff; color: white; align-self: flex-end; border-bottom-right-radius: 2px; }
.bot-message { background-color: #e9ecef; color: #333; align-self: flex-start; border-bottom-left-radius: 2px; }

/* cookies */
 #cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 450px;
    background: #ffffff;
    color: #333333;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    font-family: sans-serif;
    z-index: 999999;
    display: none; /* Caché par défaut */
  }
  .cookie-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
  }
  .cookie-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
  }
  .btn-accept { background: #2ecc71; color: white; }
  .btn-refuse { background: #e74c3c; color: white; }