/* =========================================================
   GhostFlow Design System
   ========================================================= */

/* ── Theme-Variablen ─────────────────────────────────────── */
:root {
  --gf-bg:             #f9f8ff;
  --gf-bg-card:        rgba(255, 255, 255, 0.82);
  --gf-bg-card-hover:  rgba(255, 255, 255, 0.97);
  --gf-border:         rgba(139, 92, 246, 0.13);
  --gf-border-hover:   rgba(139, 92, 246, 0.30);
  --gf-text:           #1e1b4b;
  --gf-text-2:         #5b21b6;
  --gf-text-muted:     #4a3f7a;
  --gf-text-faint:     #6b5ea8;
  --gf-sidebar-bg:     rgba(255, 255, 255, 0.72);
  --gf-nav-hover:      rgba(139, 92, 246, 0.09);
  --gf-nav-active:     rgba(139, 92, 246, 0.16);
  --gf-nav-active-txt: #6d28d9;
  --gf-glow-1:         rgba(167, 139, 250, 0.07);
  --gf-glow-2:         rgba(232, 121, 249, 0.04);
  --gf-grid:           rgba(139, 92, 246, 0.03);
  --gf-scrollbar:      rgba(139, 92, 246, 0.20);
  --gf-input-bg:       rgba(255,255,255,0.9);
  --gf-input-border:   rgba(139,92,246,0.20);
  --gf-tag-open:       rgba(245, 158, 11, 0.12);
  --gf-tag-open-txt:   #92400e;
  --gf-tag-done:       rgba(16, 185, 129, 0.12);
  --gf-tag-done-txt:   #065f46;
  --gf-tag-called:     rgba(99, 102, 241, 0.12);
  --gf-tag-called-txt: #3730a3;
}

.dark {
  --gf-bg:             #1a1a2e;
  --gf-bg-card:        rgba(28, 28, 48, 0.80);
  --gf-bg-card-hover:  rgba(34, 34, 58, 0.96);
  --gf-border:         rgba(167, 139, 250, 0.12);
  --gf-border-hover:   rgba(167, 139, 250, 0.28);
  --gf-text:           #e8e6f4;
  --gf-text-2:         #c4b5fd;
  --gf-text-muted:     #a8a8bc;
  --gf-text-faint:     #7a7a94;
  --gf-sidebar-bg:     rgba(22, 22, 40, 0.92);
  --gf-nav-hover:      rgba(167, 139, 250, 0.08);
  --gf-nav-active:     rgba(167, 139, 250, 0.15);
  --gf-nav-active-txt: #c4b5fd;
  --gf-glow-1:         rgba(167, 139, 250, 0.10);
  --gf-glow-2:         rgba(232, 121, 249, 0.06);
  --gf-grid:           rgba(167, 139, 250, 0.025);
  --gf-scrollbar:      rgba(167, 139, 250, 0.18);
  --gf-input-bg:       rgba(14,14,26,0.6);
  --gf-input-border:   rgba(167,139,250,0.18);
  --gf-tag-open:       rgba(245, 158, 11, 0.14);
  --gf-tag-open-txt:   #fcd34d;
  --gf-tag-done:       rgba(16, 185, 129, 0.14);
  --gf-tag-done-txt:   #6ee7b7;
  --gf-tag-called:     rgba(99, 102, 241, 0.14);
  --gf-tag-called-txt: #a5b4fc;
}

