/* Base2ace Technologies - DSA Roadmap & Education Stylesheet
   Aligned with ds-interactive Design System, Header Navigation, and Footer
*/

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   1. Design System & CSS Variables (Matching ds-interactive)
   ========================================================================== */
:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-code: 'JetBrains Mono', Consolas, Monaco, monospace;

  /* Color Palette - Premium Dark Theme (Matching ds-interactive) */
  --bg-main: #0b0f19;
  --bg-card: rgba(18, 26, 43, 0.75);
  --bg-card-hover: rgba(26, 37, 61, 0.85);
  --bg-surface: #131c2e;
  --bg-surface-border: rgba(255, 255, 255, 0.08);
  --bg-glass: rgba(15, 23, 42, 0.85);
  --bg-input: #111827;
  --bg-code: #090d16;
  --bg-pane: #111827;
  --bg-badge: rgba(255, 255, 255, 0.06);

  /* Brand Accents */
  --primary: #3b82f6;        /* Electric Blue */
  --primary-glow: rgba(59, 130, 246, 0.4);
  --secondary: #06b6d4;      /* Cyan */
  --secondary-glow: rgba(6, 182, 212, 0.3);
  --accent-purple: #8b5cf6;  /* Purple Accent */
  
  /* Status Colors */
  --accent-amber: #f59e0b;   /* Medium Difficulty */
  --accent-green: #10b981;   /* Easy Difficulty */
  --accent-red: #ef4444;     /* Hard Difficulty */

  /* Text Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;

  --easy-color: #10b981;
  --easy-bg: rgba(16, 185, 129, 0.15);
  --medium-color: #f59e0b;
  --medium-bg: rgba(245, 158, 11, 0.15);
  --hard-color: #ef4444;
  --hard-bg: rgba(239, 68, 68, 0.15);

  --company-bg: rgba(59, 130, 246, 0.12);
  --company-text: #93c5fd;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-glow: 0 0 25px var(--primary-glow);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;
}

[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-border: #e2e8f0;
  --bg-glass: rgba(255, 255, 255, 0.9);
  --bg-input: #f1f5f9;
  --bg-code: #1e293b;
  --bg-pane: #ffffff;
  --bg-badge: #e2e8f0;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --border-color: #e2e8f0;
  --border-focus: #2563eb;

  --primary: #2563eb;
  --secondary: #0891b2;
  --primary-glow: rgba(37, 99, 235, 0.15);

  --company-bg: #e0f2fe;
  --company-text: #0369a1;

  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   2. Base Resets & Global Styles
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Custom Scrollbars (Matching ds-interactive) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   3. Navbar & Header Navigation (Matching ds-interactive)
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--bg-surface-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.nav-container {
  max-width: 1800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  gap: 1rem;
}

.nav-brand-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.4));
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.brand-logo:hover .brand-logo-img {
  transform: scale(1.05);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--secondary);
  font-weight: 700;
}

/* Header Search */
.header-search {
  flex: 1;
  max-width: 480px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  pointer-events: none;
}

#search-input {
  width: 100%;
  padding: 9px 38px 9px 42px;
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-surface-border);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

#search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
}

.clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.clear-btn.hidden { display: none; }

/* Header Actions & Dropdowns */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.custom-select {
  padding: 0.5rem 0.85rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-surface-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.custom-select:hover, .custom-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-surface-border);
  background-color: var(--bg-surface);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.sun-icon { display: none; }
.moon-icon { display: inline; }
[data-theme="light"] .sun-icon { display: inline; }
[data-theme="light"] .moon-icon { display: none; }

.mobile-only { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
  text-decoration: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--bg-surface-border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--secondary);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

