/* ============================================================
   BASE.CSS — Crumbs MVP2
   Mode : Direction / PC
   Palette : Pains & Pots (marron / or / crème)
   NE PAS modifier pour le terrain → voir terrain.css
   ============================================================ */

/* ------------------------------------------------------------
   1. TOKENS CSS (Variables globales)
   ------------------------------------------------------------ */
:root {
    /* Palette Pains & Pots */
    --primary-brown:    #5D4037;
    --accent-gold:      #D4A373;
    --bg-cream:         #FAEDCD;
    --white:            #FFFFFF;
    --text-dark:        #3B2314;

    /* Couleurs fonctionnelles */
    --success-green:    #2D6A4F;
    --error-red:        #BC4749;
    --info-blue:        #1A759F;
    --warning-yellow:   #FFB703;

    /* Alecto — couleur unique, ne pas réutiliser ailleurs */
    --alecto:           #2C4A6E;
    --alecto-dark:      #1A2F45;
    --alecto-glow:      rgba(44, 74, 110, 0.25);

    /* Typographie */
    --font-display:     Georgia, 'Times New Roman', serif;
    --font-body:        'Segoe UI', system-ui, Helvetica, Arial, sans-serif;
    --font-mono:        'Courier New', Courier, monospace;

    /* Espacements */
    --radius-sm:        6px;
    --radius-md:        10px;
    --radius-lg:        15px;

    /* Ombres */
    --shadow-card:      0 2px 12px rgba(93, 64, 55, 0.08);
    --shadow-btn:       0 2px 6px rgba(0, 0, 0, 0.12);
}

/* ------------------------------------------------------------
   2. RESET & BASE
   ------------------------------------------------------------ */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--bg-cream);
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* ------------------------------------------------------------
   3. LAYOUT
   ------------------------------------------------------------ */
main, .content-wrapper, .container {
    padding-top: 80px;
}

.main-content {
    margin-top: 60px;
    padding-top: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* ------------------------------------------------------------
   4. TYPOGRAPHIE
   ------------------------------------------------------------ */
h1, h2, h3 {
    font-family: var(--font-display);
    color: var(--primary-brown);
    line-height: 1.3;
}

h1 { font-size: 1.8rem; margin-bottom: 16px; }
h2 { font-size: 1.3rem; margin-bottom: 12px; }
h3 { font-size: 1.05rem; margin-bottom: 8px; }

/* ------------------------------------------------------------
   5. BOUTONS — CRUD DIRECTION (PC)
   ------------------------------------------------------------ */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: var(--shadow-btn);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-create {
    background-color: var(--accent-gold);
    color: var(--white);
}
.btn-create:hover { background-color: #c4935f; }

.btn-edit {
    background-color: var(--info-blue);
    color: var(--white);
}
.btn-edit:hover { filter: brightness(1.1); }

.btn-delete {
    background-color: transparent;
    color: var(--error-red);
    border: 1.5px solid var(--error-red);
    box-shadow: none;
}
.btn-delete:hover {
    background-color: var(--error-red);
    color: var(--white);
}

/* Dans la section 5 — après .btn:active */

.btn-secondary {
    background-color: var(--primary-brown);
    color: var(--white);
    border: none;
    box-shadow: var(--shadow-btn);
    font-weight: 600;
}

.btn-secondary:hover {
    background-color: var(--text-dark);
    color: var(--white);
}

/* ------------------------------------------------------------
   6. ICÔNES CRUD (lignes de tableau)
   ------------------------------------------------------------ */
.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-icon-view {
    background: rgba(26, 117, 159, 0.1);
    color: var(--info-blue);
}
.btn-icon-view:hover {
    background: var(--info-blue);
    color: var(--white);
}

.btn-icon-edit {
    background: rgba(122, 69, 0, 0.1);
    color: #7A4500;
}
.btn-icon-edit:hover {
    background: #7A4500;
    color: var(--white);
}

.btn-icon-delete {
    background: rgba(188, 71, 73, 0.1);
    color: var(--error-red);
}
.btn-icon-delete:hover {
    background: var(--error-red);
    color: var(--white);
}

.crud-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ------------------------------------------------------------
   7. BOUTON ALECTO (Dashboard admin uniquement)
   ------------------------------------------------------------ */
.btn-alecto {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, var(--alecto) 0%, var(--alecto-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    padding: 16px 28px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 20px var(--alecto-glow), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

/* Effet de reflet au survol */
.btn-alecto::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    transition: left 0.5s ease;
}
.btn-alecto:hover::before { left: 150%; }
.btn-alecto:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px var(--alecto-glow);
}
.btn-alecto:active { transform: translateY(0); }

/* Icône interne Alecto */
.btn-alecto .alecto-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.btn-alecto .alecto-label { display: block; font-size: 1rem; }
.btn-alecto .alecto-sub {
    display: block;
    font-size: 0.72rem;
    opacity: 0.65;
    font-weight: 400;
    font-family: var(--font-mono);
}

/* État : déjà importé aujourd'hui (re-cliquable) */
.btn-alecto.imported {
    background: linear-gradient(135deg, #3a5a3a 0%, #2a3f2a 100%);
    box-shadow: 0 4px 20px rgba(45, 106, 79, 0.2);
}
.btn-alecto.imported .alecto-sub {
    opacity: 0.9;
    color: #a8d5a2;
}

/* État : import en cours (désactivé) */
.btn-alecto.loading {
    cursor: not-allowed;
    opacity: 0.8;
}
.btn-alecto.loading:hover { transform: none; }

/* Animation spinner */
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------
   8. BOUTONS ADMIN PANEL (sidebar direction)
   ------------------------------------------------------------ */
.btn-admin-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    color: var(--primary-brown);
    text-align: left;
    padding: 12px 15px;
    margin-bottom: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.btn-admin-panel:hover {
    background: var(--bg-cream);
    border-color: var(--accent-gold);
    color: var(--primary-brown);
    transform: translateX(5px);
}

.btn-admin-panel i {
    width: 20px;
    color: var(--accent-gold);
    font-size: 1.1rem;
}

/* ------------------------------------------------------------
   9. BOUTON PETIT (pilule)
   ------------------------------------------------------------ */
.btn-small-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: var(--info-blue);
    color: var(--white);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    transition: all 0.2s ease;
    cursor: pointer;
}
.btn-small-action:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* ------------------------------------------------------------
   10. CARTES
   ------------------------------------------------------------ */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(93, 64, 55, 0.06);
    margin-bottom: 16px;
}

/* ------------------------------------------------------------
   11. TABLEAUX
   ------------------------------------------------------------ */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--primary-brown);
    color: var(--white);
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.3px;
}

