/* DESIGN.md tokens — Dark Mode (Primary) */
:root {
  /* Backgrounds */
  --bg-deep: #0A0A0B;
  --bg-medium: #111114;
  --bg-surface: #17171B;
  --bg-elevated: #1E1E23;
  --bg-overlay: rgba(0,0,0,0.6);

  /* Foreground */
  --fg-primary: #EDEDEF;
  --fg-secondary: #A1A1AA;
  --fg-tertiary: #6B6B74;
  --fg-disabled: #3F3F46;
  --fg-inverse: #0A0A0B;

  /* Accents */
  --accent-primary: #7C5CFF;
  --accent-primary-hover: #8E72FF;
  --accent-primary-muted: rgba(124, 92, 255, 0.12);
  --accent-danger: #EF4444;
  --accent-danger-muted: rgba(239, 68, 68, 0.12);
  --accent-success: #22C55E;
  --accent-success-muted: rgba(34, 197, 94, 0.12);
  --accent-warning: #F59E0B;
  --accent-warning-muted: rgba(245, 158, 11, 0.12);
  --accent-info: #3B82F6;
  --accent-info-muted: rgba(59, 130, 246, 0.12);

  /* Borders */
  --border-subtle: #222228;
  --border-default: #2C2C33;
  --border-strong: #3A3A42;
  --border-focus: #7C5CFF;
  --separator: #1F1F25;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.45), 0 4px 8px rgba(0, 0, 0, 0.30);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.50), 0 12px 24px rgba(0, 0, 0, 0.40);
  --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.55), 0 24px 48px rgba(0, 0, 0, 0.45);

  /* Type */
  --font-ui: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "Consolas", monospace;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-ui);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--fg-primary);
}

body {
  background: #050507;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  color: inherit;
}

textarea {
  resize: none;
}

/* ============ DESKTOP BACKDROP (a fake video call to demonstrate transparency) ============ */
.desktop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, #1a1f2e 0%, #0b0d14 60%, #050608 100%);
  overflow: hidden;
}

.desktop-grid {
  position: absolute;
  inset: 40px 40px 80px 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
}

.tile {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.04);
}

.tile-name {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.45);
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.01em;
  backdrop-filter: blur(4px);
}

.tile-mic {
  position: absolute;
  right: 14px;
  bottom: 12px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: rgba(0,0,0,0.45);
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.9);
  backdrop-filter: blur(4px);
}

.tile-self {
  background: linear-gradient(135deg, #2a2440 0%, #1a1530 100%);
}
.tile-self::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 38%, #4a3d6e 0%, transparent 35%),
    radial-gradient(circle at 50% 75%, #2c2347 0%, transparent 50%);
}

.tile-client {
  background: linear-gradient(135deg, #1a3340 0%, #0e1f2a 100%);
}
.tile-client::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 52% 42%, #2d5566 0%, transparent 32%),
    radial-gradient(circle at 50% 80%, #1a3340 0%, transparent 55%);
}

.tile-share {
  grid-column: 1 / span 2;
  background: #f4f4f0;
  display: flex;
  flex-direction: column;
}
.share-titlebar {
  height: 28px;
  background: #e8e6e0;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  border-bottom: 1px solid #d8d6d0;
}
.share-titlebar .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #c4c0b8;
}
.share-content {
  flex: 1;
  padding: 24px 32px;
  color: #2a2a2a;
  font-family: var(--font-ui);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}
.share-content h2 {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: -0.01em;
}
.share-content p {
  font-size: 13px;
  line-height: 19px;
  color: #555;
  max-width: 540px;
}
.share-diagram {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.share-box {
  border: 1.5px solid #b8b4ab;
  background: #fff;
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 11px;
  color: #444;
  font-family: var(--font-mono);
}

.taskbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 40px;
  background: rgba(20, 20, 24, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
}
.taskbar-icon {
  width: 28px; height: 28px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.55);
}
.taskbar-spacer { flex: 1; }
.taskbar-clock {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1.3;
}

/* Meeting toolbar floating at bottom of share */
.meet-toolbar {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28, 28, 32, 0.92);
  backdrop-filter: blur(10px);
  border-radius: 28px;
  padding: 8px 12px;
  display: flex;
  gap: 6px;
  border: 1px solid rgba(255,255,255,0.06);
}
.meet-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  display: grid; place-items: center;
  color: rgba(255,255,255,0.85);
}
.meet-btn.danger {
  background: var(--accent-danger);
  width: 56px;
}

