/* ═══════════════════════════════════════════════════════════════════════════
   theme.css — OLED Dark Premium Design Tokens & Animations
   Bot Control v3
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Surfaces */
  --bg-deep:      #0a0a0f;
  --bg-base:      #0f0f17;
  --bg-elevated:  #161622;
  --bg-overlay:   #1c1c2a;
  --bg-glass:     rgba(22, 22, 34, 0.75);
  --bg-main:      var(--bg-deep);
  --bg-sidebar:   var(--bg-elevated);
  --bg-card:      var(--bg-overlay);
  --bg-card-hover: rgba(28, 28, 42, 0.85);
  --bg-input:     rgba(255, 255, 255, 0.04);

  /* Text */
  --text-primary:    #e0e0e8;
  --text-secondary:  #a0a0b0;
  --text-muted:      #6b6b80;
  --text-inverse:    #0a0a0f;

  /* Accent (primary) */
  --accent-primary:  #6366f1;
  --accent-hover:    #818cf8;
  --accent-subtle:   rgba(99, 102, 241, 0.12);
  --accent-glow:     rgba(99, 102, 241, 0.35);
  --primary:         var(--accent-primary);
  --primary-glow:    rgba(99, 102, 241, 0.50);
  --primary-muted:   var(--accent-subtle);
  --accent:          var(--accent-primary);
  --accent-soft:     rgba(99, 102, 241, 0.08);

  /* Accent (extended palette) */
  --accent-cyan:       #06b6d4;
  --accent-cyan-glow:  rgba(6, 182, 212, 0.35);
  --accent-emerald:    #10b981;
  --accent-purple:     #a855f7;

  /* Semantic */
  --success:       #22c55e;
  --success-muted: rgba(34, 197, 94, 0.12);
  --warning:       #f59e0b;
  --warning-muted: rgba(245, 158, 11, 0.12);
  --danger:        #ef4444;
  --danger-muted:  rgba(239, 68, 68, 0.12);
  --info:          #3b82f6;

  /* Borders */
  --border-subtle:   1px solid rgba(255, 255, 255, 0.06);
  --border-medium:   1px solid rgba(255, 255, 255, 0.10);
  --border-default:  var(--border-medium);
  --border-strong:   1px solid rgba(255, 255, 255, 0.15);
  --glass-border:        1px solid rgba(255, 255, 255, 0.08);
  --glass-border-hover:  1px solid rgba(255, 255, 255, 0.14);

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md:   0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg:   0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-xl:   0 12px 48px rgba(0, 0, 0, 0.7);
  --shadow-glow:         0 0 20px var(--accent-glow);
  --shadow-glow-primary: 0 0 24px var(--primary-glow);
  --glass-shadow:        0 8px 32px rgba(0, 0, 0, 0.4);
  --glass-blur:          20px;

  /* Radii */
  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    16px;
  --radius-xl:    24px;
  --radius-2xl:   32px;
  --radius-bento: 20px;
  --radius-full:  9999px;

  /* Spacing */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;

  /* Typography */
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   400ms ease;

  /* Layout */
  --sidebar-width: 260px;

  /* Z-indices */
  --z-sidebar:   100;
  --z-dropdown:  200;
  --z-context:   300;
  --z-modal:     400;
  --z-toast:     500;
  --z-cursor:    999999;

  /* Shimmer */
  --shimmer: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

/* ── Global Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ── Selection ── */
::selection {
  background: rgba(99, 102, 241, 0.35);
  color: #fff;
}
::-moz-selection {
  background: rgba(99, 102, 241, 0.35);
  color: #fff;
}

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ── Animations ── */
@keyframes fadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes fadeInUp {
  0%   { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  0%   { opacity: 0; transform: translateY(-12px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  0%   { opacity: 0; transform: scale(0.94); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes slideInRight {
  0%   { opacity: 0; transform: translateX(16px); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
  0%   { opacity: 0; transform: translateX(-16px); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px var(--accent-glow); }
  50%      { box-shadow: 0 0 24px var(--accent-glow); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
@keyframes border-glow {
  0%, 100% { border-color: rgba(99, 102, 241, 0.3); }
  50%      { border-color: rgba(99, 102, 241, 0.7); }
}
@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes modalIn {
  0%   { opacity: 0; transform: scale(0.96) translateY(12px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes rowIn {
  0%   { opacity: 0; transform: translateX(-8px); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes menuIn {
  0%   { opacity: 0; transform: scale(0.96) translateY(-6px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes menuOut {
  0%   { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(0.96) translateY(-6px); }
}

/* ── Resource Tree Items ── */
.resource-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 8px;
  border: none;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--text-secondary, #a0a0b0);
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast, 150ms), color var(--transition-fast, 150ms);
  white-space: nowrap;
}
.resource-tree-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary, #e0e0e8);
}
.resource-tree-item--active,
.resource-tree-item--active:hover {
  background: rgba(99, 102, 241, 0.18);
  color: var(--text-primary, #e0e0e8);
}
.resource-tree-item svg {
  flex-shrink: 0;
  color: inherit;
  opacity: 0.7;
}
.resource-tree-item__name {
  overflow: hidden;
  text-overflow: ellipsis;
}
.resource-tree-children {
  /* children inherit indentation from parent items' &nbsp; padding */
}

/* ── Filter-box content reveal (details[open]) ── */
@keyframes detailsReveal {
  0%   { opacity: 0; max-height: 0; transform: translateY(-8px); }
  100% { opacity: 1; max-height: 600px; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAGNETIC CURSOR BASE STYLES (element is created by magnetic-cursor.js)
   ═══════════════════════════════════════════════════════════════════════════ */

#magneticCursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: var(--z-cursor);
  will-change: transform, width, height, border-radius, background, border;
  opacity: 0;
  transition: opacity 0.15s ease;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTON / INTERACTIVE BASE POLISH
   ═══════════════════════════════════════════════════════════════════════════ */

button, .btn {
  transition: all var(--transition-fast, 150ms);
}

button:active:not(:disabled),
.btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* ── Shimmer button ── */
.btn--shimmer {
  position: relative;
  overflow: hidden;
}
.btn--shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  pointer-events: none;
}