/* ── Utilities ───────────────────────────────────────────── */
.gf-bg   { background-color: var(--gf-bg); }
.gf-card {
  background: var(--gf-bg-card);
  border: 1px solid var(--gf-border);
  border-radius: 12px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.gf-card:hover { border-color: var(--gf-border-hover); }
.gf-text       { color: var(--gf-text); }
.gf-text-2     { color: var(--gf-text-2); }
.gf-text-muted { color: var(--gf-text-muted); }
.gf-text-faint { color: var(--gf-text-faint); }

.gf-input {
  background: var(--gf-input-bg);
  border: 1px solid var(--gf-input-border);
  color: var(--gf-text);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-family: 'DM Mono', monospace;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}
.gf-input:focus { border-color: #a78bfa; }

/* ── Sidebar ─────────────────────────────────────────────── */
.gf-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100dvh;
  width: 232px;
  background: var(--gf-sidebar-bg);
  border-right: 1px solid var(--gf-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 0.25s ease;
}

.gf-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 39;
}

.gf-main {
  margin-left: 232px;
  min-height: 100dvh;
}

@media (max-width: 768px) {
  .gf-sidebar { transform: translateX(-100%); }
  .gf-sidebar.open { transform: translateX(0); }
  .gf-sidebar-overlay.open { display: block; }
  .gf-main { margin-left: 0; }
}

/* Nav items */
.gf-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: 'DM Mono', monospace;
  color: var(--gf-text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  margin: 0 0.5rem;
}
.gf-nav-item:hover {
  background: var(--gf-nav-hover);
  color: var(--gf-text);
}
.gf-nav-item.active {
  background: var(--gf-nav-active);
  color: var(--gf-nav-active-txt);
}
.gf-nav-item svg { flex-shrink: 0; }

/* ── Status Tags ─────────────────────────────────────────── */
.gf-tag-open    { background: var(--gf-tag-open);   color: var(--gf-tag-open-txt);   }
.gf-tag-called  { background: var(--gf-tag-called); color: var(--gf-tag-called-txt); }
.gf-tag-done    { background: var(--gf-tag-done);   color: var(--gf-tag-done-txt);   }
.gf-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.6rem;
  font-family: 'DM Mono', monospace;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* ── Calendar ────────────────────────────────────────────── */
.gf-cal-day {
  height: 160px;
  overflow: hidden;
  border: 1px solid var(--gf-border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--gf-bg-card);
  transition: border-color 0.15s;
}
.gf-cal-day:hover { border-color: var(--gf-border-hover); }
.gf-cal-day.today {
  border-color: #a78bfa;
  background: var(--gf-nav-active);
}
.gf-cal-day.empty {
  background: transparent;
  border-color: transparent;
}
.gf-cal-event {
  font-size: 0.72rem;
  font-family: 'DM Mono', monospace;
  padding: 3px 7px;
  border-radius: 4px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: white;
  display: block;
}

/* ── Custom Cursor ───────────────────────────────────────── */
@media (pointer: fine) {
  body { cursor: none; }
  a, button, label, input[type="radio"], input[type="checkbox"], [role="button"] { cursor: none; }
  input[type="text"], input[type="url"], input[type="email"], input[type="password"], textarea, select { cursor: text; }
}
#gf-cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 6px; height: 6px;
  background: #a78bfa;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px 2px rgba(167,139,250,0.7);
  transition: opacity 0.2s;
}
#gf-cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 32px; height: 32px;
  border: 1.5px solid rgba(167,139,250,0.65);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99998;
  transform: translate(-50%, -50%);
  transition: width 0.18s ease, height 0.18s ease, border-color 0.18s ease, opacity 0.2s;
}
#gf-cursor-ring.expanded {
  width: 48px; height: 48px;
  border-color: rgba(167,139,250,0.9);
}

/* ── Logout Warning Modal ────────────────────────────────── */
#gf-logout-warning {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
#gf-logout-warning.visible { display: flex; }
#gf-logout-warning .gf-modal {
  background: var(--gf-bg-card);
  border: 1px solid var(--gf-border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 360px;
  width: 90%;
  text-align: center;
  backdrop-filter: blur(24px);
}

/* ── Overrides for existing dashboard (dark-only classes → theme-aware) ──── */
body {
  background-color: var(--gf-bg) !important;
  color: var(--gf-text);
}

/* ── Rest of original styles ─────────────────────────────── */
html { scroll-behavior: smooth; }
body { font-family: 'DM Mono', ui-monospace, monospace; }
.font-display, h1, h2, h3, .font-sans { font-family: 'Unbounded', system-ui, sans-serif !important; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gf-scrollbar); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(167,139,250,0.36); }

.htmx-swapping { opacity: 0; transition: opacity 150ms ease; }
.htmx-settling  { opacity: 1; transition: opacity 150ms ease; }

.group:hover .stat-value { text-shadow: 0 0 20px rgba(167,139,250,0.3); }

.chrome-text {
  background: linear-gradient(135deg, #f0e6ff 0%, #c4b5fd 40%, #a78bfa 70%, #ddd6fe 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: chromaShift 6s ease-in-out infinite;
}
@keyframes chromaShift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

.glass {
  background: var(--gf-bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--gf-border);
  border-radius: 12px;
}

body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.gf-submit-btn {
  background: linear-gradient(135deg, #c4b5fd, #e879f9);
  box-shadow: 0 0 24px rgba(167,139,250,0.3);
  transition: box-shadow 0.3s ease, opacity 0.3s ease;
}
.gf-submit-btn:hover { box-shadow: 0 0 42px rgba(167,139,250,0.52); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid rgba(167,139,250,0.7);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
