/* ============================================================
   Castelbrac — Maintenance
   Charte graphique appliquée :
   - Bleu Émeraude Atlantique #234455 (primaire)
   - Bleu Brume #6A7B85 (secondaire)
   - Ivoire Lumière #F7F4EE (fonds)
   - Pierre de Dinard #D7D2C9 (neutre / séparateurs)
   - Bronze Vieilli #B1925C (accent)
   - Titres : Cormorant Garamond
   - Textes : Montserrat (alternative libre à Avenir Next)
   ============================================================ */

:root {
    --emeraude: #234455;
    --brume: #6A7B85;
    --ivoire: #F7F4EE;
    --pierre: #D7D2C9;
    --bronze: #B1925C;

    --emeraude-dark: #182f3b;
    --success: #4f7a5c;
    --warning: #b1925c;
    --danger: #a15252;

    --font-titre: 'Cormorant Garamond', 'Times New Roman', serif;
    --font-texte: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;

    --radius: 4px;
    --shadow: 0 2px 16px rgba(35, 68, 85, 0.08);
    --shadow-hover: 0 6px 24px rgba(35, 68, 85, 0.14);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-texte);
    font-weight: 300;
    background: var(--ivoire);
    color: var(--emeraude);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .font-titre {
    font-family: var(--font-titre);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--emeraude);
    margin: 0 0 0.4em 0;
}

h1 { font-size: 2.4rem; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.25rem; }

a { color: var(--emeraude); }

.eyebrow {
    font-family: var(--font-texte);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    color: var(--bronze);
    font-weight: 500;
}

/* ---------- Layout ---------- */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 24px 96px;
}

.page--narrow { max-width: 640px; }

.top-bar {
    background: var(--emeraude);
    color: var(--ivoire);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-bar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-titre);
    font-size: 1.3rem;
    letter-spacing: 0.04em;
    color: var(--ivoire);
    text-decoration: none;
}

.top-bar__brand svg { width: 22px; height: 22px; stroke: var(--bronze); }

.top-bar__nav { display: flex; align-items: center; gap: 24px; }
.top-bar__logo { height: 26px; width: auto; display: block; }
.top-bar__nav a {
    color: var(--ivoire);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    opacity: 0.85;
}
.top-bar__nav a:hover { opacity: 1; }

.top-bar__user {
    font-size: 0.8rem;
    color: var(--pierre);
}

.divider-wave {
    display: block;
    margin: 32px auto;
    opacity: 0.5;
}

/* ---------- Cartes / conteneurs ---------- */
.card {
    background: #fff;
    border: 1px solid var(--pierre);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}

.card + .card { margin-top: 24px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--pierre);
    border-radius: var(--radius);
    padding: 24px;
    text-align: left;
    border-left: 3px solid var(--bronze);
}

.stat-card__value {
    font-family: var(--font-titre);
    font-size: 2.4rem;
    color: var(--emeraude);
    line-height: 1;
}

.stat-card__label {
    margin-top: 8px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brume);
}

.stat-card--alert .stat-card__value { color: var(--danger); }

/* ---------- Formulaires ---------- */
label {
    display: block;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brume);
    margin-bottom: 6px;
    margin-top: 20px;
    font-weight: 500;
}

label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    font-family: var(--font-texte);
    font-size: 0.95rem;
    color: var(--emeraude);
    background: var(--ivoire);
    border: 1px solid var(--pierre);
    border-radius: var(--radius);
    transition: border-color 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--bronze);
}

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

.file-input {
    border: 1px dashed var(--pierre);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    background: var(--ivoire);
    font-size: 0.85rem;
    color: var(--brume);
}

.help-text {
    font-size: 0.78rem;
    color: var(--brume);
    margin-top: 6px;
}

/* ---------- Boutons ---------- */
.btn {
    display: inline-block;
    font-family: var(--font-texte);
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 13px 28px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn--primary {
    background: var(--emeraude);
    color: var(--ivoire);
}
.btn--primary:hover { background: var(--emeraude-dark); }

.btn--accent {
    background: var(--bronze);
    color: #fff;
}
.btn--accent:hover { background: #997c4c; }

.btn--ghost {
    background: transparent;
    color: var(--emeraude);
    border-color: var(--pierre);
}
.btn--ghost:hover { border-color: var(--emeraude); }

.btn--small { padding: 8px 16px; font-size: 0.75rem; }
.btn--block { display: block; width: 100%; text-align: center; }

/* ---------- Badges de statut ---------- */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}
.badge--pending { background: #f3e3d1; color: #8a5a1f; }
.badge--progress { background: #dde7ea; color: var(--emeraude); }
.badge--done { background: #dfe9e1; color: var(--success); }

/* ---------- Tableau tickets ---------- */
.table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--pierre);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

thead th {
    text-align: left;
    font-family: var(--font-texte);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brume);
    padding: 14px 16px;
    border-bottom: 1px solid var(--pierre);
    background: var(--ivoire);
}

tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #efece6;
    vertical-align: middle;
}

tbody tr:hover { background: #fbfaf7; }
tbody tr:last-child td { border-bottom: none; }

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.filters select {
    width: auto;
    min-width: 160px;
}

/* ---------- Photos ---------- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.photo-grid img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--pierre);
    cursor: pointer;
}

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--emeraude) 0%, var(--emeraude-dark) 100%);
    padding: 24px;
}
.login-card {
    background: var(--ivoire);
    padding: 48px 40px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-hover);
    text-align: center;
}
.login-card svg { width: 36px; height: 36px; stroke: var(--bronze); margin-bottom: 12px; }
.brand-logo { height: 110px; width: auto; }
.brand-logo--small { height: 72px; }

/* ---------- Alertes ---------- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    margin-bottom: 20px;
}
.alert--success { background: #e6efe8; color: var(--success); border: 1px solid #c6dccd; }
.alert--error { background: #f3e3e3; color: var(--danger); border: 1px solid #e0c4c4; }

/* ---------- Confirmation (formulaire public) ---------- */
.confirmation {
    text-align: center;
    padding: 60px 20px;
}
.confirmation svg { width: 48px; height: 48px; stroke: var(--bronze); margin-bottom: 16px; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(24, 47, 59, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-overlay.is-open { display: flex; }
.modal {
    background: #fff;
    border-radius: var(--radius);
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
}

/* ---------- Bar chart simple (stats) ---------- */
.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.bar-row__label {
    width: 220px;
    font-size: 0.85rem;
    color: var(--emeraude);
    flex-shrink: 0;
}
.bar-row__track {
    flex: 1;
    background: var(--ivoire);
    border-radius: 3px;
    overflow: hidden;
    height: 10px;
}
.bar-row__fill {
    height: 100%;
    background: var(--bronze);
}
.bar-row__value {
    width: 36px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--brume);
}

footer.app-footer {
    text-align: center;
    padding: 32px;
    font-size: 0.75rem;
    color: var(--brume);
    letter-spacing: 0.05em;
}

@media (max-width: 640px) {
    .top-bar { flex-direction: column; gap: 12px; }
    .bar-row__label { width: 120px; font-size: 0.78rem; }
}
