/* ================================================================
   stream-console  —  Design System & UI v2
   ================================================================
   Dark theme with modern glassmorphism, gradient accents,
   and sidebar navigation. Inspired by Discord/Linear/Figma.
   Optimized for:
   - OBS browser docks (200-400px, dark rooms, low resource)
   - Manager full-screen dashboards (tablet + desktop)
   - Lite Mode toggle (no animations, reduced blur/shadow)
   ================================================================ */

/* ====== Reset & Base ====== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Surface hierarchy (dark -> light) */
  --bg-base:       #09090b;
  --bg-primary:    #0c0c10;
  --bg-secondary:  #111116;
  --bg-tertiary:   #17171e;
  --bg-card:       rgba(26, 26, 38, 0.85);
  --bg-elevated:   #1e1e2c;
  --bg-hover:      rgba(255, 255, 255, 0.06);
  --bg-active:     rgba(255, 255, 255, 0.1);
  --bg-glass:      rgba(16, 16, 24, 0.65);

  /* Text hierarchy */
  --text-primary:   #f0f0f5;
  --text-secondary: #b0b0c8;
  --text-muted:     #9090a8;
  --text-inverse:   #09090b;

  /* Accent — vibrant purple-blue gradient endpoints */
  --accent:        #7c6cff;
  --accent-hover:  #6b5ce6;
  --accent-active: #5a4ccc;
  --accent-muted:  rgba(124, 108, 255, 0.1);
  --accent-glow:   rgba(124, 108, 255, 0.3);
  --accent-2:      #a78bfa;
  --accent-3:      #818cf8;

  /* Semantic colors */
  --success:       #34d399;
  --success-muted: rgba(52, 211, 153, 0.1);
  --warning:       #fbbf24;
  --warning-muted: rgba(251, 191, 36, 0.1);
  --danger:        #f87171;
  --danger-muted:  rgba(248, 113, 113, 0.1);
  --info:          #60a5fa;
  --info-muted:    rgba(96, 165, 250, 0.1);
  --live:          #ef4444;
  --live-glow:     rgba(239, 68, 68, 0.35);

  /* Border & shadow */
  --border:        rgba(255, 255, 255, 0.1);
  --border-hover:  rgba(255, 255, 255, 0.16);
  --border-focus:  var(--accent);
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.5);
  --shadow-glow:   0 0 24px var(--accent-glow);
  --shadow-accent: 0 4px 20px rgba(124, 108, 255, 0.2);
  --shadow-success: 0 4px 16px rgba(52, 211, 153, 0.2);
  --shadow-danger:  0 4px 16px rgba(248, 113, 113, 0.2);

  /* Radius */
  --radius-xs:  4px;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Timing */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 0.15s;
  --duration-normal: 0.25s;
  --duration-slow: 0.4s;

  /* Z-index layers */
  --z-sidebar:  50;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-modal:    1000;
  --z-toast:    2000;

  /* Sidebar */
  --sidebar-width: 220px;
  --sidebar-narrow: 56px;
}

/* ====== Light Theme ====== */
[data-theme="light"] {
  --bg-base:       #f4f4f6;
  --bg-primary:    #ebebed;
  --bg-secondary:  #ffffff;
  --bg-tertiary:   #f0f0f2;
  --bg-card:       rgba(255, 255, 255, 0.95);
  --bg-elevated:   #ffffff;
  --bg-hover:      rgba(0, 0, 0, 0.05);
  --bg-active:     rgba(0, 0, 0, 0.09);
  --bg-glass:      rgba(255, 255, 255, 0.8);

  --text-primary:   #0e0e1a;
  --text-secondary: #2e2e4a;
  --text-muted:     #52526e;
  --text-inverse:   #ffffff;

  --accent:        #6a5acd;
  --accent-hover:  #5a4abd;
  --accent-muted:  rgba(106, 90, 205, 0.12);
  --accent-glow:   rgba(106, 90, 205, 0.25);

  --border:        rgba(0, 0, 0, 0.12);
  --border-hover:  rgba(0, 0, 0, 0.2);
  --border-focus:  var(--accent);

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.12);
  --shadow-glow:   0 0 24px rgba(106, 90, 205, 0.18);
  --shadow-accent: 0 4px 20px rgba(106, 90, 205, 0.15);
  --shadow-success: 0 4px 16px rgba(52, 211, 153, 0.15);
  --shadow-danger:  0 4px 16px rgba(248, 113, 113, 0.15);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .chat-message.other {
  background: var(--bg-tertiary);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .chat-message.system {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.25);
  color: #5a4a00;
}

