@import url('https://fonts.googleapis.com/css2?family=MedievalSharp&family=Cinzel:wght@400;700&family=Lato:wght@300;400;700&display=swap');

:root {
  --gold: #c9a84c;
  --gold-dark: #8a6d1f;
  --dark: #1a1208;
  --panel: #231a0e;
  --panel-border: #4a3510;
  --text: #e8d9b5;
  --text-muted: #9a8a6a;
  --danger: #8b2020;
  --success: #2e6b2e;
  --info: #1a4a6b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--dark);
  color: var(--text);
  font-family: 'Lato', sans-serif;
  min-height: 100vh;
}

/* ── LOGIN ─────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at center, #2a1f0a 0%, #0d0900 100%);
}

.login-box {
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: 8px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 0 40px rgba(201,168,76,0.15);
}

.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo h1 {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  color: var(--gold);
  letter-spacing: 2px;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.divider {
  border: none;
  border-top: 1px solid var(--panel-border);
  margin: 1.2rem 0;
}

/* ── FORM ─────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: #120e06;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  font-family: 'Lato', sans-serif;
  transition: border-color 0.2s;
}

.password-wrapper {
  position: relative;
}

.password-wrapper .form-control {
  padding-right: 2.6rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.2rem 0.3rem;
}

.password-toggle:hover {
  color: var(--gold);
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Lato', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  transition: opacity 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }
.btn:hover { opacity: 0.88; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: var(--dark);
  width: 100%;
}

.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-secondary { background: #3a2e1a; color: var(--text); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

/* ── LAYOUT APP ───────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── BURGER BUTTON (toujours visible, fixé en haut à gauche) ── */
.sidebar-burger {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 201;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--gold);
  font-size: 1.2rem;
  transition: background 0.15s;
}
.sidebar-burger:hover { background: rgba(201,168,76,0.15); }

/* ── OVERLAY (clique dehors = ferme) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 149;
  background: rgba(0,0,0,0.45);
}
.sidebar-overlay.visible { display: block; }

/* ── SIDEBAR ── */
.sidebar {
  width: 230px;
  background: var(--panel);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 150;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-logo {
  text-align: center;
  padding: 0 1rem 1.5rem;
  border-bottom: 1px solid var(--panel-border);
}

.sidebar-logo h2 {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 1rem;
  letter-spacing: 1px;
}

.sidebar-logo .role-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.badge-banquier { background: #5a3a00; color: var(--gold); }
.badge-guichetier { background: #1a3a5a; color: #8ab4e0; }
.badge-client { background: #1a3a1a; color: #8ae08a; }

.sidebar-nav {
  padding: 1rem 0;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 1.2rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(201,168,76,0.08);
  color: var(--gold);
}

.sidebar-nav a .nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--panel-border);
}

.sidebar-footer .user-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ── MAIN (pas de décalage, la sidebar est en overlay) ── */
.main-content {
  flex: 1;
  padding: 2rem;
  padding-top: 3.5rem;
}

/* ── TOPBAR ───────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.page-title {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  color: var(--gold);
}

/* ── CARDS ────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 1.2rem;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
  margin-top: 4px;
}

/* ── TABLE ────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--panel-border);
}

.panel-title {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: var(--gold);
}

.panel-body { padding: 1rem 1.2rem; }

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

th {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 1px;
  padding: 0.5rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--panel-border);
}

td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid rgba(74,53,16,0.4);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(201,168,76,0.04); }

/* ── MODAL ────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 1.8rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
}

.modal-title {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  margin-bottom: 1.2rem;
  font-size: 1.1rem;
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1.2rem;
}

/* ── ALERTS ───────────────────────────── */
.alert {
  padding: 0.7rem 1rem;
  border-radius: 4px;
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.alert-error { background: rgba(139,32,32,0.3); border: 1px solid var(--danger); color: #e08a8a; }
.alert-success { background: rgba(46,107,46,0.3); border: 1px solid var(--success); color: #8ae08a; }

/* ── SEPTIMS ──────────────────────────── */
.septims { color: var(--gold); font-weight: 700; }

/* ── RESPONSIVE ───────────────────────── */
@media (max-width: 768px) {
  .main-content { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
