:root {
  --bg-deep: #05070d;
  --bg-surface: #0a0e17;
  --bg-card: rgba(13, 19, 32, 0.75);
  --bg-card-hover: rgba(22, 30, 49, 0.85);
  --bg-input: rgba(8, 12, 22, 0.85);
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-glow: rgba(56, 189, 248, 0.35);
  --border-focus: #38bdf8;
  
  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-hud: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
  --blur-hud: blur(20px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background: radial-gradient(circle at 50% 0%, #0f172a 0%, var(--bg-deep) 80%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* TOPBAR RAYCAST COMPACT */
header {
  height: 58px;
  background: rgba(10, 14, 23, 0.75);
  backdrop-filter: var(--blur-hud);
  -webkit-backdrop-filter: var(--blur-hud);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, #fff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hud-shortcut-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 0.7rem;
  font-family: monospace;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
}

.view-nav {
  display: flex;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 3px;
}

.view-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.view-tab-btn:hover { color: #fff; }
.view-tab-btn.active {
  background: rgba(56, 189, 248, 0.18);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-studio-nav {
  text-decoration: none;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-studio-nav:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.pulse {
  width: 7px;
  height: 7px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* WORKSPACE LAYOUT (COPILOT / RAYCAST HUD) */
.hud-workspace {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  flex-grow: 1;
  padding: 18px 24px 24px 24px;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
  min-height: calc(100vh - 58px);
}

@media (max-width: 1040px) {
  .hud-workspace {
    grid-template-columns: 1fr;
    padding: 14px;
  }
}

/* ZONE DE CHAT PRINCIPALE (STYLE COPILOT) */
.hud-chat-column {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  backdrop-filter: var(--blur-hud);
  -webkit-backdrop-filter: var(--blur-hud);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hud);
  overflow: hidden;
  position: relative;
  height: calc(100vh - 100px);
}

.hud-chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(8, 12, 22, 0.4);
}

.hud-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
}

.hud-header-model-badge {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--accent-cyan);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 4px;
}

.hud-messages-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* BULLES DE CHAT ÉPURÉES RAYCAST */
.hud-bubble-user {
  align-self: flex-end;
  max-width: 78%;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.2), rgba(56, 189, 248, 0.12));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 16px 16px 3px 16px;
  padding: 12px 18px;
  color: #fff;
  font-size: 0.88rem;
  line-height: 1.5;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.hud-bubble-user .user-meta {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hud-bubble-ai {
  align-self: flex-start;
  max-width: 88%;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 16px 16px 16px 3px;
  padding: 14px 18px;
  color: var(--text-main);
  font-size: 0.88rem;
  line-height: 1.55;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.hud-bubble-ai .ai-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hud-bubble-ai .ai-author {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-bubble-ai .ai-tag {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 7px;
  border-radius: 4px;
}

/* PANNEAU DE SAISIE RAYCAST FLOTTANT */
.hud-input-panel {
  padding: 16px 20px;
  background: rgba(8, 12, 22, 0.7);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* PALETTE RAYCAST CHIPS (ACCÈS RAPIDE) */
.hud-quick-palette {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.hud-quick-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.hud-quick-chip:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #fff;
  transform: translateY(-1px);
}

/* RAYCAST COMMAND BAR INPUT */
.hud-input-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hud-input-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.25), inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.hud-mic-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.hud-mic-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #fff;
}

.hud-input-field {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
}

.hud-input-field::placeholder {
  color: var(--text-muted);
}

.hud-send-btn {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border: none;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
  transition: all 0.2s ease;
}

.hud-send-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.hud-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* WIDGETS LATÉRAUX (SIDEBAR RAYCAST COMPANION) */
.hud-sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: calc(100vh - 100px);
  overflow-y: auto;
}

.hud-side-widget {
  background: var(--bg-card);
  backdrop-filter: var(--blur-hud);
  -webkit-backdrop-filter: var(--blur-hud);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-hud);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hud-widget-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

/* MINI LECTEUR EN DIRECT DANS LA SIDEBAR */
.hud-player-mini {
  background: rgba(10, 15, 26, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-player-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-album-art {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f43f5e, #fb7185);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.3);
}

.hud-player-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-mini-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-mini-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* MINI SENTINELLE METRICS */
.hud-metric-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-metric-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.hud-progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.hud-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* RAYCAST MODAL DE COMMANDE RAPIDE (CTRL+K) */
#command-palette-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.command-palette-card {
  background: #090e18;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  animation: slide-down 0.18s ease-out;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.command-palette-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 20px;
  font-size: 1rem;
  color: #fff;
  outline: none;
}

.command-palette-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 8px;
}

.command-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.command-item:hover, .command-item.selected {
  background: rgba(56, 189, 248, 0.15);
  color: #fff;
}

.command-key {
  font-family: monospace;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
}

/* DASHBOARD VIEW (POUR ONGLET PLEIN ECRAN SYSTEME) */
.grid-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px 24px;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .grid-container { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-hud);
  -webkit-backdrop-filter: var(--blur-hud);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

/* SCROLLBAR MODERNE */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* CURSEUR DE STREAMING TOKEN PAR TOKEN */
@keyframes streamCursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.stream-cursor {
  animation: streamCursorBlink 0.75s infinite ease-in-out;
}