[data-theme="light"] .reaction-btn {
  background: var(--bg-tertiary);
}

[data-theme="light"] .sidebar {
  background: #fafafc;
  border-right-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .dock-sidebar {
  background: #fafafc;
  border-right-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .status-bar {
  background: #fafafc;
}

[data-theme="light"] .chat-input-area {
  background: #fafafc;
}

[data-theme="light"] .card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .card-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .table th {
  color: #2e2e4a;
}

[data-theme="light"] .clip-time {
  color: #2e2e4a;
}

[data-theme="light"] .song-detail-panel {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .song-detail-panel .detail-label {
  color: #2e2e4a;
}

[data-theme="light"] .badge {
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .modal {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .toast {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  color: #0e0e1a;
}

[data-theme="light"] .sidebar-footer-user {
  color: #2e2e4a;
}

[data-theme="light"] .sidebar-footer-user .text-muted {
  color: #3a3a58;
}

[data-theme="light"] .empty-state-text {
  color: #52526e;
}

[data-theme="light"] .chat-message .sender {
  color: #5a4abd;
}

[data-theme="light"] .chat-message .meta {
  opacity: 0.85;
}

[data-theme="light"] .input::placeholder {
  color: #52526e;
}

[data-theme="light"] .sidebar-item {
  color: #2e2e4a;
}

[data-theme="light"] .sidebar-item.active {
  color: #0e0e1a;
}

[data-theme="light"] .spinner {
  border-color: rgba(0, 0, 0, 0.08);
  border-top-color: var(--accent);
}

[data-theme="light"] .login-page {
  background: linear-gradient(135deg, #f0f0f5 0%, #e8e8f0 50%, #f0f0f5 100%);
}

[data-theme="light"] .login-box {
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 24px 80px rgba(0,0,0,0.08), 0 0 60px rgba(124, 108, 255, 0.04);
}

[data-theme="light"] select.input option {
  background: #ffffff;
  color: #1a1a2e;
}

/* ====== Lite Mode ====== */
[data-lite-mode="true"] {
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-glow: none;
  --shadow-accent: none;
  --shadow-success: none;
  --shadow-danger: none;
  --bg-card: #16161e;
  --bg-glass: #10101a;
}

[data-lite-mode="true"] * {
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  transition-duration: 0s !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

[data-lite-mode="true"] .animate-pulse,
[data-lite-mode="true"] .animate-glow,
[data-lite-mode="true"] .animate-breathe {
  animation: none !important;
}

[data-lite-mode="true"] .glass {
  backdrop-filter: none !important;
  background: var(--bg-elevated) !important;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans",
               "Hiragino Kaku Gothic ProN", "Yu Gothic UI", YuGothic,
               "Segoe UI", Roboto, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ====== Utilities ====== */
[x-cloak] { display: none !important; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.overflow-y-auto { overflow-y: auto; }
.overflow-hidden { overflow: hidden; }
.flex-1 { flex: 1; min-width: 0; min-height: 0; }
.flex-shrink-0 { flex-shrink: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relative { position: relative; }
.select-none { user-select: none; }

/* Glass effect */
.glass {
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}

/* ====== Animations ====== */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes pulse-live {
  0%, 100% { box-shadow: 0 0 0 0 var(--live-glow); }
  50%      { box-shadow: 0 0 0 8px transparent; }
}

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes float-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.animate-fade-in     { animation: fade-in var(--duration-normal) var(--ease-out); }
.animate-fade-in-up  { animation: fade-in-up var(--duration-normal) var(--ease-out); }
.animate-scale-in    { animation: scale-in var(--duration-normal) var(--ease-spring); }
.animate-breathe     { animation: breathe 2s ease-in-out infinite; }
.animate-pulse       { animation: pulse-live 2s ease-in-out infinite; }

/* Loading spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-sm { width: 12px; height: 12px; border-width: 1.5px; }

/* ====== Components ====== */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  user-select: none;
  outline: none;
  font-family: inherit;
  letter-spacing: 0.01em;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Ripple effect on click */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 10%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.btn:active::after {
  opacity: 1;
  transition: opacity 0s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-accent);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #e85d5d 100%);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-danger);
}
.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #ef5350 0%, var(--danger) 100%);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #2dd4a0 100%);
  color: var(--text-inverse);
  border-color: transparent;
  box-shadow: var(--shadow-success);
}
.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, #2bc489 0%, var(--success) 100%);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: rgba(124, 108, 255, 0.2);
}

.btn-subtle {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-subtle:hover:not(:disabled) {
  background: var(--bg-active);
  color: var(--text-primary);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 13px 28px;
  font-size: 15px;
  border-radius: var(--radius-md);
  font-weight: 600;
}

.btn-icon {
  padding: 6px;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--radius);
}
.btn-icon.btn-sm {
  padding: 4px;
  min-width: 24px;
  min-height: 24px;
}

.btn-support {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: white;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  border: none;
  width: 100%;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  animation: pulse-live 2.5s ease-in-out infinite;
  text-align: center;
  box-shadow: var(--shadow-danger);
}
.btn-support:hover {
  animation: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(239, 68, 68, 0.4);
}
.btn-support.active {
  background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
  animation: breathe 2s ease-in-out infinite;
}

/* --- Inputs --- */
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast), background var(--duration-fast);
}
.input::placeholder {
  color: var(--text-secondary);
  font-size: 14px;
}
.input:hover {
  border-color: var(--border-hover);
  background: var(--bg-secondary);
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted), 0 0 20px rgba(124, 108, 255, 0.1);
  background: var(--bg-secondary);
}
.input-sm {
  padding: 8px 12px;
  font-size: 13px;
}
.input-sm::placeholder {
  font-size: 13px;
}

select.input {
  cursor: pointer;
  padding-right: 30px;
}

select.input option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

textarea.input {
  resize: vertical;
  min-height: 60px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.card:hover {
  border-color: var(--border-hover);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-body {
  padding: 20px;
}

/* --- Status indicators --- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  transition: background var(--duration-fast);
}
.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}
.status-dot.offline {
  background: var(--text-muted);
}
.status-dot.delayed {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

/* LIVE badge (pulsing) */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--live);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--danger-muted);
}
.live-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live);
  animation: pulse-live 1.5s ease-in-out infinite;
}

/* --- Status bar (dock) --- */
.status-bar {
  padding: 8px 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* --- Chat --- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.chat-message {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  max-width: 82%;
  word-wrap: break-word;
  animation: float-in var(--duration-fast) var(--ease-out);
  position: relative;
}

.chat-message.own {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: var(--radius-xs);
  box-shadow: 0 2px 12px rgba(124, 108, 255, 0.25);
}

.chat-message.other {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: var(--radius-xs);
}

.chat-message.system {
  background: var(--warning-muted);
  border: 1px solid rgba(251, 191, 36, 0.2);
  align-self: center;
  max-width: 95%;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 8px 14px;
}

.chat-message .sender {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 3px;
  color: var(--accent);
}
.chat-message.own .sender {
  color: rgba(255,255,255,0.7);
}

.chat-message .content {
  font-size: 14px;
  line-height: 1.55;
}

.chat-message .meta {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-message .reactions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.reaction-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--duration-fast);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1;
}
.reaction-btn:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
  transform: scale(1.12);
}
.reaction-btn.active {
  border-color: var(--accent);
  background: var(--accent-muted);
}
.reaction-btn .count {
  font-size: 10px;
  color: var(--text-secondary);
}

