/* Feuille commune de Logiretours (issue #107), chargée par base.html.
   Toute modification de ce fichier impose de changer la constante
   css_version de base.html : Cloudflare met la feuille en cache. La même
   constante versionne les scripts des pages d'articles et d'export. */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* ── Bandeau ─────────────────────────────────────────────────────────────── */

header {
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 1.5rem;
}

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

a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

header a {
    color: white;
}

.logout-form {
    display: inline;
}

/* « Déconnexion » est un bouton discret : il se lit comme les liens du bandeau. */
header .btn-quiet {
    color: white;
    padding: 0;
    font-size: inherit;
    font-weight: normal;
}

/* ── Boutons ─────────────────────────────────────────────────────────────── */

/* Un bouton sans classe n'a plus de couleur imposée : seule sa forme est
   commune. Les rôles se donnent par les classes ci-dessous. */
button {
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Quatre rôles, pas un de plus : principal, secondaire, danger, discret.
   .btn-primary garde sa forme sans .btn, pour les pages qui l'emploient seul. */
.btn,
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover,
.btn-primary:hover {
    text-decoration: none;
}

.btn:focus-visible,
.btn-primary:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.btn-primary {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    border-color: #2980b9;
}

.btn-secondary {
    background: white;
    border-color: #bdc3c7;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #ecf0f1;
    border-color: #95a5a6;
}

/* Rouge réservé à la suppression. */
.btn-danger {
    background: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    border-color: #c0392b;
}

.btn-quiet {
    background: transparent;
    border-color: transparent;
    color: #3498db;
    font-weight: 500;
}

.btn-quiet:hover {
    text-decoration: underline;
}

/* ── Mise en page ────────────────────────────────────────────────────────── */

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Pages de liste : le contenu et le bandeau prennent toute la largeur.
   S'active par le bloc body_class de base.html. */
.layout-wide .header-content,
.layout-wide main {
    max-width: none;
}

/* En-tête de page : titre à gauche, actions de la page à droite. */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.alerts {
    margin-bottom: 2rem;
}

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ── Formulaires ─────────────────────────────────────────────────────────── */

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

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

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

/* Conteneur étroit des formulaires, pour la lecture. */
.form-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    max-width: 500px;
    margin: 0 auto;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-size: 0.9rem;
    margin-top: 4rem;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

/* ── Formulaire photo (ajout et édition d'un article) ───────────────────── */

/* Sans JavaScript, les deux boutons ne servent à rien : seul le champ natif
   s'affiche. photo-input.js pose .photo-js au démarrage ; le champ natif est
   alors masqué à l'écran mais reste dans la page, c'est lui qu'il remplit. */
.photo-actions {
    display: none;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.photo-js .photo-actions {
    display: flex;
}

.photo-js #photo {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.photo-preview {
    margin-top: 0.75rem;
}

/* ── Téléphone ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    header { padding: 0.75rem 1rem; }
    .header-content { flex-wrap: wrap; gap: 0.75rem; }
    h1 { font-size: 1.25rem; }
    .nav-links {
        gap: 0.75rem;
        flex-wrap: wrap;
        font-size: 0.95rem;
    }
    main { padding: 1rem; margin: 1rem auto; }
    .form-container { padding: 1.25rem; max-width: 100%; }
    button, .btn { min-height: 44px; }
    /* « Déconnexion » garde une zone tactile de 44 px de haut. */
    header .btn-quiet { min-height: 44px; }
    .form-container button, .form-actions button, .btn-primary { width: 100%; }
    input, textarea, select { font-size: 16px; }

    /* Les actions passent sous le titre, en pleine largeur. */
    .page-header { flex-direction: column; align-items: stretch; }
    .page-actions { flex-direction: column; }
    .page-actions .btn { width: 100%; }
}
