/* =====================================================================
 * Nexora V30 — Premium UX overlay
 * Charge APRÈS styles.css. Ajoute des micro-interactions, animations,
 * Cmd+K palette, Toast queue, Call360 drawer.
 * Posture : pas de override agressif. Que des ajouts ou améliorations.
 * ===================================================================== */

:root {
  --shadow-lg: 0 10px 30px rgba(11, 23, 51, 0.18), 0 2px 8px rgba(11, 23, 51, 0.08);
  --shadow-xl: 0 24px 60px rgba(11, 23, 51, 0.25), 0 8px 16px rgba(11, 23, 51, 0.10);
  --transition-fast: 120ms cubic-bezier(0.2, 0, 0, 1);
  --transition-medium: 220ms cubic-bezier(0.2, 0, 0, 1);
  --transition-slow: 360ms cubic-bezier(0.2, 0, 0, 1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

/* ===== Scrollbar premium ===== */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(27, 45, 92, 0.18);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background var(--transition-fast);
}
*::-webkit-scrollbar-thumb:hover { background: rgba(27, 45, 92, 0.35); background-clip: padding-box; }

/* Sidebar dark scrollbar */
.sidebar *::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); background-clip: padding-box; }
.sidebar *::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); background-clip: padding-box; }

/* ===== Transitions de vue ===== */
.content > * {
  animation: v30-view-enter var(--transition-slow) both;
}
@keyframes v30-view-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Cards : hover lift subtil ===== */
.card {
  transition: box-shadow var(--transition-medium), transform var(--transition-medium);
  border-radius: var(--radius-md);
}
.card:hover {
  box-shadow: 0 6px 20px rgba(27, 45, 92, 0.10);
}

/* KPI cards — élévation et reflets ===== */
.kpi {
  transition: transform var(--transition-medium), box-shadow var(--transition-medium);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}
.kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.kpi::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle at top right, rgba(255,255,255,0.18), transparent 70%);
  pointer-events: none;
}

/* ===== Boutons : hover crispy ===== */
.btn {
  transition: background var(--transition-fast), border-color var(--transition-fast),
              transform var(--transition-fast), box-shadow var(--transition-fast);
}
.btn:active { transform: translateY(1px); }
.btn.primary:hover { box-shadow: 0 4px 14px rgba(27, 45, 92, 0.25); }

/* État loading sur boutons */
.btn[data-loading="true"] {
  opacity: 0.7;
  cursor: wait;
  pointer-events: none;
  position: relative;
  padding-right: 36px;
}
.btn[data-loading="true"]::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 14px; height: 14px;
  margin-top: -7px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: v30-spin 0.6s linear infinite;
}
@keyframes v30-spin { to { transform: rotate(360deg); } }

/* ===== Sidebar : navigation polish ===== */
.sidebar-nav a {
  transition: background var(--transition-fast), border-left-color var(--transition-fast),
              padding-left var(--transition-fast), color var(--transition-fast);
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,0.06);
  padding-left: 22px;
}
.sidebar-nav a.active,
.sidebar-nav a[aria-current="page"] {
  background: rgba(90, 169, 255, 0.12);
  border-left-color: var(--electric);
}

/* ===== Toast queue (V30) ===== */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 380px;
}
.toast {
  pointer-events: auto;
  background: var(--blanc);
  color: var(--gris-dark);
  padding: 12px 14px 12px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--electric);
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  opacity: 0;
  transform: translateX(20px);
  animation: v30-toast-in 220ms cubic-bezier(0.2, 0, 0, 1) forwards;
  position: relative;
}
.toast.is-leaving { animation: v30-toast-out 200ms cubic-bezier(0.4, 0, 1, 1) forwards; }
.toast.success { border-left-color: var(--vert); }
.toast.error   { border-left-color: var(--rouge); }
.toast.warn    { border-left-color: var(--orange); }
.toast.info    { border-left-color: var(--electric); }
.toast .icon { font-size: 16px; line-height: 1; flex: 0 0 auto; margin-top: 1px; }
.toast .body { flex: 1 1 auto; }
.toast .close {
  background: transparent; border: none; color: var(--gris-text);
  cursor: pointer; padding: 0 4px; font-size: 16px; line-height: 1;
  align-self: flex-start; opacity: 0.5;
}
.toast .close:hover { opacity: 1; }
@keyframes v30-toast-in {
  to { opacity: 1; transform: translateX(0); }
}
@keyframes v30-toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

/* ===== Cmd+K palette ===== */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 23, 51, 0.55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  animation: v30-cmdk-fade 200ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes v30-cmdk-fade { from { opacity: 0; } to { opacity: 1; } }
.cmdk-panel {
  width: min(640px, 92vw);
  background: var(--blanc);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  animation: v30-cmdk-pop 240ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes v30-cmdk-pop { from { opacity: 0; transform: scale(0.96) translateY(-8px); } to { opacity: 1; transform: scale(1); } }
.cmdk-input {
  border: none;
  outline: none;
  padding: 16px 18px 16px 48px;
  font-size: 16px;
  color: var(--gris-dark);
  background: transparent url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231B2D5C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") 16px 50% no-repeat;
  border-bottom: 1px solid var(--gris-border);
  width: 100%;
}
.cmdk-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.cmdk-empty {
  padding: 28px;
  text-align: center;
  color: var(--gris-text);
  font-size: 13px;
}
.cmdk-section-label {
  padding: 8px 18px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gris-text);
  font-weight: 700;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.cmdk-item:hover, .cmdk-item.is-active {
  background: var(--gris-bg);
}
.cmdk-item .kind {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--bleu-soft);
  color: var(--bleu);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}