/* Progress Tracker Sub-Header */
.progress-bar-strip {
  background-color: rgba(11, 15, 25, 0.8);
  border-top: 1px solid var(--bg-surface-border);
  padding: 6px 1.5rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.percentage-pill {
  font-weight: 700;
  color: var(--secondary);
}

.progress-track {
  width: 100%;
  height: 5px;
  background-color: var(--bg-badge);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* ==========================================================================
   4. Main App Layout (Sidebar, Questions, Right Pane)
   ========================================================================== */
.app-layout {
  display: flex;
  flex: 1;
  position: relative;
  max-width: 1800px;
  width: 100%;
  margin: 0 auto;
}

/* Sidebar Navigation Drawer */
.sidebar {
  width: 280px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--bg-surface-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: calc(100vh - 110px);
  position: sticky;
  top: 110px;
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 1rem 1.25rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--bg-surface-border);
}

.sidebar-header h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.pattern-count-badge {
  font-size: 0.75rem;
  background-color: rgba(6, 182, 212, 0.12);
  color: var(--secondary);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.sidebar-search {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--bg-surface-border);
}

.sidebar-search input {
  width: 100%;
  padding: 6px 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--bg-surface-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.825rem;
  outline: none;
}

.sidebar-search input:focus {
  border-color: var(--primary);
}

.pattern-nav {
  flex: 1;
  padding: 0.5rem;
}

.pattern-nav ul {
  list-style: none;
}

.pattern-nav li {
  margin-bottom: 4px;
}

.pattern-nav a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.pattern-nav a:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.pattern-nav a.active {
  background: rgba(6, 182, 212, 0.12);
  color: var(--secondary);
  font-weight: 700;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.pattern-item-count {
  font-size: 0.75rem;
  opacity: 0.8;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 90;
}

/* Center Main Dashboard */
.main-content {
  flex: 1;
  padding: 2rem;
  min-width: 0;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--bg-surface-border);
  gap: 1rem;
}

.title-group h1 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.35rem;
}

.title-group p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.questions-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.text-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

.text-btn:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* Questions Cards */
.questions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.question-card {
  background-color: var(--bg-card);
  border: 1px solid var(--bg-surface-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  backdrop-filter: blur(12px);
  transition: var(--transition);
}

.question-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: var(--shadow-card);
}

.question-card.mastered {
  border-left: 4px solid var(--easy-color);
}

.question-header {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  gap: 1rem;
}

.question-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.master-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--easy-color);
  cursor: pointer;
}

.question-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.question-card.mastered .question-title {
  text-decoration: line-through;
  color: var(--text-dim);
}

.question-header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.leetcode-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background-color: rgba(59, 130, 246, 0.12);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.leetcode-link:hover {
  background-color: var(--primary);
  color: white;
  text-decoration: none;
}

