/* ===== GOOGLE FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ===== VARIABLES ===== */
:root {
    --brun:        #1a0a00;
    --brun-clair:  #6b3a1f;
    --or:          #c8932a;
    --or-clair:    #f0c060;
    --or-gradient: linear-gradient(135deg, #c8932a, #e8b84b);
    --fond:        #f7f3ee;
    --fond-carte:  #ffffff;
    --texte:       #1a0a00;
    --texte-doux:  #6b5a4e;
    --gris:        #9e8e84;
    --bordure:     #e8ddd4;
    --vert:        #2a6b3a;
    --rouge:       #8b1a1a;
    --radius:      12px;
    --radius-lg:   20px;
    --ombre:       0 4px 20px rgba(26,10,0,.08);
    --ombre-hover: 0 8px 30px rgba(26,10,0,.15);
    --transition:  .2s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Poppins', sans-serif;
    background: var(--fond);
    color: var(--texte);
    line-height: 1.6;
    font-size: 15px;
}
a { color: var(--brun-clair); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--or); }
img { max-width: 100%; border-radius: var(--radius); }

/* ===== EN-TÊTE ===== */
.entete {
    background: var(--brun);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0,0,0,.3);
}
.entete-interieur {
    max-width: 1200px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 1rem;
}
.logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--or-clair);
    letter-spacing: .02em;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.logo:hover { color: #fff; }
.entete nav {
    display: flex;
    align-items: center;
    gap: .2rem;
    flex-wrap: wrap;
}
.entete nav a {
    color: #c9b8a8;
    font-size: .82rem;
    font-weight: 500;
    padding: .4rem .75rem;
    border-radius: 8px;
    transition: background var(--transition), color var(--transition);
}
.entete nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.lien-deconnexion {
    background: rgba(200,147,42,.15) !important;
    color: var(--or-clair) !important;
    border: 1px solid rgba(200,147,42,.3);
}
.lien-deconnexion:hover { background: rgba(200,147,42,.3) !important; }

/* ===== CONTENU ===== */
.contenu {
    max-width: 1200px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

/* ===== PIED ===== */
.pied {
    text-align: center;
    padding: 2rem;
    color: var(--gris);
    font-size: .8rem;
    font-weight: 300;
    border-top: 1px solid var(--bordure);
    margin-top: 4rem;
}

/* ===== ALERTES ===== */
.alerte {
    padding: .9rem 1.2rem;
    border-radius: var(--radius);
    margin-bottom: 1.2rem;
    font-size: .88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.alerte.succes {
    background: #f0faf3;
    color: #1a5c2a;
    border: 1px solid #b6e8c4;
}
.alerte.erreur {
    background: #fdf2f2;
    color: #7a1a1a;
    border: 1px solid #f0b8b8;
}

/* ===== TITRES ===== */
h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--brun);
    margin-bottom: 1.5rem;
    letter-spacing: -.02em;
}
h1::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: var(--or-gradient);
    border-radius: 2px;
    margin-top: .4rem;
}
h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--brun);
    margin-bottom: 1rem;
    letter-spacing: -.01em;
}

/* ===== TABLEAU DE BORD ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}
.stat-carte {
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--ombre);
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-carte::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--or-gradient);
}
.stat-carte:hover { transform: translateY(-3px); box-shadow: var(--ombre-hover); }
.stat-carte .chiffre {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--or);
    line-height: 1;
    margin-bottom: .3rem;
}
.stat-carte .libelle {
    color: var(--gris);
    font-size: .8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* ===== GRILLE CIGARES ===== */
.grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.2rem;
}
.carte-cigare {
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--radius-lg);
    box-shadow: var(--ombre);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition);
}
.carte-cigare:hover { transform: translateY(-4px); box-shadow: var(--ombre-hover); }
.carte-cigare img { width: 100%; height: 180px; object-fit: cover; border-radius: 0; }
.carte-cigare .photo-absent {
    height: 180px;
    background: linear-gradient(135deg, #f0e8de, #e8ddd4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
}
.carte-cigare .corps { padding: 1.1rem; flex: 1; }
.carte-cigare .marque {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--or);
    margin-bottom: .2rem;
}
.carte-cigare .nom {
    font-size: 1rem;
    font-weight: 600;
    color: var(--brun);
    margin-bottom: .5rem;
    line-height: 1.3;
}
.carte-cigare .meta {
    font-size: .8rem;
    color: var(--gris);
    font-weight: 400;
    margin-bottom: .2rem;
}
.carte-cigare .stock-badge {
    display: inline-block;
    margin-top: .6rem;
    padding: .2rem .65rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .02em;
}
.stock-ok   { background: #edfaf2; color: #1a6b3a; }
.stock-bas  { background: #fef9ec; color: #8a6200; }
.stock-vide { background: #fdf2f2; color: #8b1a1a; }
.carte-cigare .actions {
    display: flex;
    gap: .5rem;
    padding: .75rem 1rem;
    background: #faf7f4;
    border-top: 1px solid var(--bordure);
}

/* ===== FORMULAIRES ===== */
.formulaire {
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 660px;
    box-shadow: var(--ombre);
}
.champ { margin-bottom: 1.1rem; }
.champ label {
    display: block;
    font-weight: 600;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--texte-doux);
    margin-bottom: .4rem;
}
.champ input,
.champ select,
.champ textarea {
    width: 100%;
    padding: .65rem 1rem;
    border: 1.5px solid var(--bordure);
    border-radius: 10px;
    font-size: .95rem;
    font-family: 'Poppins', sans-serif;
    background: #fdfaf7;
    color: var(--texte);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.champ input:focus,
.champ select:focus,
.champ textarea:focus {
    outline: none;
    border-color: var(--or);
    box-shadow: 0 0 0 3px rgba(200,147,42,.12);
    background: #fff;
}
.champ textarea { min-height: 110px; resize: vertical; }
.rangee { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ===== BOUTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.2rem;
    border-radius: 10px;
    font-size: .85rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    letter-spacing: .01em;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primaire {
    background: var(--brun);
    color: #fff;
    box-shadow: 0 2px 8px rgba(26,10,0,.2);
}
.btn-primaire:hover { background: #2d1200; color: #fff; }
.btn-secondaire {
    background: var(--or-gradient);
    color: var(--brun);
    box-shadow: 0 2px 8px rgba(200,147,42,.3);
}
.btn-secondaire:hover { opacity: .9; color: var(--brun); }
.btn-danger {
    background: #fdf2f2;
    color: var(--rouge);
    border: 1px solid #f0b8b8;
}
.btn-danger:hover { background: var(--rouge); color: #fff; }
.btn-petit { padding: .3rem .7rem; font-size: .78rem; border-radius: 8px; }

/* ===== TABLEAU ===== */
.tableau-wrap { overflow-x: auto; border-radius: var(--radius-lg); box-shadow: var(--ombre); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; background: #fff; }
th {
    background: var(--brun);
    color: var(--or-clair);
    padding: .75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}
th:first-child { border-radius: var(--radius-lg) 0 0 0; }
th:last-child  { border-radius: 0 var(--radius-lg) 0 0; }
td { padding: .7rem 1rem; border-bottom: 1px solid var(--bordure); color: var(--texte-doux); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #faf7f4; }

/* ===== SCORE ===== */
.score {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: .8rem;
}
.score-haut  { background: #edfaf2; color: #1a6b3a; }
.score-moyen { background: #fef9ec; color: #8a6200; }
.score-bas   { background: #fdf2f2; color: #8b1a1a; }

/* ===== PAGE CONNEXION ===== */
.page-connexion {
    max-width: 440px;
    margin: 5rem auto;
}
.page-connexion h1 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: .3rem;
}
.page-connexion h1::after { margin: .4rem auto 0; }
.page-connexion .sous-titre {
    text-align: center;
    color: var(--gris);
    font-size: .88rem;
    margin-bottom: 2rem;
}
.page-connexion .formulaire {
    max-width: 100%;
    border-radius: var(--radius-lg);
}

/* ===== CHIP / BADGE ===== */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: var(--fond);
    border: 1px solid var(--bordure);
    border-radius: 20px;
    padding: .25rem .75rem;
    font-size: .8rem;
    font-weight: 500;
    color: var(--texte-doux);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .rangee { grid-template-columns: 1fr; }
    .stats  { grid-template-columns: 1fr 1fr; }
    .entete { padding: 0 1rem; }
    .contenu { padding: 0 1rem; margin-top: 1.5rem; }
    .formulaire { padding: 1.2rem; }
    h1 { font-size: 1.4rem; }
}