.chat-input-area {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.chat-input-area .input {
  flex: 1;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  padding: 10px 16px;
  min-height: 42px;
}

/* ====== Sidebar Navigation ====== */

/* --- Sidebar (full-screen: icon + label) --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: white;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: var(--shadow-accent);
}

.sidebar-brand-text {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.sidebar-brand-badge {
  margin-left: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  position: relative;
  white-space: nowrap;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
}

.sidebar-item-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}

.sidebar-item.active .sidebar-item-icon {
  opacity: 1;
}

.sidebar-item-label {
  flex: 1;
  min-width: 0;
}

.sidebar-item-badge {
  margin-left: auto;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-footer-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-secondary);
}

/* --- Sidebar Narrow (OBS dock: icon only) --- */
.sidebar-narrow {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-narrow);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: var(--z-sidebar);
  flex-shrink: 0;
}

.sidebar-narrow .sidebar-brand {
  padding: 14px 0;
  justify-content: center;
  gap: 0;
}

.sidebar-narrow .sidebar-brand-icon {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.sidebar-narrow .sidebar-nav {
  padding: 8px 6px;
  align-items: center;
}

.sidebar-narrow .sidebar-item {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  gap: 0;
  border-radius: var(--radius);
  position: relative;
}

.sidebar-narrow .sidebar-item.active::before {
  left: -6px;
  top: 8px;
  bottom: 8px;
}

.sidebar-narrow .sidebar-item-icon {
  width: 20px;
  height: 20px;
}

.sidebar-narrow .sidebar-item-badge {
  position: absolute;
  top: 2px;
  right: 2px;
}

.sidebar-narrow .sidebar-footer {
  padding: 10px 6px;
  align-items: center;
}

/* ====== SVG Sidebar Icons (inline) ====== */
.icon-svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Clip list --- */
.clip-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: background var(--duration-fast);
}
.clip-item:hover {
  background: var(--bg-hover);
}
.clip-item:last-child {
  border-bottom: none;
}

