/* ============================================================
   SmartPlanner AI — Styles globaux
   ============================================================ */

* { font-family: 'Inter', sans-serif; box-sizing: border-box; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Animations ── */
@keyframes fadeIn   { from { opacity:0; transform:translateY(8px) } to { opacity:1; transform:translateY(0) } }
@keyframes slideIn  { from { opacity:0; transform:translateX(-12px) } to { opacity:1; transform:translateX(0) } }
@keyframes spin     { to   { transform:rotate(360deg) } }
@keyframes pulse    { 0%,100% { opacity:1 } 50% { opacity:.5 } }

.fade-in   { animation: fadeIn  .25s ease forwards; }
.slide-in  { animation: slideIn .2s  ease forwards; }
.spinning  { animation: spin    .75s linear infinite; display:inline-block; }
.pulsing   { animation: pulse   1.5s ease infinite; }

/* ── Layout SPA ── */
#app { min-height: 100vh; }

/* ── Gradients ── */
.gradient-hero {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #6366f1 100%);
}
.gradient-card {
  background: linear-gradient(135deg, #f8faff 0%, #ffffff 100%);
}

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06), 0 8px 32px rgba(0,0,0,.07); }
.card-flat  { background:#fff; border-radius:16px; border:1px solid #f1f5f9; }

/* ── Boutons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; border-radius: 10px; cursor: pointer;
  transition: all .15s; border: none; font-size: 14px; line-height: 1;
  white-space: nowrap;
}
.btn:disabled { opacity:.5; cursor:not-allowed; }
.btn-primary  { background: #4f46e5; color:#fff; padding: 10px 18px; }
.btn-primary:hover:not(:disabled)  { background:#4338ca; transform:translateY(-1px); box-shadow:0 4px 12px rgba(79,70,229,.35); }
.btn-danger   { background: #ef4444; color:#fff; padding: 10px 18px; }
.btn-danger:hover:not(:disabled)   { background:#dc2626; }
.btn-ghost    { background: transparent; color:#64748b; padding: 8px 14px; border:1px solid #e2e8f0; }
.btn-ghost:hover:not(:disabled)    { background:#f8fafc; color:#1e293b; border-color:#cbd5e1; }
.btn-success  { background: #10b981; color:#fff; padding: 10px 18px; }
.btn-success:hover:not(:disabled)  { background:#059669; }
.btn-sm { padding: 6px 12px; font-size:12px; border-radius:8px; }
.btn-icon { padding:8px; border-radius:8px; }

/* ── Inputs ── */
.input {
  width:100%; border:1px solid #e2e8f0; border-radius:10px;
  padding:10px 14px; font-size:14px; color:#1e293b;
  background:#fafafa; transition:all .15s; outline:none;
}
.input:focus { border-color:#6366f1; background:#fff; box-shadow:0 0 0 3px rgba(99,102,241,.12); }
.input::placeholder { color:#94a3b8; }
.input-label { font-size:13px; font-weight:600; color:#374151; margin-bottom:5px; display:block; }
.input-error { border-color:#ef4444 !important; }
.error-text  { font-size:12px; color:#ef4444; margin-top:4px; }

/* ── Badges ── */
.badge {
  display:inline-flex; align-items:center; gap:4px;
  font-size:11px; font-weight:600; padding:3px 8px; border-radius:999px;
  letter-spacing:.02em;
}
.badge-indigo  { background:#eef2ff; color:#4f46e5; }
.badge-green   { background:#d1fae5; color:#059669; }
.badge-amber   { background:#fef3c7; color:#d97706; }
.badge-red     { background:#fee2e2; color:#dc2626; }
.badge-slate   { background:#f1f5f9; color:#475569; }
.badge-blue    { background:#dbeafe; color:#2563eb; }
.badge-violet  { background:#ede9fe; color:#7c3aed; }

/* ── Toggle switch ── */
.toggle-wrap { display:flex; align-items:center; gap:8px; cursor:pointer; }
.toggle-input { display:none; }
.toggle-slider {
  width:40px; height:22px; background:#cbd5e1; border-radius:999px;
  position:relative; transition:background .2s; flex-shrink:0;
}
.toggle-slider::after {
  content:''; position:absolute; left:3px; top:3px;
  width:16px; height:16px; background:#fff; border-radius:50%;
  transition:transform .2s; box-shadow:0 1px 3px rgba(0,0,0,.2);
}
.toggle-input:checked + .toggle-slider { background:#6366f1; }
.toggle-input:checked + .toggle-slider::after { transform:translateX(18px); }

/* ── Sidebar nav ── */
.nav-item {
  display:flex; align-items:center; gap:10px; padding:10px 14px;
  border-radius:10px; cursor:pointer; font-size:14px; font-weight:500;
  color:#64748b; transition:all .15s; text-decoration:none; border:none;
  background:transparent; width:100%;
}
.nav-item:hover     { background:#f1f5f9; color:#1e293b; }
.nav-item.active    { background:#eef2ff; color:#4f46e5; font-weight:600; }
.nav-item .icon     { width:20px; text-align:center; font-size:15px; }

/* ── Planning grid ── */
.planning-grid {
  display:grid;
  grid-template-columns: 48px repeat(7, 1fr);
}
.planning-cell {
  border-right: 1px solid #f1f5f9;
  border-top: 1px solid #f1f5f9;
  position: relative;
  min-height: 44px;
}
.planning-header {
  text-align:center; padding:10px 4px;
  font-size:12px; font-weight:700; color:#475569;
  border-right:1px solid #f1f5f9; position:sticky; top:0;
  background:#fff; z-index:5;
}
.planning-header.weekend { color:#8b5cf6; background:#faf5ff; }
.time-label {
  font-size:10px; color:#94a3b8; text-align:right;
  padding-right:6px; position:absolute; top:-7px; right:0;
  white-space:nowrap; pointer-events:none;
}
.event-block {
  position:absolute; left:2px; right:2px;
  border-radius:5px; padding:3px 6px;
  font-size:10px; font-weight:600;
  overflow:hidden; cursor:pointer;
  border-left:3px solid;
  transition:opacity .15s, transform .1s;
  line-height:1.3;
}
.event-block:hover { opacity:.85; transform:scale(1.01); }

/* ── Employee card ── */
.employee-card {
  display:flex; align-items:center; gap:12px; padding:14px 16px;
  border-radius:12px; border:1px solid #f1f5f9; background:#fff;
  transition:all .2s; cursor:pointer;
}
.employee-card:hover { border-color:#e0e7ff; background:#fafbff; box-shadow:0 2px 8px rgba(99,102,241,.08); }
.employee-avatar {
  width:40px; height:40px; border-radius:50%; display:flex;
  align-items:center; justify-content:center; font-weight:700;
  font-size:15px; color:#fff; flex-shrink:0;
}

/* ── Constraint card ── */
.constraint-card {
  padding:12px 16px; border-bottom:1px solid #f8fafc;
  transition:background .15s;
}
.constraint-card:hover { background:#fafbff; }
.constraint-card:last-child { border-bottom:none; }

/* ── Modal ── */
.modal-overlay {
  position:fixed; inset:0; background:rgba(15,23,42,.5);
  backdrop-filter:blur(4px); z-index:100;
  display:flex; align-items:center; justify-content:center; padding:16px;
  animation:fadeIn .2s ease;
}
.modal-box {
  background:#fff; border-radius:20px; width:100%; max-width:520px;
  box-shadow:0 20px 60px rgba(0,0,0,.18); animation:fadeIn .2s ease;
  overflow:hidden; max-height:90vh; overflow-y:auto;
}
.modal-header {
  padding:20px 24px 16px; border-bottom:1px solid #f1f5f9;
  display:flex; align-items:center; justify-content:space-between;
  position:sticky; top:0; background:#fff; z-index:5;
}

/* ── Toast ── */
#toast-container {
  position:fixed; bottom:24px; right:24px; z-index:200;
  display:flex; flex-direction:column; gap:8px; align-items:flex-end;
}
.toast {
  background:#0f172a; color:#fff; padding:12px 18px; border-radius:12px;
  font-size:13px; box-shadow:0 8px 24px rgba(0,0,0,.2);
  display:flex; align-items:center; gap:8px; min-width:240px; max-width:360px;
  animation:slideIn .2s ease;
}
.toast.success { border-left:4px solid #10b981; }
.toast.error   { border-left:4px solid #ef4444; }
.toast.info    { border-left:4px solid #6366f1; }
.toast.warn    { border-left:4px solid #f59e0b; }

/* ── Stat card ── */
.stat-card {
  background:#fff; border-radius:14px; border:1px solid #f1f5f9;
  padding:20px; display:flex; flex-direction:column; gap:6px;
}
.stat-value { font-size:32px; font-weight:800; color:#1e293b; line-height:1; }
.stat-label { font-size:13px; color:#64748b; font-weight:500; }
.stat-trend { font-size:12px; color:#10b981; font-weight:600; }

/* ── Loader ── */
.page-loader {
  display:flex; align-items:center; justify-content:center;
  min-height:60vh; flex-direction:column; gap:16px;
}
.loader-ring {
  width:48px; height:48px; border:4px solid #e2e8f0;
  border-top-color:#6366f1; border-radius:50%; animation:spin .8s linear infinite;
}

/* ── Score ring ── */
.score-ring {
  width:64px; height:64px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:18px; font-weight:800;
  background: conic-gradient(#6366f1 var(--pct, 0%), #e2e8f0 0%);
  position:relative;
}
.score-ring::before {
  content:''; position:absolute; inset:8px;
  background:#fff; border-radius:50%;
}
.score-ring span { position:relative; z-index:1; }

/* ── Tabs ── */
.tab-bar { display:flex; gap:4px; background:#f1f5f9; border-radius:12px; padding:4px; }
.tab-btn {
  flex:1; padding:8px 12px; border-radius:9px; border:none; background:transparent;
  font-size:13px; font-weight:600; color:#64748b; cursor:pointer; transition:all .15s;
}
.tab-btn.active { background:#fff; color:#4f46e5; box-shadow:0 1px 4px rgba(0,0,0,.08); }

/* ── Select ── */
.select {
  width:100%; border:1px solid #e2e8f0; border-radius:10px; padding:10px 14px;
  font-size:14px; color:#1e293b; background:#fafafa; cursor:pointer; outline:none;
  transition:all .15s; appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2394a3b8' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 12px center; background-size:20px;
  padding-right:36px;
}
.select:focus { border-color:#6366f1; background-color:#fff; box-shadow:0 0 0 3px rgba(99,102,241,.12); }

/* ── Color picker dot ── */
.color-dot {
  width:24px; height:24px; border-radius:50%; cursor:pointer;
  border:2px solid transparent; transition:all .15s;
}
.color-dot.selected, .color-dot:hover { border-color:#1e293b; transform:scale(1.15); }

/* ── Empty state ── */
.empty-state {
  padding:48px 24px; text-align:center; color:#94a3b8;
}
.empty-state i { font-size:48px; margin-bottom:12px; display:block; }
.empty-state h3 { font-size:16px; font-weight:600; color:#64748b; margin-bottom:6px; }
.empty-state p  { font-size:14px; }

/* ── Table ── */
.table { width:100%; border-collapse:separate; border-spacing:0; }
.table th {
  font-size:11px; font-weight:700; color:#94a3b8; text-transform:uppercase;
  letter-spacing:.06em; padding:10px 14px; text-align:left;
  border-bottom:1px solid #f1f5f9; background:#fafafa;
  position:sticky; top:0; z-index:2;
}
.table td { padding:12px 14px; border-bottom:1px solid #f8fafc; font-size:14px; color:#334155; }
.table tr:last-child td { border-bottom:none; }
.table tr:hover td { background:#fafbff; }

/* ── Week picker ── */
.week-nav { display:flex; align-items:center; gap:8px; }
.week-nav button {
  width:32px; height:32px; border-radius:8px; border:1px solid #e2e8f0;
  background:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center;
  color:#64748b; transition:all .15s; font-size:14px;
}
.week-nav button:hover { background:#f1f5f9; border-color:#cbd5e1; color:#1e293b; }

/* ── AI input special ── */
.ai-input-wrap {
  border:2px solid #e0e7ff; border-radius:14px; background:#fff;
  transition:border-color .2s;
}
.ai-input-wrap:focus-within { border-color:#6366f1; box-shadow:0 0 0 4px rgba(99,102,241,.1); }
.ai-textarea {
  width:100%; resize:none; border:none; outline:none; padding:14px;
  font-size:14px; color:#1e293b; background:transparent; border-radius:12px;
}
.ai-textarea::placeholder { color:#94a3b8; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .sidebar { display:none; }
  .main-content { margin-left:0 !important; }
}
@media (max-width: 640px) {
  .planning-grid { grid-template-columns: 36px repeat(7, 1fr); }
  .stat-value { font-size:24px; }
}

/* ── Page transitions ── */
.page { animation: fadeIn .2s ease; }