/* ============ FLOATING COPILOT WINDOW ============ */
.copilot-shell {
  position: fixed;
  width: 480px;
  height: 720px;
  z-index: 100;
}

.copilot-window {
  width: 100%;
  height: 100%;
  /* DESIGN.md radius.xl = 12px — reinforced visually for floating window */
  border-radius: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background 180ms ease-out, border-color 180ms ease-out;
}

/* Transparency tiers per DESIGN.md §10 */
.copilot-window[data-opacity-tier="full"] {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
}
.copilot-window[data-opacity-tier="medium"] {
  background: rgba(30, 30, 35, 0.85);
  border-color: var(--border-default);
  backdrop-filter: blur(20px);
}
.copilot-window[data-opacity-tier="low"] {
  background: rgba(30, 30, 35, 0.68);
  border-color: var(--border-default);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-xl), inset 0 0 0 1px var(--border-subtle);
}

/* ============ ZONE 1 — HEADER ============ */
.zone-header {
  height: 60px;
  flex-shrink: 0;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--separator);
  -webkit-app-region: drag; /* Tauri drag region semantic */
}

.rec-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-danger);
  position: relative;
  flex-shrink: 0;
}
.rec-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--accent-danger);
  opacity: 0.4;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(2.2); opacity: 0; }
}

.rec-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-primary);
  letter-spacing: 0;
}

.rec-time {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-secondary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.header-center {
  display: flex;
  gap: 6px;
  margin-left: auto;
  margin-right: auto;
}

.toggle-pill {
  -webkit-app-region: no-drag;
  height: 22px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  letter-spacing: 0;
  border: 1px solid transparent;
  transition: all 120ms ease;
  white-space: nowrap;
}
.toggle-pill[data-on="true"] {
  background: var(--accent-success-muted);
  color: var(--accent-success);
}
.toggle-pill[data-on="false"] {
  background: transparent;
  color: var(--fg-tertiary);
  border-color: var(--border-default);
}
.toggle-pill .pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

.header-right {
  display: flex;
  gap: 4px;
  align-items: center;
}

.icon-btn {
  -webkit-app-region: no-drag;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  color: var(--fg-secondary);
  transition: background 120ms ease, color 120ms ease;
}
.icon-btn:hover {
  background: var(--accent-primary-muted);
  color: var(--fg-primary);
}
.icon-btn.active {
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
}

/* ============ ZONE 2 — DETECTED QUESTION ============ */
.zone-question {
  height: 100px;
  flex-shrink: 0;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid var(--separator);
}

.zone-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 16px;
}

.q-textarea-wrap {
  flex: 1;
  position: relative;
  display: flex;
}
.q-textarea {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 13px;
  line-height: 18px;
  color: var(--fg-primary);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  font-feature-settings: "cv11", "ss01";
}
.q-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

.q-reanalyze {
  position: absolute;
  right: 6px;
  bottom: 6px;
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  color: var(--fg-secondary);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}
.q-textarea-wrap:focus-within .q-reanalyze,
.q-textarea-wrap.dirty .q-reanalyze {
  opacity: 1;
  pointer-events: auto;
}
.q-reanalyze:hover {
  background: var(--accent-primary-muted);
  color: var(--fg-primary);
  border-color: var(--border-strong);
}

/* ============ ZONE 3 — ANSWER (TO SAY) ============ */
.zone-answer {
  height: 180px;
  flex-shrink: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--separator);
  position: relative;
}
.zone-answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.zone-answer-head .icons {
  display: flex; gap: 2px;
}
.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-success-muted);
  color: var(--accent-success);
}
.confidence-badge .conf-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-success);
}

.answer-text {
  font-size: 16px;
  line-height: 24px;
  color: var(--fg-primary);
  font-weight: 400;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}

/* ============ ZONE 4 — TECHNICAL NOTE ============ */
.zone-note {
  height: 220px;
  flex-shrink: 0;
  background: var(--bg-surface);
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--separator);
  border-top: 1px solid var(--separator);
}

.note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.note-label-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  background: var(--border-subtle);
  color: var(--fg-secondary);
}