.clip-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.clip-category {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-muted);
  color: var(--accent);
}

/* --- Table --- */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.table tbody tr {
  transition: background var(--duration-fast);
}
.table tbody tr:hover td {
  background: var(--bg-hover);
}
.table tbody tr:last-child td {
  border-bottom: none;
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  gap: 4px;
}
.badge-admin    { background: var(--danger-muted); color: var(--danger); }
.badge-manager  { background: var(--info-muted); color: var(--info); }
.badge-streamer { background: var(--success-muted); color: var(--success); }
.badge-live     { background: var(--danger-muted); color: var(--live); }
.badge-warning  { background: var(--warning-muted); color: var(--warning); }

/* Song permission badges */
.badge-perm-unavailable  { background: var(--danger-muted); color: var(--danger); }
.badge-perm-jasrac       { background: var(--success-muted); color: var(--success); }
.badge-perm-nextone      { background: var(--success-muted); color: var(--success); }
.badge-perm-both         { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-perm-unconfirmed  { background: var(--warning-muted); color: var(--warning); }

/* Song practice status badges */
.badge-status-expert     { background: var(--info-muted); color: var(--info); }
.badge-status-normal     { background: var(--bg-hover); color: var(--text-muted); }
.badge-status-practicing { background: var(--warning-muted); color: var(--warning); }
.badge-status-unlearned  { background: var(--bg-hover); color: var(--text-disabled); }

/* Song list items */
.song-list-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.song-list-item:hover {
  background: var(--bg-hover);
}

/* Song detail expand panel */
.song-detail-panel {
  padding: 16px 20px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}
.song-detail-panel .detail-section {
  margin-bottom: 14px;
}
.song-detail-panel .detail-section:last-child {
  margin-bottom: 0;
}
.song-detail-panel .detail-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.song-inst-url-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.song-inst-url-item a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  word-break: break-all;
}
.song-inst-url-item a:hover {
  text-decoration: underline;
}
.song-inst-url-item .inst-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Song external search links */
.song-ext-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.song-ext-links a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-hover);
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.song-ext-links a:hover {
  background: var(--bg-active);
}