.cmdk-item .text {
  flex: 1 1 auto;
  min-width: 0;
}
.cmdk-item .text .title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gris-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmdk-item .text .sub {
  font-size: 11px;
  color: var(--gris-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmdk-item .meta {
  font-size: 10px;
  color: var(--gris-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cmdk-footer {
  border-top: 1px solid var(--gris-border);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--gris-text);
}
.cmdk-key {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--gris-border);
  background: var(--gris-bg);
  font-family: monospace;
  font-size: 10px;
  margin: 0 2px;
}

/* ===== Call360 drawer (overlay côté droit) ===== */
.call360-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 23, 51, 0.45);
  backdrop-filter: blur(2px);
  z-index: 9500;
  animation: v30-cmdk-fade 200ms;
}
.call360-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: min(520px, 95vw);
  background: var(--blanc);
  box-shadow: var(--shadow-xl);
  z-index: 9501;
  display: flex;
  flex-direction: column;
  animation: v30-call360-in 280ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes v30-call360-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.call360-drawer.is-leaving { animation: v30-call360-out 220ms cubic-bezier(0.4, 0, 1, 1) forwards; }
@keyframes v30-call360-out { to { transform: translateX(100%); } }

.call360-header {
  background: linear-gradient(135deg, var(--bleu-deep) 0%, var(--bleu) 100%);
  color: var(--blanc);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.call360-header .ring {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex: 0 0 auto;
  border: 2px solid rgba(255,255,255,0.3);
  animation: v30-ring-pulse 1.4s ease-in-out infinite;
}
.call360-header.is-active .ring { animation: v30-ring-pulse 1.4s ease-in-out infinite; }
@keyframes v30-ring-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35); }
  50%      { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); }
}
.call360-header .who {
  flex: 1 1 auto;
  min-width: 0;
}
.call360-header .who .nm { font-size: 18px; font-weight: 700; line-height: 1.2; }
.call360-header .who .ph { font-size: 13px; opacity: 0.85; margin-top: 2px; }
.call360-header .who .tg { font-size: 11px; opacity: 0.7; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.call360-header .close-btn {
  background: transparent;
  border: none;
  color: var(--blanc);
  font-size: 22px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}
.call360-header .close-btn:hover { opacity: 1; }

.call360-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px 24px;
}
.call360-body section { margin-bottom: 22px; }
.call360-body h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gris-text);
  margin-bottom: 8px;
  font-weight: 700;
}
.call360-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--gris-border);
  font-size: 13px;
}
.call360-row:last-child { border-bottom: 0; }
.call360-row .k { color: var(--gris-text); }
.call360-row .v { font-weight: 600; color: var(--gris-dark); }
.call360-tl-item {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--gris-border);
}
.call360-tl-item:last-child { border-bottom: 0; }
.call360-tl-item .ts { flex: 0 0 80px; color: var(--gris-text); font-variant-numeric: tabular-nums; }
.call360-tl-item .what { flex: 1 1 auto; color: var(--gris-dark); }
.call360-tl-item .badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; }

.call360-actions {
  border-top: 1px solid var(--gris-border);
  padding: 14px 20px;
  display: flex;
  gap: 10px;
  background: var(--gris-bg);
}
.call360-actions .btn { flex: 1 1 auto; }

/* Empty state */
.call360-empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--gris-text);
  font-size: 13px;
}
.call360-empty .icon { font-size: 36px; opacity: 0.4; margin-bottom: 8px; }

/* ===== Skeletons ===== */
.skeleton {
  display: inline-block;
  background: linear-gradient(90deg, #ECEFF5 0%, #F5F6FA 50%, #ECEFF5 100%);
  background-size: 200% 100%;
  animation: v30-skeleton 1.4s ease-in-out infinite;
  border-radius: 4px;
  height: 12px;
}
@keyframes v30-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Form fields hover/focus polish ===== */
input[type="text"], input[type="search"], input[type="email"], input[type="tel"],
input[type="number"], input[type="date"], input[type="time"], select, textarea {
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
input[type="text"]:focus, input[type="search"]:focus, input[type="email"]:focus, input[type="tel"]:focus,
input[type="number"]:focus, input[type="date"]:focus, input[type="time"]:focus, select:focus, textarea:focus {
  border-color: var(--electric) !important;
  box-shadow: 0 0 0 3px rgba(90, 169, 255, 0.18);
  outline: none;
}

/* ===== Tooltip helper (data-tip attribute) ===== */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bleu-deep);
  color: var(--blanc);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 100;
}
[data-tip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Topbar : recherche prompt ===== */
.topbar-search-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 28px;
  border-radius: 8px;
  background: var(--gris-bg);
  border: 1px solid var(--gris-border);
  color: var(--gris-text);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235A6072' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");
  background-repeat: no-repeat;
  background-position: 10px 50%;
}
.topbar-search-hint:hover {
  background-color: var(--blanc);
  border-color: var(--electric);
  color: var(--gris-dark);
}
