/* ============================================
   PLAYLISTY — Base Styles & Reset
   ============================================ */

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

/* ── Terminal-style block cursor for text inputs ── */
input[type="text"],
input[type="search"],
input[type="url"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input:not([type]),
textarea,
[contenteditable="true"] {
  caret-color: var(--text-primary);
  caret-shape: block;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--duration-slow) var(--ease-default),
              color var(--duration-slow) var(--ease-default);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); font-weight: var(--weight-bold); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

p { color: var(--text-secondary); line-height: var(--leading-relaxed); }

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-default);
}
a:hover { color: var(--accent-primary-light); }

code, pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

small { font-size: var(--text-xs); color: var(--text-tertiary); }

/* ── Selection ── */
::selection {
  background: rgba(212, 160, 83, 0.3);
  color: var(--text-primary);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

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

/* ── Utility ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

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

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

@keyframes progressFill {
  from { width: 0; }
}

@keyframes slideToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

.animate-fade-in { animation: fadeIn var(--duration-normal) var(--ease-out); }
.animate-fade-in-up { animation: fadeInUp var(--duration-slow) var(--ease-out); }
.animate-slide-in-right { animation: slideInRight var(--duration-slow) var(--ease-out); }
.animate-scale-in { animation: scaleIn var(--duration-normal) var(--ease-out); }

/* Staggered animation delays */
.stagger-1 { animation-delay: 50ms; animation-fill-mode: both; }
.stagger-2 { animation-delay: 100ms; animation-fill-mode: both; }
.stagger-3 { animation-delay: 150ms; animation-fill-mode: both; }
.stagger-4 { animation-delay: 200ms; animation-fill-mode: both; }
.stagger-5 { animation-delay: 250ms; animation-fill-mode: both; }
.stagger-6 { animation-delay: 300ms; animation-fill-mode: both; }
.stagger-7 { animation-delay: 350ms; animation-fill-mode: both; }
.stagger-8 { animation-delay: 400ms; animation-fill-mode: both; }

/* ── Loading skeleton ── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--bg-elevated) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* ============================================
   Dark Mode — Premium Polish
   ============================================ */

/* Subtle radial glow on body background + noise */
[data-theme="dark"] body {
  background: 
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(170, 205, 220, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 100%, rgba(170, 205, 220, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse 40% 30% at 10% 60%, rgba(170, 205, 220, 0.02) 0%, transparent 50%),
    var(--bg-primary);
}

/* Cards — luminous top edge, glass gradient, subtle inner glow */
[data-theme="dark"] .card,
[data-theme="dark"] .card-stat {
  border-top: 1px solid rgba(170, 205, 220, 0.15);
  border-left: 1px solid rgba(170, 205, 220, 0.06);
  border-right: 1px solid rgba(170, 205, 220, 0.06);
  border-bottom: 1px solid rgba(61, 69, 86, 0.6);
  background: linear-gradient(
    180deg,
    rgba(55, 64, 80, 0.65) 0%,
    rgba(42, 49, 64, 0.8) 100%
  );
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .card:hover {
  border-top-color: rgba(170, 205, 220, 0.22);
  box-shadow:
    var(--shadow-lg),
    0 0 24px rgba(170, 205, 220, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .card-stat:hover {
  border-top-color: rgba(170, 205, 220, 0.3);
  box-shadow:
    var(--shadow-lg),
    0 0 30px rgba(170, 205, 220, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Tables — softer glass internals */
[data-theme="dark"] .table-wrapper {
  border-color: rgba(61, 69, 86, 0.6);
  background: rgba(36, 43, 54, 0.5);
  box-shadow: inset 0 1px 0 rgba(170, 205, 220, 0.05);
}

[data-theme="dark"] .table thead {
  background: rgba(47, 55, 68, 0.85);
  border-bottom: 1px solid rgba(170, 205, 220, 0.08);
}

[data-theme="dark"] .table tbody tr:hover {
  background: rgba(170, 205, 220, 0.06);
}

/* Nav island — subtle blend with background */
[data-theme="dark"] .nav-wrap {
  background: rgba(33, 39, 48, 0.92);
  border: 1px solid rgba(47, 55, 68, 0.6);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .nav-wrap:after {
  background: rgba(30, 36, 48, 0.25);
}

/* Active nav bubble — gentle highlight */
[data-theme="dark"] .bubble.active-bubble {
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.25),
    0 0 10px rgba(170, 205, 220, 0.06);
}

/* Input bar — frosted glass with glowing focus */
[data-theme="dark"] .input-with-btn:focus-within {
  box-shadow:
    var(--shadow-xl),
    0 0 24px rgba(170, 205, 220, 0.1),
    0 0 0 3px rgba(170, 205, 220, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

/* Standalone inputs — subtle glow on focus */
[data-theme="dark"] .input:focus {
  border-color: rgba(170, 205, 220, 0.4);
  box-shadow: 0 0 0 3px rgba(170, 205, 220, 0.1);
}

/* Modal — frosted glass */
[data-theme="dark"] .modal {
  border-top: 1px solid rgba(170, 205, 220, 0.12);
  border-left: 1px solid rgba(170, 205, 220, 0.06);
  border-right: 1px solid rgba(170, 205, 220, 0.06);
  background: linear-gradient(
    180deg,
    rgba(52, 61, 77, 0.98) 0%,
    rgba(36, 43, 54, 0.98) 100%
  );
  box-shadow:
    var(--shadow-xl),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Luminous divider */
[data-theme="dark"] .divider {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(170, 205, 220, 0.15),
    transparent
  );
}

/* Toast — glass gradient */
[data-theme="dark"] .toast {
  background: linear-gradient(
    135deg,
    rgba(52, 61, 77, 0.96) 0%,
    rgba(42, 49, 64, 0.96) 100%
  );
  border-top: 1px solid rgba(170, 205, 220, 0.1);
  box-shadow:
    var(--shadow-lg),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Tabs — soft accent underline glow on active */
[data-theme="dark"] .tabs {
  border-bottom-color: rgba(61, 69, 86, 0.5);
}

[data-theme="dark"] .tab:hover {
  background: rgba(170, 205, 220, 0.06);
}

[data-theme="dark"] .tab.active {
  color: var(--text-primary);
  text-shadow: 0 0 12px rgba(170, 205, 220, 0.2);
  border-bottom-color: var(--accent-primary);
  box-shadow: 0 2px 8px rgba(170, 205, 220, 0.1);
}

/* Badges — glass shimmer */
[data-theme="dark"] .badge {
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Buttons — rich layered glow, keep fill layer for hover animation */
[data-theme="dark"] .btn-primary {
  box-shadow:
    inset 0 0 0 0 var(--accent-primary),
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .btn-primary:hover {
  box-shadow:
    inset 0 -100px 0 0 var(--accent-primary),
    0 2px 12px rgba(170, 205, 220, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0) !important;
}

[data-theme="dark"] .btn-secondary {
  border-color: rgba(86, 97, 122, 0.5);
  box-shadow: inset 0 0 0 0 var(--accent-primary);
}

[data-theme="dark"] .btn-secondary:hover {
  border-color: var(--accent-primary);
}

[data-theme="dark"] .btn-ghost:hover {
  background: rgba(170, 205, 220, 0.08);
}

/* Progress bars — accent glow trail */
[data-theme="dark"] .progress {
  background: rgba(47, 55, 68, 0.8);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .progress-fill {
  box-shadow: 0 0 8px rgba(170, 205, 220, 0.2);
}

/* Dropdown — frosted glass */
[data-theme="dark"] .dropdown-menu {
  background: linear-gradient(
    180deg,
    rgba(52, 61, 77, 0.98) 0%,
    rgba(42, 49, 64, 0.98) 100%
  );
  border: 1px solid rgba(170, 205, 220, 0.1);
  box-shadow:
    var(--shadow-lg),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .dropdown-item:hover {
  background: rgba(170, 205, 220, 0.08);
}

/* Tooltip — luminous */
[data-theme="dark"] [data-tooltip]::after {
  background: rgba(52, 61, 77, 0.95);
  border: 1px solid rgba(170, 205, 220, 0.12);
  box-shadow: var(--shadow-md), 0 0 8px rgba(170, 205, 220, 0.06);
}

/* Drop zone — accent glow on hover/dragover */
[data-theme="dark"] .drop-zone:hover,
[data-theme="dark"] .drop-zone.dragover {
  border-color: var(--accent-primary);
  background: rgba(170, 205, 220, 0.04);
  box-shadow: 0 0 24px rgba(170, 205, 220, 0.06);
}

/* Empty state — softer icon */
[data-theme="dark"] .empty-state-icon {
  opacity: 0.4;
  filter: drop-shadow(0 0 8px rgba(170, 205, 220, 0.1));
}

/* Toggle switch — polished */
[data-theme="dark"] .toggle-slider {
  background: rgba(47, 55, 68, 0.9);
  border: 1px solid rgba(86, 97, 122, 0.5);
}

/* Checkbox — accent glow when checked */
[data-theme="dark"] .checkbox:checked {
  box-shadow: 0 0 6px rgba(170, 205, 220, 0.2);
}

/* Range slider thumb — accent glow */
[data-theme="dark"] .range-input::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(170, 205, 220, 0.2), 0 0 8px rgba(170, 205, 220, 0.1);
}

/* Selection — use accent color */
[data-theme="dark"] ::selection {
  background: rgba(170, 205, 220, 0.25);
  color: var(--text-primary);
}

/* Scrollbar — blend into the dark UI */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(86, 97, 122, 0.5);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(170, 205, 220, 0.35);
}