/* Song permission & status badges (larger) */
.badge-perm-unavailable,
.badge-perm-jasrac,
.badge-perm-nextone,
.badge-perm-both,
.badge-perm-unconfirmed,
.badge-status-expert,
.badge-status-normal,
.badge-status-practicing,
.badge-status-unlearned {
  font-size: 12px;
  padding: 4px 10px;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  animation: fade-in var(--duration-fast) var(--ease-out);
  padding: 16px;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  animation: scale-in var(--duration-normal) var(--ease-spring);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: -0.01em;
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --- Toast notifications --- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  max-width: 360px;
  pointer-events: auto;
  animation: slide-in-right var(--duration-normal) var(--ease-spring);
  box-shadow: var(--shadow-lg);
  border: 1px solid transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast::before {
  flex-shrink: 0;
  font-size: 16px;
}
.toast-success {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.15);
}
.toast-success::before {
  content: '\2713';
}
.toast-error {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.15);
}
.toast-error::before {
  content: '\2717';
}
.toast-warning {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.15);
}
.toast-warning::before {
  content: '\26A0';
}
.toast-info {
  background: rgba(96, 165, 250, 0.12);
  color: var(--info);
  border-color: rgba(96, 165, 250, 0.15);
}
.toast-info::before {
  content: '\2139';
}

/* Lite Mode toggle button */
.lite-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-muted);
  transition: all var(--duration-fast);
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.lite-mode-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
}
.lite-mode-toggle.active {
  background: var(--success-muted);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.2);
}

/* ====== Layout: Login ====== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

/* Large gradient orbs in background */
.login-page::before {
  content: '';
  position: absolute;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(124, 108, 255, 0.15) 0%, transparent 65%);
  top: 20%;
  left: 40%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.1) 0%, transparent 65%);
  bottom: 10%;
  right: 20%;
  pointer-events: none;
}

.login-box {
  width: 420px;
  padding: 48px 44px;
  position: relative;
  z-index: 1;
  animation: fade-in-up var(--duration-slow) var(--ease-out);
  border-radius: var(--radius-2xl) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  font-weight: 800;
  box-shadow: var(--shadow-accent);
}

.login-box h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-box .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
  font-weight: 400;
}

.login-box .form-group {
  margin-bottom: 20px;
}

.login-box label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.login-box .input {
  padding: 12px 16px;
  font-size: 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-color: rgba(255,255,255,0.04);
}

.login-box .input:focus {
  box-shadow: 0 0 0 3px var(--accent-muted), 0 0 30px rgba(124, 108, 255, 0.12);
}

/* ====== Layout: Streamer Dock (sidebar navigation, unified with manager/admin) ====== */
.dock-layout {
  height: 100vh;
  display: flex;
  flex-direction: row;
  background: var(--bg-base);
}

.dock-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  flex-shrink: 0;
  transition: width var(--duration-normal) var(--ease-out);
}

.dock-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  height: 100vh;
  transition: margin-left var(--duration-normal) var(--ease-out);
}

.dock-panel {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fade-in var(--duration-fast) var(--ease-out);
}