/* Difficulty Badges */
.difficulty-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.difficulty-badge.Easy {
  color: var(--easy-color);
  background-color: var(--easy-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.difficulty-badge.Medium {
  color: var(--medium-color);
  background-color: var(--medium-bg);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.difficulty-badge.Hard {
  color: var(--hard-color);
  background-color: var(--hard-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.company-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.company-pill {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--company-text);
  background-color: var(--company-bg);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.visual-link-btn {
  font-size: 1.1rem;
  color: var(--text-muted);
  padding: 4px;
  transition: color var(--transition);
}

.visual-link-btn:hover { color: var(--primary); }

.chevron-icon {
  color: var(--text-dim);
  transition: transform var(--transition);
}

.question-card.open .chevron-icon {
  transform: rotate(180deg);
}

/* Accordion Body */
.solution-body {
  display: none;
  padding: 1.25rem;
  background-color: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--bg-surface-border);
}

.question-card.open .solution-body {
  display: block;
}

.section-block {
  margin-bottom: 1.25rem;
}

.section-block h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.problem-statement {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.65;
}

.example-box {
  background-color: var(--bg-code);
  border: 1px solid var(--bg-surface-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-family: var(--font-code);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  overflow-x: auto;
}

.explanation-text {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.solution-tabs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.tab-group {
  display: flex;
  gap: 4px;
  background-color: var(--bg-surface);
  padding: 3px;
  border-radius: var(--radius-md);
}

.lang-tab {
  padding: 4px 12px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.lang-tab.active {
  background-color: var(--primary);
  color: white;
}

.copy-code-btn {
  font-size: 0.8rem;
  font-weight: 600;
  background-color: var(--bg-badge);
  border: 1px solid var(--bg-surface-border);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.copy-code-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.code-wrapper {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
}

pre[class*="language-"] {
  margin: 0 !important;
  border-radius: var(--radius-md) !important;
  font-family: var(--font-code) !important;
  font-size: 0.85rem !important;
  line-height: 1.55 !important;
  padding: 1rem !important;
  background: var(--bg-code) !important;
}

.complexity-strip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--secondary);
}

/* ==========================================================================
   5. Right Pane - Cheat Sheet & Strategy
   ========================================================================== */
.right-pane {
  width: 380px;
  background-color: var(--bg-pane);
  border-left: 1px solid var(--bg-surface-border);
  height: calc(100vh - 110px);
  position: sticky;
  top: 110px;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.right-pane.collapsed { display: none; }

.right-pane-header {
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--bg-surface-border);
}

.right-pane-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.right-pane-body {
  padding: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.65;
}

.right-pane-body strong {
  color: var(--secondary);
}

.right-pane-body code {
  background-color: var(--bg-surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-code);
  font-size: 0.825rem;
}

.placeholder-text {
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  margin-top: 40px;
}

/* ==========================================================================
   6. Footer (Matching ds-interactive)
   ========================================================================== */
.footer {
  border-top: 1px solid var(--bg-surface-border);
  padding: 2.5rem 2rem;
  margin-top: 3rem;
  background: rgba(11, 15, 25, 0.95);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.footer-content {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--primary);
}

/* ==========================================================================
   7. Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1200px) {
  .right-pane { width: 320px; }
}

@media (max-width: 992px) {
  .mobile-only { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: var(--shadow-card);
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.active { display: block; }

  .app-layout { flex-direction: column; }

  .right-pane {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: var(--shadow-card);
  }

  .main-content { padding: 1.5rem 1rem; }
}

@media (max-width: 768px) {
  .nav-container {
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
  }

  .header-search {
    order: 3;
    max-width: 100%;
    width: 100%;
    margin-top: 4px;
  }

  .question-header {
    flex-direction: column;
    align-items: flex-start;
  }

}

/* ==========================================================================
   8. Universal Algorithm Visualizer Component
   ========================================================================== */
.viz-wrapper {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-surface-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.viz-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--bg-surface-border);
}

.viz-btn-group {
  display: flex;
  gap: 0.5rem;
}

.viz-btn {
  padding: 0.45rem 0.85rem;
  background-color: var(--bg-card);
  border: 1px solid var(--bg-surface-border);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.viz-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.viz-speed-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.viz-speed-select {
  background-color: var(--bg-input);
  border: 1px solid var(--bg-surface-border);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  outline: none;
}

.viz-custom-input-wrapper {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  max-width: 380px;
}

.viz-custom-input {
  flex: 1;
  padding: 0.4rem 0.75rem;
  background-color: var(--bg-input);
  border: 1px solid var(--bg-surface-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.825rem;
  outline: none;
}

.viz-custom-input:focus {
  border-color: var(--primary);
}

/* Visual Canvas & Element Boxes */
.viz-canvas {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-code);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  margin-bottom: 1rem;
}

.viz-array-container {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: center;
}

.viz-box-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.viz-pointer-tag {
  height: 24px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 24px;
}

.viz-array-box {
  width: 52px;
  height: 52px;
  background-color: var(--bg-surface);
  border: 2px solid var(--bg-surface-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-code);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  transition: all 0.25s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.viz-array-box.highlight-active {
  border-color: var(--secondary);
  background-color: rgba(6, 182, 212, 0.2);
  color: #ffffff;
  transform: translateY(-4px);
  box-shadow: 0 0 15px var(--secondary-glow);
}

.viz-array-box.highlight-success {
  border-color: var(--easy-color);
  background-color: rgba(16, 185, 129, 0.25);
  color: #ffffff;
  transform: translateY(-6px);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

.viz-index-label {
  margin-top: 6px;
  font-size: 0.75rem;
  font-family: var(--font-code);
  color: var(--text-dim);
}

/* Monotonic Stack Container */
.viz-stack-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.viz-stack-title {
  font-weight: 600;
}

.viz-stack-items {
  display: flex;
  gap: 6px;
}

.viz-stack-item {
  background-color: var(--bg-surface);
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-code);
  font-weight: 700;
  font-size: 0.85rem;
}

/* Narrative Log Box */
.viz-narrative-box {
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--bg-surface-border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}

.viz-variables-strip {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.viz-var-pill {
  font-size: 0.8rem;
  font-family: var(--font-code);
  background-color: var(--bg-input);
  border: 1px solid var(--bg-surface-border);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.viz-var-pill strong {
  color: var(--secondary);
}

.viz-log-text {
  font-size: 0.875rem;
  color: var(--text-main);
  line-height: 1.5;
}

/* Data-Structure Specific Visualizer Canvas Styles */
.viz-tree-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
}

.viz-tree-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.viz-tree-node {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--primary);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-code);
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
  position: relative;
}

.viz-tree-node.highlight-active {
  border-color: var(--secondary);
  background-color: rgba(6, 182, 212, 0.3);
  box-shadow: 0 0 15px var(--secondary-glow);
  transform: scale(1.15);
}

.viz-tree-node.highlight-success {
  border-color: var(--easy-color);
  background-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
  transform: scale(1.15);
}

/* Linked List Visualizer Styles */
.viz-ll-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.viz-ll-node {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface);
  border: 2px solid var(--bg-surface-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-code);
  font-weight: 700;
  color: var(--text-main);
}

.viz-ll-arrow {
  color: var(--primary);
  font-size: 1.2rem;
  font-weight: bold;
}

/* 2D Chessboard Grid Visualizer Styles */
.viz-grid-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-color: var(--bg-surface);
  border: 2px solid var(--bg-surface-border);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.viz-grid-row {
  display: flex;
  gap: 4px;
}

.viz-grid-cell {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-code);
  font-size: 1.25rem;
  font-weight: 800;
  border-radius: 4px;
  transition: all 0.25s ease;
  background-color: #1e293b;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.viz-grid-cell.cell-light {
  background-color: #334155;
}

.viz-grid-cell.cell-queen {
  background-color: rgba(6, 182, 212, 0.3);
  border: 2px solid var(--secondary);
  box-shadow: 0 0 15px var(--secondary-glow);
  color: #38bdf8;
  transform: scale(1.05);
}

.viz-grid-cell.cell-highlight {
  border: 2px solid var(--primary);
  background-color: rgba(59, 130, 246, 0.3);
}

.viz-grid-cell.cell-backtrack {
  border: 2px solid var(--hard-color);
  background-color: rgba(239, 68, 68, 0.25);
}

/* 2D DP Table Visualizer Styles */
.viz-dp-table {
  border-collapse: collapse;
  margin: 0 auto;
  font-family: var(--font-code);
}

.viz-dp-table th,
.viz-dp-table td {
  width: 44px;
  height: 44px;
  text-align: center;
  border: 1px solid var(--bg-surface-border);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  background-color: var(--bg-surface);
}

.viz-dp-table th {
  background-color: var(--bg-input);
  color: var(--secondary);
}

.viz-dp-table td.dp-active {
  border: 2px solid var(--secondary);
  background-color: rgba(6, 182, 212, 0.3);
  box-shadow: 0 0 15px var(--secondary-glow);
  color: #ffffff;
}

.viz-dp-table td.dp-match {
  border: 2px solid var(--easy-color);
  background-color: rgba(16, 185, 129, 0.35);
  color: #ffffff;
}

/* ==========================================================================
   Visitor Counter & Analytics Modal Component Styles
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 30px rgba(59, 130, 246, 0.15);
  padding: 2rem;
  transform: scale(0.95);
  transition: all 0.3s ease;
}

.modal-overlay.open .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #f8fafc;
}

.modal-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: #ef4444;
}

.visitor-live-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #10b981;
  animation: pulseGreen 1.8s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulseGreen {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 8px #10b981; }
  50% { opacity: 0.4; transform: scale(0.85); box-shadow: 0 0 2px #10b981; }
}

.nav-visitor-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 9999px;
  color: #f8fafc;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.nav-visitor-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: #3b82f6;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.nav-visitor-btn strong {
  font-family: monospace;
  color: #06b6d4;
}

.footer-visitor-counter {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
  padding: 0.4rem 0.9rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  font-size: 0.8rem;
  color: #94a3b8;
  transition: all 0.2s ease;
}

.footer-visitor-counter:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: #06b6d4;
  color: #f8fafc;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.footer-visitor-counter strong {
  font-family: monospace;
  color: #06b6d4;
  font-size: 0.9rem;
}

.visitor-footer-tag {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
  border-radius: 4px;
  font-weight: 600;
}

.visitor-analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.analytics-card {
  padding: 1rem 1.15rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.analytics-card.primary {
  border-color: rgba(59, 130, 246, 0.3);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(15, 23, 42, 0.7) 100%);
}

.analytics-card.cyan {
  border-color: rgba(6, 182, 212, 0.3);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(15, 23, 42, 0.7) 100%);
}

.analytics-card.purple {
  border-color: rgba(139, 92, 246, 0.3);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(15, 23, 42, 0.7) 100%);
}

.analytics-card.green {
  border-color: rgba(16, 185, 129, 0.3);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(15, 23, 42, 0.7) 100%);
}

.analytics-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.04em;
}

.analytics-number {
  font-family: monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: #f8fafc;
}

.analytics-desc {
  font-size: 0.72rem;
  color: #64748b;
}

.visitor-details-table {
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.83rem;
  color: #94a3b8;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  padding-bottom: 0.4rem;
}

.detail-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.detail-row strong { color: #f8fafc; }
.detail-row code {
  font-family: monospace;
  font-size: 0.75rem;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.modal-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.btn-primary {
  background: #3b82f6;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}
.btn-primary:hover { background: #2563eb; }

.btn-secondary {
  background: rgba(30, 41, 59, 0.8);
  color: #94a3b8;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
}
.btn-secondary:hover { background: rgba(51, 65, 85, 0.9); color: #f8fafc; }
