/* Réinitialisation de base et typographie */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f4;
    color: #333;
    margin: 0;
}
.container {
    max-width: 65%px;
    margin: 20px auto;
    padding: 0 20px;
}
h1, h2, h3 {
    color: #0056b3;
}
a {
    color: #0056b3;
    text-decoration: none;
}
a:hover { text-decoration: underline; }

/* Header & Navigation */
header {
    background-color: #0056b3;
    color: #fff;
    padding: 1rem 0;
    text-align: center;
}
header h1 { color: #fff; margin:0; }
nav {
    display: flex;
    justify-content: center;
    background-color: #004085;
    padding: 0.5rem;
}
nav a {
    color: white;
    padding: 0.5rem 1rem;
    font-weight: bold;
}
nav a:hover {
    background-color: #00274e;
    text-decoration: none;
}

/* Tableaux */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
th, td {
    padding: 10px 8px; /* Moins d'espace sur les côtés (8px) qu'en haut/bas (10px) */
    font-size: 0.9em;  /* Police légèrement plus petite (90% de la taille normale) */
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: middle;
}
th {
    background-color: #f2f2f2;
}
tr:nth-child(even) { background-color: #f9f9f9; }

/* Statuts et Badges */
.statut {
    padding: 5px 10px;
    border-radius: 15px;
    color: white; /* Texte en blanc par défaut */
    font-size: 0.9em;
    font-weight: bold;
    text-align: center;
    display: inline-block;
}

.statut-retrait {
    background-color: #ffc107; /* Fond Orange */
    color: #333;             /* Texte foncé */
}
.statut-perime { background-color: #dc3545; } /* Fond Rouge */
.statut-en-rupture { background-color: #343a40; } /* Fond Gris Foncé */
.statut-ok { background-color: #28a745; } /* Fond Vert */}

/* Formulaires */
form {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 20px;
}
form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
form input[type="text"],
form input[type="number"],
form input[type="date"],
form input[type="file"] {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Important */
}
form button {
    background-color: #0056b3;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}
form button:hover { background-color: #004085; }

/* Formulaire rapide de mise à jour dans le tableau */
.form-update-rapide {
    display: flex;
    align-items: center;
    gap: 10px; /* Espace entre les éléments */
    background-color: transparent;
    padding: 0;
    box-shadow: none;
    margin-top:0;
}
.form-update-rapide input { margin-bottom: 0; }
.form-update-rapide input[type="date"] { width: auto; }
.form-update-rapide input[type="number"] { width: 70px; }

/* Alertes */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}
.alert-success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.alert-error { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    background-color: #e9ecef;
    color: #6c757d;
}

/* --- Styles pour la barre de recherche dans la navigation --- */
nav {
    flex-wrap: wrap; /* Permet aux éléments de passer à la ligne sur petits écrans */
}

.nav-links {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.nav-search {
    padding: 0 1rem;
}

.nav-search form {
    display: flex;
    align-items: center;
    padding: 0;
    margin: 0;
    background: none;
    box-shadow: none;
}

.nav-search input {
    margin: 0;
    /* On arrondit tous les coins de la zone de recherche */
    border-radius: 4px; 
}

.nav-search button {
    margin: 0;
    /* On ajoute une marge à gauche pour créer l'espace */
    margin-left: 5px; 
    border-radius: 4px; /* On arrondit aussi tous les coins du bouton */
    white-space: nowrap;
}

/* --- Styles pour la Fiche Produit --- */
.fiche-produit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.fiche-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fiche-card h3 {
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.fiche-actions {
    margin-top: 30px;
}

.button-link {
    display: inline-block;
    background-color: #28a745;
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
}
.button-link:hover {
    background-color: #218838;
}

/* Style pour le bouton de suppression */
.button-delete {
    background-color: #dc3545; /* Rouge */
    padding: 5px 10px !important; /* !important pour outrepasser d'autres styles si besoin */
    font-size: 0.9em !important;
}

.button-delete:hover {
    background-color: #c82333; /* Rouge plus foncé */
}
/* Style pour le surlignage de la ligne recherchée */
tr.highlight {
    background-color: #fff3cd !important;
    transition: background-color 0.5s ease-in-out;
}

.form-filtre {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: #f4f4f4; /* Couleur de fond pour ne pas être transparent */
    
    /* --- LIGNES MAGIQUES AJOUTÉES --- */
    position: sticky;
    top: 0;
    z-index: 10; /* Assure qu'il reste au-dessus du tableau */
}