/* OBS dock narrow sidebar (400px or less) — icon-only, always visible */
@media (max-width: 400px) {
  .dock-sidebar {
    width: var(--sidebar-narrow);
    transform: translateX(0) !important; /* Override mobile hide — OBS dock always shows sidebar */
  }
  .dock-sidebar .sidebar-brand-text {
    display: none;
  }
  .dock-sidebar .sidebar-brand {
    padding: 14px 0;
    justify-content: center;
    gap: 0;
  }
  .dock-sidebar .sidebar-brand-icon {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
  .dock-sidebar .sidebar-nav {
    padding: 8px 6px;
    align-items: center;
  }
  .dock-sidebar .sidebar-item {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    gap: 0;
    border-radius: var(--radius);
  }
  .dock-sidebar .sidebar-item-label {
    display: none;
  }
  .dock-sidebar .sidebar-item-badge {
    position: absolute;
    top: 2px;
    right: 2px;
  }
  .dock-sidebar .sidebar-item.active::before {
    left: -6px;
    top: 8px;
    bottom: 8px;
  }
  .dock-sidebar .sidebar-footer {
    padding: 10px 6px;
    align-items: center;
  }
  .dock-sidebar .sidebar-footer .sidebar-item-label {
    display: none;
  }
  .dock-sidebar .sidebar-footer .lite-mode-toggle span {
    font-size: 0;
  }
  .dock-sidebar .sidebar-footer .lite-mode-toggle::after {
    content: 'L';
    font-size: 10px;
  }
  .dock-sidebar .sidebar-footer-user span.text-muted {
    display: none;
  }
  .dock-main {
    margin-left: var(--sidebar-narrow) !important; /* Override mobile margin-left: 0 */
  }
  /* Hide mobile header in OBS dock since sidebar is always visible */
  .dock-layout .mobile-header {
    display: none;
  }
}

/* Session start area */
.dock-session-start {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
}

.session-start-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border: none;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: 0 4px 28px var(--accent-glow);
  font-family: inherit;
}
.session-start-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 40px var(--accent-glow);
}
.session-start-btn:active {
  transform: scale(0.97);
}
.session-start-btn .icon {
  font-size: 28px;
  line-height: 1;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
  gap: 10px;
  text-align: center;
}
.empty-state-icon {
  font-size: 36px;
  opacity: 0.45;
  margin-bottom: 4px;
}
.empty-state-text {
  font-size: 13px;
  font-weight: 400;
}

/* ====== Layout: Manager Dashboard (sidebar navigation) ====== */
.dashboard-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  background: var(--bg-base);
}

.dashboard-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.dashboard-header {
  padding: 16px 28px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.dashboard-header h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

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

.dashboard-body {
  flex: 1;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-content: start;
  animation: fade-in-up var(--duration-normal) var(--ease-out);
}

.dashboard-body .card {
  min-height: 200px;
}

.dashboard-body .card.full-width {
  grid-column: span 2;
}

/* Overview cards for manager */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 24px;
}

.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  display: flex;
  flex-direction: column;
  gap: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.session-card:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), var(--shadow-accent);
}

.session-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.session-card-streamer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.streamer-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-muted), rgba(167, 139, 250, 0.15));
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.session-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ====== Layout: Admin Panel (sidebar navigation) ====== */
.admin-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  background: var(--bg-base);
}

.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-header {
  padding: 16px 28px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.admin-header h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.admin-body {
  flex: 1;
  padding: 24px;
  max-width: 1000px;
  width: 100%;
  animation: fade-in-up var(--duration-normal) var(--ease-out);
}

/* Discord config card */
.discord-config .form-group {
  margin-bottom: 20px;
}

.discord-config label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

/* Toggle switch */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--bg-active);
  transition: background var(--duration-fast);
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--duration-fast) var(--ease-out);
}
.toggle.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 0 12px var(--accent-glow);
}
.toggle.active::after {
  left: 21px;
  background: white;
}

/* ====== Scrollbar ====== */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.12);
}

/* ====== Responsive ====== */

/* --- Laptop (1024-1366px) --- */
@media (max-width: 1366px) {
  .dashboard-body {
    gap: 16px;
  }
}

