/* ── ThanatoKit Solo — Style partagé ────────────────────────────── */

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

:root {
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --thanato: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #06B6D4;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────────────── */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--gray-900);
  color: white;
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 0 24px 24px;
  font-size: 1.2rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo span { color: var(--primary); }

.sidebar-nav { padding: 16px 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.05); color: white; }
.sidebar-nav a.active {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.sidebar-user {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  padding: 12px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
}
.sidebar-user-name { font-weight: 600; }
.sidebar-user-role { color: rgba(255,255,255,0.5); font-size: 0.8rem; }
.sidebar-user a { color: rgba(255,255,255,0.6); font-size: 0.8rem; }

.main {
  flex: 1;
  padding: 32px 40px;
  overflow-x: auto;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.main-header h1 {
  font-size: 1.8rem;
  color: var(--gray-900);
}
.main-header .subtitle {
  color: var(--gray-500);
  font-size: 0.9rem;
}

/* ── Boutons ─────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-success { background: var(--thanato); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

/* ── Cards / KPIs ────────────────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border-left: 4px solid;
}
.kpi.k-purple { border-left-color: var(--primary); }
.kpi.k-green { border-left-color: var(--thanato); }
.kpi.k-orange { border-left-color: var(--warning); }
.kpi.k-blue { border-left-color: var(--info); }
.kpi-num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
}
.kpi-label {
  font-size: 0.85rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-header h3 { font-size: 1.1rem; color: var(--gray-900); }
.card-body { padding: 20px; }

/* ── Tables / listes ─────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; }
table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.9rem;
  color: var(--gray-700);
}
table tr:hover td { background: var(--gray-50); }
table tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-todo { background: #fed7aa; color: #c2410c; }
.badge-done { background: #dcfce7; color: #15803d; }
.badge-cancelled { background: #fee2e2; color: #b91c1c; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-invited { background: #fed7aa; color: #c2410c; }
.badge-disabled { background: #e2e8f0; color: #475569; }
.badge-family { background: #ffedd5; color: #c2410c; }
.badge-pf { background: #ede9fe; color: #6d28d9; }

/* ── Forms ──────────────────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: white;
  color: var(--gray-800);
  transition: border-color 0.15s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Login page ─────────────────────────────────────────────────── */

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-card h1 {
  font-size: 1.6rem;
  color: var(--gray-900);
  margin-bottom: 8px;
}
.login-card .subtitle { color: var(--gray-500); margin-bottom: 24px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 12px; }
.login-card .alert {
  padding: 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-top: 16px;
}
.login-card .alert-success { background: #dcfce7; color: #15803d; }
.login-card .alert-error { background: #fee2e2; color: #b91c1c; }

/* ── Calendrier ─────────────────────────────────────────────────── */

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}
.calendar-day-name {
  background: var(--gray-100);
  padding: 8px;
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--gray-600);
}
.calendar-day {
  background: white;
  padding: 8px;
  min-height: 90px;
  font-size: 0.85rem;
  color: var(--gray-700);
}
.calendar-day.today { background: #ede9fe; font-weight: 700; }
.calendar-day .day-num { font-weight: 600; }
.calendar-day .mission-tag {
  display: block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  background: #ddd6fe;
  color: var(--primary-dark);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Mobile ─────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 12px 0;
  }
  .sidebar-logo { padding: 0 16px 12px; }
  .sidebar-nav { display: flex; padding: 0; overflow-x: auto; }
  .sidebar-nav a { padding: 8px 14px; white-space: nowrap; font-size: 0.85rem; }
  .sidebar-user { position: relative; bottom: auto; padding: 12px 16px; }
  .main { padding: 20px; }
  .main-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .form-row { grid-template-columns: 1fr; }
  .calendar-day { min-height: 60px; padding: 4px; font-size: 0.75rem; }
  .kpi-num { font-size: 1.6rem; }
}
