/* ============================================================
   Lyamor's DJ — Gestionnaire Téléphonique
   Design System — Inspiré Apple
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=SF+Pro+Display:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

/* ── Variables ───────────────────────────────────────────── */
:root {
  /* Couleurs système */
  --c-bg:          #f5f5f7;
  --c-bg-panel:    #ffffff;
  --c-bg-sidebar:  rgba(255,255,255,0.72);
  --c-bg-card:     #ffffff;
  --c-bg-hover:    rgba(0,0,0,0.04);
  --c-bg-input:    rgba(0,0,0,0.04);

  --c-text:        #1d1d1f;
  --c-text-2:      #6e6e73;
  --c-text-3:      #aeaeb2;
  --c-text-inv:    #ffffff;

  --c-border:      rgba(0,0,0,0.09);
  --c-border-2:    rgba(0,0,0,0.15);

  --c-blue:        #0071e3;
  --c-blue-dark:   #0051a8;
  --c-blue-light:  #e8f0fe;
  --c-green:       #34c759;
  --c-green-bg:    #eefbf1;
  --c-orange:      #ff9500;
  --c-orange-bg:   #fff5e6;
  --c-red:         #ff3b30;
  --c-red-bg:      #fff1f0;
  --c-purple:      #af52de;
  --c-purple-bg:   #f5ecfc;

  /* Priorités */
  --p-basse:    var(--c-green);
  --p-normale:  var(--c-blue);
  --p-haute:    var(--c-orange);
  --p-urgente:  var(--c-red);

  /* Typographie */
  --font-ui:    'DM Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-mono:  'DM Mono', 'SF Mono', monospace;

  /* Tailles */
  --text-xs:    11px;
  --text-sm:    13px;
  --text-base:  15px;
  --text-lg:    17px;
  --text-xl:    20px;
  --text-2xl:   24px;
  --text-3xl:   32px;

  /* Espaces */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;  --sp-10: 40px;

  /* Rayons */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   18px;
  --r-xl:   24px;
  --r-full: 9999px;

  /* Ombres */
  --shadow-xs:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:  0 2px 8px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05);
  --shadow-md:  0 4px 20px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
  --shadow-xl:  0 24px 64px rgba(0,0,0,.14), 0 8px 24px rgba(0,0,0,.08);

  /* Transitions */
  --ease:       cubic-bezier(.25,.46,.45,.94);
  --dur-fast:   120ms;
  --dur-base:   220ms;
  --dur-slow:   380ms;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  56px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--c-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 99px; }

/* ── Typography ──────────────────────────────────────────── */
h1 { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -.5px; line-height: 1.15; }
h2 { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -.3px; }
h3 { font-size: var(--text-xl);  font-weight: 600; }
h4 { font-size: var(--text-lg);  font-weight: 600; }
p  { line-height: 1.6; }
.text-sm  { font-size: var(--text-sm); }
.text-xs  { font-size: var(--text-xs); }
.text-muted { color: var(--c-text-2); }
.mono { font-family: var(--font-mono); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-5);
  height: 38px;
  border: none;
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--dur-base) var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn-primary {
  background: var(--c-blue);
  color: #fff;
}
.btn-primary:hover { background: var(--c-blue-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(0,0,0,.06);
  color: var(--c-text);
}
.btn-secondary:hover { background: rgba(0,0,0,.1); }

.btn-ghost {
  background: transparent;
  color: var(--c-blue);
  padding: 0 var(--sp-3);
}
.btn-ghost:hover { background: var(--c-blue-light); }

.btn-danger  { background: var(--c-red); color: #fff; }
.btn-danger:hover  { background: #d92b22; transform: translateY(-1px); }
.btn-success { background: var(--c-green); color: #fff; }

.btn-sm { height: 30px; padding: 0 var(--sp-4); font-size: var(--text-xs); }
.btn-lg { height: 48px; padding: 0 var(--sp-8); font-size: var(--text-base); border-radius: var(--r-lg); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--r-sm); }

.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-text-2);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.form-control {
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-4);
  background: var(--c-bg-input);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--text-base);
  color: var(--c-text);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
  outline: none;
}
.form-control:focus {
  background: #fff;
  border-color: var(--c-blue);
  box-shadow: 0 0 0 4px rgba(0,113,227,.12);
}
.form-control::placeholder { color: var(--c-text-3); }
textarea.form-control {
  height: auto;
  min-height: 90px;
  padding: var(--sp-3) var(--sp-4);
  resize: vertical;
  line-height: 1.5;
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236e6e73' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card-header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.card-body { padding: var(--sp-6); }
.card-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--c-border);
  background: var(--c-bg);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  background: var(--c-bg-sidebar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}
.sidebar-logo {
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
}
.sidebar-logo .logo-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.2;
}
.sidebar-logo .logo-sub {
  font-size: var(--text-xs);
  color: var(--c-text-2);
  margin-top: 2px;
}
.sidebar-nav { flex: 1; padding: var(--sp-4) var(--sp-3); overflow-y: auto; }
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--c-text-3);
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  color: var(--c-text-2);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--dur-fast);
  text-decoration: none;
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: var(--c-bg-hover); color: var(--c-text); text-decoration: none; }
.nav-item.active {
  background: var(--c-blue-light);
  color: var(--c-blue);
}
.nav-item .nav-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  opacity: .7;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--c-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--sp-4) var(--sp-3);
  border-top: 1px solid var(--c-border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  transition: background var(--dur-fast);
  cursor: default;
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--c-blue), var(--c-purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
}
.user-info .user-name { font-size: var(--text-sm); font-weight: 600; }
.user-info .user-role { font-size: var(--text-xs); color: var(--c-text-2); text-transform: capitalize; }