.table th:first-child { border-radius: 8px 0 0 0; }
.table th:last-child  { border-radius: 0 8px 0 0; }

.table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(93, 64, 55, 0.07);
    color: var(--text-dark);
}

.table tr:hover td { background: rgba(212, 163, 115, 0.05); }

/* ------------------------------------------------------------
   12. BADGES STATUT
   ------------------------------------------------------------ */
.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-success { background: rgba(45,106,79,0.1);  color: var(--success-green); }
.badge-warning { background: rgba(255,183,3,0.15); color: #8a6200; }
.badge-error   { background: rgba(188,71,73,0.1);  color: var(--error-red); }
.badge-info    { background: rgba(26,117,159,0.1); color: var(--info-blue); }

/* ------------------------------------------------------------
   13. FORMULAIRES (direction)
   ------------------------------------------------------------ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--primary-brown);
}

label.required::after {
    content: " *";
    color: var(--error-red);
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--bg-cream);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-body);
    color: var(--text-dark);
    background: var(--white);
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(212, 163, 115, 0.15);
}

/* ------------------------------------------------------------
   14. ALERTES / MESSAGES DJANGO
   ------------------------------------------------------------ */
.messages-container { margin-bottom: 20px; }

.alert {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error   { background: #f8d7da; color: var(--error-red);   border: 1px solid #f5c6cb; }
.alert-success { background: #d4edda; color: var(--success-green); border: 1px solid #c3e6cb; }
.alert-warning { background: #fff3cd; color: #856404;             border: 1px solid #ffeeba; }
.alert-info    { background: #d1ecf1; color: var(--info-blue);   border: 1px solid #bee5eb; }

/* ------------------------------------------------------------
   15. UTILITAIRES
   ------------------------------------------------------------ */
.hidden { display: none !important; }
.text-muted { color: #888; font-size: 0.85rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }


/* ============================================================
   BOUTON CHAT — Mobile et Desktop
   ============================================================ */

.btn-chat {
    /* Base commune */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 700;
    border-radius: 24px;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

/* --- VERSION DESKTOP --- */
.btn-chat {
    background: linear-gradient(135deg, #1A3A5C, #2C5F8A);
    color: white;
    padding: 10px 20px;
    font-size: 0.85rem;
    box-shadow: 0 3px 10px rgba(26, 58, 92, 0.3);
}

.btn-chat:hover {
    background: linear-gradient(135deg, #2C5F8A, #1A3A5C);
    box-shadow: 0 5px 15px rgba(26, 58, 92, 0.4);
    transform: translateY(-1px);
    color: white;
}

.btn-chat i {
    font-size: 1rem;
}
/* --- VERSION MOBILE (terrain) --- */
body.terrain .btn-chat {
    background: linear-gradient(135deg, #1A3A5C, #2C5F8A);
    color: white;
    padding: 14px 18px;
    font-size: 0;           /* On masque le texte sur mobile */
    border-radius: 50%;     /* Cercle */
    width: 52px;
    height: 52px;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(26, 58, 92, 0.4);
}

body.terrain .btn-chat i {
    font-size: 1.3rem;      /* L'icône reste visible */
}

body.terrain .btn-chat:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(26, 58, 92, 0.5);
}

/* ------------------------------------------------------------
   16. NAVIGATION MOBILE FIXE (bas d'écran)
   ------------------------------------------------------------ */
.nav-buttons-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    box-shadow: 0 -3px 12px rgba(0,0,0,0.1);
    z-index: 100;
}

.nav-buttons-fixed .btn-prev {
    flex: 1;
    padding: 16px;
    background: var(--bg-cream);
    color: var(--primary-brown);
    border: 1.5px solid var(--accent-gold);
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
}

.nav-buttons-fixed .btn-mobile,
.nav-buttons-fixed .btn-mobile-success,
.nav-buttons-fixed .btn-mobile-info,
.nav-buttons-fixed button[type="submit"] {
    flex: 2;
    padding: 16px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
}