/* --- Tablet landscape / small laptop (max 1024px) --- */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 180px;
  }

  .dashboard-body {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  .dashboard-body .card.full-width {
    grid-column: span 1;
  }

  .sidebar-item-label {
    font-size: 12px;
  }

  .sidebar-brand-text {
    font-size: 13px;
  }

  .admin-body {
    padding: 20px;
  }

  /* Tables: horizontal scroll wrapper */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* --- Tablet portrait (max 768px) --- */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  /* Hide sidebar, show mobile header */
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    transition: transform var(--duration-normal) var(--ease-out);
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  /* Dock sidebar: also hide on mobile, but OBS dock override below will restore it */
  .dock-sidebar {
    transform: translateX(-100%);
    width: 260px;
    transition: transform var(--duration-normal) var(--ease-out);
  }
  .dock-sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  /* Sidebar overlay backdrop */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sidebar) - 1);
  }
  .sidebar-overlay.active {
    display: block;
  }

  .dashboard-main,
  .admin-main,
  .dock-main {
    margin-left: 0;
  }

  /* Mobile header with hamburger */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: calc(var(--z-sidebar) - 2);
  }

  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-primary);
    font-size: 18px;
    flex-shrink: 0;
    transition: background var(--duration-fast);
  }
  .hamburger-btn:hover {
    background: var(--bg-hover);
  }

  .mobile-header-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
  }

  .dashboard-header,
  .admin-header {
    padding: 10px 16px;
  }

  .dashboard-header h1,
  .admin-header h1 {
    font-size: 15px;
  }

  .dashboard-body {
    padding: 16px;
    gap: 12px;
  }

  .admin-body {
    padding: 12px;
  }

  .overview-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  /* Modal: slide up from bottom on mobile */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 90vh;
    animation: slide-up var(--duration-normal) var(--ease-out);
  }

  /* Chat input full width */
  .chat-input-area {
    padding: 8px 12px;
  }
  .chat-input-area .input {
    font-size: 16px; /* Prevent iOS zoom */
  }

  /* Table responsive on mobile */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table th,
  .table td {
    padding: 10px 12px;
    white-space: nowrap;
  }

  /* Stat cards stack */
  .stat-card {
    padding: 16px;
  }
  .stat-card-value {
    font-size: 24px;
  }

  /* Login adjustments */
  .login-box {
    width: calc(100vw - 32px);
    max-width: 420px;
    padding: 36px 28px;
  }
  .login-box h1 {
    font-size: 22px;
  }
}

/* --- Small mobile (max 480px) --- */
@media (max-width: 480px) {
  .login-box {
    padding: 28px 20px;
    border-radius: var(--radius-lg) !important;
  }
  .login-box h1 {
    font-size: 20px;
  }
  .login-logo-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .login-box .subtitle {
    font-size: 13px;
    margin-bottom: 24px;
  }

  .toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
  }
  .toast {
    max-width: 100%;
  }

  .btn-lg {
    padding: 12px 20px;
    font-size: 14px;
  }

  .stat-card-value {
    font-size: 22px;
  }
}

/* Slide-up animation for mobile modals */
@keyframes slide-up {
  from { opacity: 0; transform: translateY(100%); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Desktop: hide mobile-only elements */
@media (min-width: 769px) {
  .mobile-header {
    display: none;
  }
  .sidebar-overlay {
    display: none !important;
  }
}

/* ====== Accessibility ====== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Skip link */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Checkbox styling */
input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-hover);
  border-radius: var(--radius-xs);
  background: var(--bg-primary);
  cursor: pointer;
  position: relative;
  transition: all var(--duration-fast);
  flex-shrink: 0;
}
input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: var(--accent);
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* Notification count badge */
.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  background: linear-gradient(135deg, var(--danger), #e85d5d);
  color: white;
  box-shadow: 0 2px 8px rgba(248, 113, 113, 0.3);
}