.note-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 2px 0 0 0;
}
.note-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 18px;
  color: var(--fg-primary);
}
.note-bullet {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--fg-tertiary);
  margin-top: 7px;
  flex-shrink: 0;
}
.note-key {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-primary);
  background: var(--accent-primary-muted);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: 0;
}
.note-text {
  color: var(--fg-secondary);
}

/* ============ ZONE 5 — ACTION BUTTONS ============ */
.zone-actions {
  height: 90px;
  flex-shrink: 0;
  padding: 6px 16px 10px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  border-bottom: 1px solid var(--separator);
}

.action-btn {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-secondary);
  background: transparent;
  border: 1px solid transparent;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  white-space: nowrap;
  letter-spacing: 0;
}
.action-btn:hover {
  background: var(--accent-primary-muted);
  color: var(--fg-primary);
}
.action-btn:active {
  transform: scale(0.98);
}
.action-btn.engaged {
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}
.action-btn .icon {
  flex-shrink: 0;
  color: currentColor;
  opacity: 0.85;
}

/* ============ ZONE 6 — FOOTER ============ */
.zone-footer {
  height: 50px;
  flex-shrink: 0;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-medium);
}

.opacity-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.opacity-control .icon-eye {
  color: var(--fg-tertiary);
}
.opacity-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 78px;
  height: 4px;
  background: var(--border-default);
  border-radius: 9999px;
  outline: none;
}
.opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.opacity-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 4px var(--accent-primary-muted), var(--shadow-sm);
}
.opacity-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-secondary);
  font-variant-numeric: tabular-nums;
  width: 30px;
}

/* Segmented control */
.segmented {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 0;
  height: 26px;
  margin-left: auto;
}
.seg-btn {
  height: 20px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-secondary);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  transition: all 120ms ease;
  letter-spacing: 0;
}
.seg-btn:hover {
  color: var(--fg-primary);
}
.seg-btn[data-active="true"] {
  background: var(--bg-elevated);
  color: var(--fg-primary);
  box-shadow: var(--shadow-sm);
}

.footer-clear {
  height: 26px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-secondary);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 120ms ease, color 120ms ease;
}
.footer-clear:hover {
  background: var(--accent-primary-muted);
  color: var(--fg-primary);
}

/* Toast */
.toast-stack {
  position: fixed;
  bottom: 60px;
  right: 24px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-info);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--fg-primary);
  width: 280px;
  animation: toast-in 200ms ease-out;
}
.toast.success { border-left-color: var(--accent-success); }
.toast.success .toast-icon { color: var(--accent-success); }
.toast.info .toast-icon { color: var(--accent-info); }
.toast .toast-icon { flex-shrink: 0; }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Hint */
.hint {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-family: var(--font-mono);
  letter-spacing: 0;
  z-index: 50;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hint kbd {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.7);
}


/* === BEGIN PROTO-BACK (botón "volver al índice" — solo prototipo) === */
.proto-back {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  background: rgba(28, 28, 30, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--fg-secondary);
  font-size: 11px;
  text-decoration: none;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.proto-back:hover {
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}
/* === END PROTO-BACK === */

/* === BEGIN APP-HEADER NAVIGATION (auto) === */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 56px;
  border-bottom: 1px solid var(--separator);
  background: var(--bg-medium);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
}
.app-brand { display: flex; align-items: center; }
.app-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--fg-primary);
  font-weight: 600;
  font-size: 14px;
  transition: color 120ms ease;
}
.app-logo:hover { color: var(--accent-primary); }
.app-mark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--accent-primary-muted);
  border: 1px solid rgba(124,92,255,0.25);
  display: grid;
  place-items: center;
  color: var(--accent-primary);
}
.app-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 24px;
}
.nav-link {
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--fg-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: background 120ms ease, color 120ms ease;
}
.nav-link:hover {
  background: var(--accent-primary-muted);
  color: var(--fg-primary);
}
.nav-link.active {
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
  font-weight: 500;
}
.app-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Reserva 56px arriba en pantallas con la nav global */
body.has-app-nav {
  padding-top: 56px;
  overflow: hidden;
}
body.has-app-nav > #root {
  height: calc(100vh - 56px);
  position: relative;
  overflow: hidden;
}
/* === END APP-HEADER NAVIGATION (auto) === */
