/* ═══════════════════════════════════════════════════════════════
   FC FONTAINE-LA-GAILLARDE — style.css
   Feuille de style commune à toutes les pages de l'écosystème.
   Modifie ce fichier pour changer couleurs, polices, logo.
   ═══════════════════════════════════════════════════════════════ */

/* ── IMPORT POLICES ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── VARIABLES (modifie ici pour changer l'identité visuelle) ── */
:root {
  /* Couleurs principales */
  --navy:        #0f2744;
  --navy2:       #1a3a5c;
  --gold:        #e8a020;
  --gold-light:  #fef8ec;

  /* États */
  --green:       #1a6b3a;
  --green-light: #e8f5ee;
  --red:         #c0392b;
  --red-light:   #fdf0f0;

  /* Surfaces */
  --bg:          #f4f6f9;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text:        #1a2744;
  --muted:       #6b7a99;

  /* Typographie */
  --font:        'DM Sans', sans-serif;
  --mono:        'DM Mono', monospace;

  /* Layout */
  --radius:      10px;
  --sidebar:     230px;

  /* Logo — chemin relatif à style.css */
  --logo-url:    url('logo.png');
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }

/* ═══════════════════════════════════════════════════════════════
   AUTH — Écran de connexion
   ═══════════════════════════════════════════════════════════════ */
.auth-screen { display: none; align-items: center; justify-content: center; min-height: 100vh; background: var(--navy); padding: 1rem; }
.auth-screen.visible { display: flex; }

.auth-card { background: var(--surface); border-radius: 16px; padding: 2.5rem 2rem; width: 100%; max-width: 380px; box-shadow: 0 24px 64px rgba(0,0,0,0.35); }

/* Logo sur l'écran de login — remplace l'ancien badge doré */
.auth-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
  background-image: var(--logo-url);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  /* Fond blanc circulaire pour que le logo ressort bien */
  background-color: #fff;
  border-radius: 50%;
  border: 2px solid var(--border);
  padding: 6px;
}

.auth-card h1 { text-align: center; font-size: 17px; font-weight: 600; margin-bottom: 4px; color: var(--navy); }
.auth-sub { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 1.75rem; }

.auth-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.auth-tab { flex: 1; padding: 9px; text-align: center; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.15s; user-select: none; }
.auth-tab.active { color: var(--navy); border-bottom-color: var(--navy); }