/* Stat cards on dashboard overview */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color var(--duration-fast), transform var(--duration-fast);
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.stat-card-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.stat-card-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card-value.danger {
  background: linear-gradient(135deg, var(--danger) 0%, #e85d5d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card-value.success {
  background: linear-gradient(135deg, var(--success) 0%, #2dd4a0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Section title used in sidebar-layout pages */
.section-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

/* Dock-specific overrides */
.dock-layout .chat-message {
  max-width: 92%;
}

.dock-layout .btn-support {
  padding: 16px;
  font-size: 16px;
}

/* ====== Multi-View (Manager simultaneous view) ====== */
.multi-view-container {
  display: grid;
  gap: 1px;
  background: var(--border);
  flex: 1;
  overflow: hidden;
}

.multi-view-container.cols-1 { grid-template-columns: 1fr; }
.multi-view-container.cols-2 { grid-template-columns: 1fr 1fr; }
.multi-view-container.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.multi-view-container.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

@media (max-width: 768px) {
  .multi-view-container.cols-2,
  .multi-view-container.cols-3,
  .multi-view-container.cols-4 {
    grid-template-columns: 1fr;
  }
}

.multi-view-column {
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  min-width: 0;
  overflow: hidden;
}

.multi-view-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
}

.multi-view-column .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.multi-view-column .chat-message {
  padding: 6px 10px;
  border-radius: var(--radius);
  max-width: 95%;
  font-size: 12px;
}

.multi-view-column .chat-input-area {
  padding: 6px 8px;
  gap: 4px;
}

.multi-view-column .chat-input-area .input {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 12px;
}

/* ====== Floating Memo Panel (Manager) ====== */
.floating-memo {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 320px;
  max-height: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  display: flex;
  flex-direction: column;
  animation: float-in var(--duration-normal) var(--ease-out);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
}

.floating-memo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.floating-memo textarea {
  flex: 1;
  border: none;
  resize: none;
  padding: 12px 14px;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  outline: none;
  min-height: 200px;
}

.floating-memo textarea::placeholder {
  color: var(--text-muted);
}

.floating-memo-status {
  padding: 4px 14px 8px;
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Theme toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-muted);
  transition: all var(--duration-fast);
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.theme-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
}

/* Sound toggle button */
.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-muted);
  transition: all var(--duration-fast);
  white-space: nowrap;
}
.sound-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
}
.sound-toggle.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: rgba(124, 108, 255, 0.2);
}

/* ====== Setlist ====== */
.setlist-status-draft     { background: var(--bg-hover); color: var(--text-muted); }
.setlist-status-active    { background: var(--success-muted); color: var(--success); }
.setlist-status-completed { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }

.setlist-status-active .pulse-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 4px;
  animation: setlist-pulse 1.5s ease-in-out infinite;
}

@keyframes setlist-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.setlist-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}
.setlist-item:hover {
  background: var(--bg-hover);
}
.setlist-item.performed {
  opacity: 0.5;
}
.setlist-item.performed .setlist-item-title {
  text-decoration: line-through;
}

.setlist-perform-check {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-xs);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s;
}
.setlist-perform-check.checked {
  background: var(--success);
  border-color: var(--success);
}

.setlist-progress-bar {
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
}
.setlist-progress-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--success);
  transition: width 0.3s;
}

.setlist-move-btn {
  padding: 0 4px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
  background: none;
  border: none;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.setlist-move-btn:hover {
  opacity: 1;
  color: var(--text-primary);
}

.setlist-card {
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.setlist-card:hover {
  background: var(--bg-hover);
}

.setlist-inline-edit {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 4px 8px;
  font-size: 13px;
  width: 100%;
}

[data-theme="light"] .setlist-status-draft     { background: #f3f4f6; color: #6b7280; }
[data-theme="light"] .setlist-status-active    { background: rgba(52, 211, 153, 0.12); color: #059669; }
[data-theme="light"] .setlist-status-completed { background: rgba(167, 139, 250, 0.12); color: #7c3aed; }
