/* ==========================================================
   Alvéa — Gestion de ruchers
   Tokens : fond neutre chaud, accent miel, texte charbon.
   Fraunces (titres, empattements chaleureux) + Inter (données/UI).
   ========================================================== */

:root {
    --color-bg: #F7F5F0;
    --color-surface: #FFFFFF;
    --color-border: #E2DFD6;
    --color-text: #2A2620;
    --color-text-muted: #6B6558;
    --color-accent: #C98A2C;
    --color-accent-dark: #9C6B1C;
    --color-accent-soft: #F3E4C6;
    --color-success: #4B7B4E;
    --color-success-soft: #E4EEE3;
    --color-warning: #B5511F;
    --color-warning-soft: #F5E2D6;
    --color-danger: #A83232;

    --color-tile-bg: #F5CB5C;
    --color-tile-border: #E0B23F;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --radius: 8px;
    --shadow: 0 1px 3px rgba(42, 38, 32, 0.08), 0 1px 2px rgba(42, 38, 32, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    margin: 0 0 0.4em 0;
    color: var(--color-text);
}

a { color: var(--color-accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Barre de navigation --- */
.topbar {
    background: var(--color-text);
    color: #fff;
}

.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.brand-link {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    color: inherit;
}

.brand-link:hover {
    text-decoration: none;
    opacity: 0.9;
}

.topbar .brand-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
}

.topbar .brand-name span { color: var(--color-accent); }

.topbar .brand-tag {
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #A79E8F;
}

.topbar nav a {
    color: #E9E5DA;
    margin-left: 1.2rem;
    font-size: 0.92rem;
}

.topbar nav a:hover { color: var(--color-accent); text-decoration: none; }

/* --- Fil d'Ariane : reflète la hiérarchie rucher > ruche > suivi --- */
.breadcrumb {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.9rem 1.5rem 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb .sep { margin: 0 0.4em; color: var(--color-border); }
.breadcrumb .current { color: var(--color-text); font-weight: 600; }

/* --- Contenu --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.4rem;
    margin-bottom: 1.2rem;
}

.card-form { max-width: 720px; }

/* --- Boutons --- */
.btn {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
}

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

.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-dark); }

.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-bg); }

.btn-danger { background: transparent; color: var(--color-danger); border-color: var(--color-danger); }
.btn-danger:hover { background: var(--color-danger); color: #fff; }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.82rem; }

/* --- Formulaires --- */
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; margin-top: 0.9rem; }
label:first-child { margin-top: 0; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    font-family: var(--font-body);
    font-size: 0.92rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--color-text);
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
    border-color: var(--color-accent);
}

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

.form-actions { margin-top: 1.3rem; display: flex; gap: 0.6rem; }

/* --- Tableaux --- */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.65rem 0.6rem; border-bottom: 1px solid var(--color-border); border-right: 1px solid var(--color-border); }
th:last-child, td:last-child { border-right: none; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); font-weight: 600; }
tr:hover td { background: var(--color-bg); }

.table-wrap { overflow-x: auto; }

/* Tableau de suivi : beaucoup de colonnes, on optimise la densité */
.table-suivis th, .table-suivis td { padding: 0.55rem 0.5rem; vertical-align: top; }
.table-suivis td:first-child, .table-suivis th:first-child { white-space: nowrap; }
.table-suivis td:last-child { white-space: nowrap; text-align: right; }
.table-suivis td { font-size: 0.87rem; }

/* --- Badges de statut --- */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 100px; font-size: 0.75rem; font-weight: 600; }
.badge-active { background: var(--color-success-soft); color: var(--color-success); }
.badge-hivernage { background: var(--color-accent-soft); color: var(--color-accent-dark); }
.badge-perdue, .badge-vendue { background: var(--color-warning-soft); color: var(--color-warning); }

/* --- Messages flash --- */
.flash { padding: 0.8rem 1rem; border-radius: var(--radius); margin-bottom: 1.2rem; font-size: 0.9rem; }
.flash-success { background: var(--color-success-soft); color: var(--color-success); }
.flash-error { background: var(--color-warning-soft); color: var(--color-danger); }

/* --- Sélecteur de vue (cartes / liste) --- */
.view-toggle { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.view-toggle a { padding: 0.4rem 0.8rem; font-size: 0.82rem; font-weight: 600; color: var(--color-text-muted); background: var(--color-surface); }
.view-toggle a:hover { text-decoration: none; background: var(--color-bg); }
.view-toggle a.active { background: var(--color-accent); color: #fff; }
.view-toggle a + a { border-left: 1px solid var(--color-border); }

/* --- Tuiles (ruchers / ruches) --- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem;
}

.tile {
    display: block;
    background: var(--color-tile-bg);
    border: 1px solid var(--color-tile-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    color: var(--color-text);
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.tile:hover {
    text-decoration: none;
    border-color: var(--color-accent-dark);
    transform: translateY(-2px);
}

.tile-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.tile-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.tile-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
}

.tile-meta {
    font-size: 0.88rem;
    color: #6B5320;
    margin-top: 0.25rem;
}

.tile-foot {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--color-tile-border);
    font-size: 0.82rem;
    color: #6B5320;
}

/* --- État vide --- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--color-text-muted); }
.empty-state a { font-weight: 600; }

/* --- Page de login --- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card { width: 100%; max-width: 360px; }
.login-card h1 { text-align: center; font-size: 1.6rem; }
.login-card .sub { text-align: center; color: var(--color-text-muted); font-size: 0.88rem; margin-bottom: 1.5rem; }

/* --- Responsive --- */
@media (max-width: 640px) {
    .topbar-inner { padding: 0.8rem 1rem; }
    .brand-tag { display: none; }
    .container { padding: 1rem; }
    .page-head { flex-direction: column; align-items: flex-start; }
    th, td { padding: 0.5rem 0.4rem; font-size: 0.85rem; }
}