.auth-msg { padding: 10px 12px; border-radius: 8px; font-size: 12px; margin-bottom: 1rem; display: none; }
.auth-msg.ok   { background: var(--green-light); color: var(--green); display: block; }
.auth-msg.err  { background: var(--red-light);   color: var(--red);   display: block; }
.auth-msg.info { background: #e8f0fe; color: #1a3a8f; display: block; }
.auth-msg.warn { background: var(--gold-light);  color: #7a4a00; display: block; }

.auth-link { text-align: center; margin-top: 1rem; font-size: 12px; color: var(--muted); }
.auth-link a { color: var(--navy); text-decoration: none; font-weight: 500; cursor: pointer; }

.waiting-card { background: var(--surface); border-radius: 16px; padding: 2.5rem 2rem; width: 100%; max-width: 380px; box-shadow: 0 24px 64px rgba(0,0,0,0.35); text-align: center; }
.waiting-icon { width: 64px; height: 64px; background: var(--gold-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.25rem; font-size: 28px; }
.waiting-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.waiting-card p  { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 1.25rem; }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT APP (sidebar + main)
   ═══════════════════════════════════════════════════════════════ */
#app { display: none; min-height: 100vh; flex-direction: row; }
#app.visible { display: flex; }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── SIDEBAR ─────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar); min-height: 100vh; background: var(--navy);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
}

/* Logo dans la sidebar — remplace l'ancien badge rond doré */
.sidebar-logo { padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.08); display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.sidebar-logo-img {
  width: 48px;
  height: 48px;
  background-image: var(--logo-url);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  /* Fond blanc pour contraste sur la sidebar navy */
  background-color: #fff;
  border-radius: 8px;
  padding: 4px;
  flex-shrink: 0;
}
.sidebar-logo h1 { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.3; }
.sidebar-logo p  { font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 2px; }

nav { flex: 1; padding: 0.5rem 0; overflow-y: auto; }
.nav-section { padding: 0.75rem 1.25rem 0.25rem; font-size: 10px; color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: 0.08em; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 1.25rem; cursor: pointer; font-size: 13px; color: rgba(255,255,255,0.65); font-weight: 400; transition: all 0.15s; border-left: 3px solid transparent; }
.nav-item:hover  { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.1); color: #fff; border-left-color: var(--gold); font-weight: 500; }
.nav-item svg { width: 16px; height: 16px; opacity: 0.7; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }

.badge-ext  { margin-left: auto; font-size: 9px; font-weight: 600; background: var(--gold); color: var(--navy); padding: 1px 6px; border-radius: 10px; }
.badge-soon { margin-left: auto; font-size: 9px; background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.4); padding: 1px 6px; border-radius: 10px; }
.badge-notif { margin-left: auto; font-size: 9px; font-weight: 700; background: var(--red); color: #fff; padding: 1px 7px; border-radius: 10px; min-width: 18px; text-align: center; }

.sidebar-user { padding: 0.75rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer p { font-size: 10px; color: rgba(255,255,255,0.25); line-height: 1.6; }
.sidebar-user-name { font-size: 12px; font-weight: 500; color: #fff; margin-bottom: 3px; }
.sidebar-user-role { display: flex; gap: 4px; flex-wrap: wrap; }
.role-chip { background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 10px; font-size: 9px; color: rgba(255,255,255,0.6); }
.logout-btn { width: 100%; margin-top: 8px; padding: 7px; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.5); border-radius: 6px; font-family: var(--font); font-size: 11px; cursor: pointer; transition: all 0.15s; }
.logout-btn:hover { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.8); }

/* ── TOPBAR ──────────────────────────────────────────────────── */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 2rem; height: 56px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.topbar h2 { font-size: 16px; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; }

/* ═══════════════════════════════════════════════════════════════
   COMPOSANTS COMMUNS
   ═══════════════════════════════════════════════════════════════ */

/* ── BOUTONS ─────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 8px; font-family: var(--font); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; text-decoration: none; }
.btn-primary   { background: var(--navy);    color: #fff; }
.btn-primary:hover   { background: var(--navy2); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-success   { background: var(--green);   color: #fff; }
.btn-success:hover   { opacity: 0.9; }
.btn-danger    { background: var(--red);     color: #fff; }
.btn-danger:hover    { opacity: 0.9; }
.btn-gold      { background: var(--gold);    color: var(--navy); font-weight: 600; }
.btn-gold:hover      { opacity: 0.88; }
.btn-sm   { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-full { width: 100%; padding: 14px; font-size: 14px; font-weight: 600; border-radius: 10px; }
.btn-icon { padding: 8px; border-radius: 8px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Bouton Auth (pleine largeur, prominent) */
.auth-btn { width: 100%; padding: 11px; background: var(--navy); color: #fff; border: none; border-radius: 8px; font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.15s; margin-top: 0.25rem; }
.auth-btn:hover { background: var(--navy2); }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── CHAMPS DE FORMULAIRE ────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 1rem; }
.field label { font-size: 12px; font-weight: 500; color: var(--muted); }
.field input, .field select, .field textarea { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font); font-size: 13px; color: var(--text); background: var(--surface); outline: none; transition: border-color 0.15s; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy); }
.field input:disabled { background: var(--bg); color: var(--muted); }
.field textarea { resize: vertical; min-height: 70px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr;     gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.form-grid  { display: grid; grid-template-columns: 1fr 1fr;     gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.form-full  { grid-column: 1 / -1; }

/* ── CARDS ───────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; margin-bottom: 1rem; }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 14px; font-weight: 600; }
.card-body { padding: 1.25rem; }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red   { background: var(--red-light);   color: var(--red); }
.badge-gold  { background: var(--gold-light);  color: #a06010; }
.badge-navy  { background: #e8eef8;            color: var(--navy); }
.badge-muted { background: var(--bg);          color: var(--muted); }

/* ── TABLES ──────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 9px 12px; background: var(--bg); font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }
.td-mono   { font-family: var(--mono); font-size: 12px; }
.td-right  { text-align: right; font-family: var(--mono); font-size: 12px; }
.td-debit  { color: var(--red);   font-family: var(--mono); font-size: 12px; text-align: right; }
.td-credit { color: var(--green); font-family: var(--mono); font-size: 12px; text-align: right; }

/* ── MODALES ─────────────────────────────────────────────────── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,39,68,0.5); z-index: 100; align-items: center; justify-content: center; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius); width: 90%; max-width: 520px; border: 1px solid var(--border); max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--muted); line-height: 1; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── ÉTATS ───────────────────────────────────────────────────── */
.loading { text-align: center; padding: 3rem; color: var(--muted); font-size: 13px; }
.empty   { text-align: center; padding: 2.5rem; color: var(--muted); font-size: 13px; }
.section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 0.75rem; }

#content { padding: 2rem; flex: 1; }

/* ── TOPBAR FRAIS (variante navy plein, app mobile) ──────────── */
.topbar-navy { background: var(--navy); padding: 0 1rem; height: 56px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.topbar-navy .topbar-left  { display: flex; align-items: center; gap: 10px; }
.topbar-navy .topbar-title { font-size: 14px; font-weight: 600; color: #fff; line-height: 1.2; }
.topbar-navy .topbar-sub   { font-size: 11px; color: rgba(255,255,255,0.45); }
/* Logo dans la topbar navy (frais.html) */
.topbar-logo {
  width: 34px; height: 34px;
  background-image: var(--logo-url);
  background-size: contain; background-repeat: no-repeat; background-position: center;
  background-color: #fff; border-radius: 6px; padding: 3px; flex-shrink: 0;
}
.btn-logout { padding: 6px 12px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); color: rgba(255,255,255,0.7); border-radius: 8px; font-family: var(--font); font-size: 12px; cursor: pointer; transition: all 0.15s; }
.btn-logout:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE MOBILE
   ═══════════════════════════════════════════════════════════════ */
.hamburger { display: none; align-items: center; justify-content: center; width: 36px; height: 36px; background: var(--navy); border: none; border-radius: 8px; cursor: pointer; flex-shrink: 0; }
.hamburger svg { width: 18px; height: 18px; stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 90; }
.sidebar-overlay.open { display: block; }

@media (max-width: 768px) {
  :root { --sidebar: 260px; }
  .hamburger { display: flex; }
  #sidebar { position: fixed; left: 0; top: 0; height: 100vh; z-index: 100; transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: 4px 0 24px rgba(0,0,0,0.3); }
  #sidebar.open { transform: translateX(0); }
  #app.visible { flex-direction: column; }
  #main { min-width: 0; width: 100%; }
  .topbar { padding: 0 1rem; gap: 10px; }
  .topbar h2 { font-size: 14px; }
  #content { padding: 1rem; }
  .form-row, .form-grid { grid-template-columns: 1fr; }
  .form-row-3, .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .modal { width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; }
  .modal-backdrop { align-items: flex-end; }
  table { font-size: 12px; }
  th, td { padding: 8px 10px; }
}

@media (min-width: 769px) {
  .sidebar-overlay { display: none !important; }
  .hamburger { display: none !important; }
}