/* Main */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-8);
  position: sticky;
  top: 0;
  z-index: 90;
  gap: var(--sp-4);
}
.topbar-title { font-size: var(--text-lg); font-weight: 600; flex: 1; }
.page-content { padding: var(--sp-8); flex: 1; }

/* ── Stats Cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.stat-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--c-text-2); margin-bottom: var(--sp-2); }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -1px; color: var(--c-text); line-height: 1; }
.stat-sub { font-size: var(--text-xs); color: var(--c-text-3); margin-top: var(--sp-2); }
.stat-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }

/* ── Badges & Statuts ────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: capitalize;
}
.badge-blue    { background: var(--c-blue-light); color: var(--c-blue); }
.badge-green   { background: var(--c-green-bg);   color: #1a8a3a; }
.badge-orange  { background: var(--c-orange-bg);  color: #b86e00; }
.badge-red     { background: var(--c-red-bg);     color: #c00; }
.badge-purple  { background: var(--c-purple-bg);  color: var(--c-purple); }
.badge-gray    { background: rgba(0,0,0,.06);     color: var(--c-text-2); }

/* ── Table ───────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.data-table thead th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--c-text-2);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--c-border);
  transition: background var(--dur-fast);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--c-bg-hover); }
.data-table td {
  padding: var(--sp-3) var(--sp-4);
  vertical-align: middle;
}

/* ── Priorité Indicator ──────────────────────────────────── */
.prio-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 600;
}
.prio-basse   { background: var(--c-green-bg);  color: #1a8a3a; }
.prio-normale { background: var(--c-blue-light); color: var(--c-blue); }
.prio-haute   { background: var(--c-orange-bg);  color: #b86e00; }
.prio-urgente { background: var(--c-red-bg);     color: var(--c-red); animation: pulse-urgente 2s infinite; }

@keyframes pulse-urgente {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,59,48,.3); }
  50% { box-shadow: 0 0 0 5px rgba(255,59,48,.0); }
}

/* ── Annonces ────────────────────────────────────────────── */
.annonce-banner {
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-4);
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
  animation: slideDown .3s var(--ease);
}
@keyframes slideDown { from { opacity:0; transform: translateY(-8px); } to { opacity:1; transform:none; } }
.annonce-info    { background: var(--c-blue-light);  border-left: 3px solid var(--c-blue); }
.annonce-warning { background: var(--c-orange-bg);   border-left: 3px solid var(--c-orange); }
.annonce-urgent  { background: var(--c-red-bg);      border-left: 3px solid var(--c-red); }
.annonce-title   { font-weight: 600; font-size: var(--text-sm); margin-bottom: 2px; }
.annonce-content { font-size: var(--text-sm); color: var(--c-text-2); line-height: 1.5; }
.annonce-date    { font-size: var(--text-xs); color: var(--c-text-3); margin-top: 4px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--c-bg-card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95) translateY(10px);
  transition: transform var(--dur-base) var(--ease);
}
.modal-overlay.open .modal { transform: none; }
.modal-header {
  padding: var(--sp-6);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: var(--text-xl); font-weight: 700; }
.modal-body  { padding: var(--sp-6); }
.modal-footer {
  padding: var(--sp-5) var(--sp-6);
  border-top: 1px solid var(--c-border);
  display: flex; justify-content: flex-end; gap: var(--sp-3);
}
.btn-close {
  width: 30px; height: 30px;
  border-radius: var(--r-full);
  background: rgba(0,0,0,.07);
  border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-2);
  transition: background var(--dur-fast);
}
.btn-close:hover { background: rgba(0,0,0,.12); }

/* ── Live Timer ──────────────────────────────────────────── */
.live-timer {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-text);
  background: rgba(0,0,0,.05);
  padding: 2px 8px;
  border-radius: var(--r-sm);
}

/* ── Toast notifications ─────────────────────────────────── */
#toast-container {
  position: fixed;
  top: var(--sp-6);
  right: var(--sp-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}
.toast {
  background: rgba(30,30,32,.92);
  backdrop-filter: blur(20px);
  color: #fff;
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  display: flex; align-items: center; gap: var(--sp-3);
  animation: toastIn .3s var(--ease);
  min-width: 260px;
  max-width: 360px;
}
.toast.leaving { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateX(20px); } }
@keyframes toastOut { to   { opacity:0; transform: translateX(20px); } }

/* ── Loading ─────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(0,0,0,.1);
  border-top-color: var(--c-blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login Page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg);
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0,113,227,.12) 0%, transparent 70%),
              radial-gradient(ellipse 60% 40% at 80% 80%, rgba(175,82,222,.08) 0%, transparent 60%);
  pointer-events: none;
}
.login-card {
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(200%) blur(30px);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-10);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  position: relative;
}
.login-logo {
  text-align: center;
  margin-bottom: var(--sp-8);
}
.login-logo .brand { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.login-logo .brand-sub { font-size: var(--text-sm); color: var(--c-text-2); margin-top: 4px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--dur-base) var(--ease); }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; }
  .page-content { padding: var(--sp-5); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Utilitaires ─────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.w-full { width: 100%; }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-4); }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
