/*
 * style.css — Playlist Length Calculator
 * androdom.tr · Zero Bloat, Maximum Utility
 *
 * Contains:
 *   1. Baseline resets & body defaults
 *   2. Custom scrollbar (Slate theme)
 *   3. Range slider (Webkit + Firefox)
 *   4. Toggle switch fixes
 *   5. Navbar glass effect
 *   6. Result card component
 *   7. Spinner animation
 *   8. Video list micro-styles
 */

/* ─────────────────────────────────────────────
   1. BASELINE
───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* Prevent FOUC flash to white in dark mode */
  background-color: #030712;
  color-scheme: dark;
  /* Smooth scrolling */
  scroll-behavior: smooth;
  /* Tabular numbers globally for this tool */
  font-variant-numeric: tabular-nums;
}

body {
  /* Prevent horizontal overflow on mobile */
  overflow-x: hidden;
  /* System-level font rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Prevent focus ring flash on mouse click (show only for keyboard) */
:focus:not(:focus-visible) {
  outline: none;
}

/* ─────────────────────────────────────────────
   2. CUSTOM SCROLLBAR — Slate theme
───────────────────────────────────────────── */
.sidebar-scroll {
  scrollbar-width: thin;
  scrollbar-color: #1e293b #0f172a;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 5px;
}

.sidebar-scroll::-webkit-scrollbar-track {
  background: #0f172a;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background-color: #1e293b;
  border-radius: 99px;
  border: 1px solid #0f172a;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background-color: #334155;
}

/* ─────────────────────────────────────────────
   3. CUSTOM RANGE SLIDER
───────────────────────────────────────────── */
.speed-slider {
  --fill-pct: 0%;
  --thumb-size: 16px;
  --track-height: 6px;
  --thumb-color: #6366f1;
  --track-fill: #6366f1;
  --track-bg: #1e293b;

  /* Reset */
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  width: 100%;
  height: var(--thumb-size);
  cursor: pointer;
  outline: none;
}

/* WebKit track */
.speed-slider::-webkit-slider-runnable-track {
  height: var(--track-height);
  border-radius: 99px;
  background: linear-gradient(
    to right,
    var(--track-fill) 0%,
    var(--track-fill) var(--fill-pct),
    var(--track-bg) var(--fill-pct),
    var(--track-bg) 100%
  );
  transition: background 0.1s ease;
}

/* WebKit thumb */
.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--thumb-size);
  height: var(--thumb-size);
  border-radius: 50%;
  background: var(--thumb-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 2px 6px rgba(0,0,0,0.4);
  border: 2px solid #818cf8;
  margin-top: calc((var(--track-height) - var(--thumb-size)) / 2);
  transition: box-shadow 0.15s ease, transform 0.1s ease;
  cursor: grab;
}

.speed-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
  box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.25), 0 2px 8px rgba(0,0,0,0.5);
}

.speed-slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px #030712, 0 0 0 5px #6366f1;
}

/* Firefox track */
.speed-slider::-moz-range-track {
  height: var(--track-height);
  border-radius: 99px;
  background: var(--track-bg);
  border: none;
}

/* Firefox progress fill */
.speed-slider::-moz-range-progress {
  height: var(--track-height);
  border-radius: 99px;
  background: var(--track-fill);
}

/* Firefox thumb */
.speed-slider::-moz-range-thumb {
  width: var(--thumb-size);
  height: var(--thumb-size);
  border-radius: 50%;
  background: var(--thumb-color);
  border: 2px solid #818cf8;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  cursor: grab;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.speed-slider::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
}

/* ─────────────────────────────────────────────
   4. TOGGLE SWITCH — Pointer-events fix
───────────────────────────────────────────── */
.toggle-track,
.toggle-thumb {
  pointer-events: none;
  user-select: none;
}

/* ─────────────────────────────────────────────
   5. NAVBAR GLASS EFFECT
───────────────────────────────────────────── */
.navbar-glass {
  background-color: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
}

/* ─────────────────────────────────────────────
   6. RESULT CARD COMPONENT
───────────────────────────────────────────── */
.result-card {
  background-color: #090d16;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 1.25rem;
  transition: border-color 0.2s ease;
}

.result-card:hover {
  border-color: #334155;
}

.card-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.card-main-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: #f1f5f9;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 0.1rem;
  flex-wrap: wrap;
}

.time-segment {
  font-size: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: inherit;
}

.time-unit {
  font-size: 0.9rem;
  font-weight: 500;
  color: #475569;
  margin-right: 0.35rem;
}

.card-sub {
  font-size: 0.72rem;
  color: #475569;
  margin-top: 0.5rem;
  font-variant-numeric: tabular-nums;
}

/* ─────────────────────────────────────────────
   7. LOADING SPINNER
───────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid #334155;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* ─────────────────────────────────────────────
   8. VIDEO LIST MICRO-STYLES
───────────────────────────────────────────── */
.video-list {
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #1e293b #090d16;
}

.video-list::-webkit-scrollbar {
  width: 4px;
}

.video-list::-webkit-scrollbar-track {
  background: #090d16;
}

.video-list::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 99px;
}

.video-list-item:last-child {
  border-bottom: none;
}

/* ─────────────────────────────────────────────
   9. RESPONSIVE LAYOUT — Main split pane
───────────────────────────────────────────── */
@media (min-width: 768px) {
  #main-layout {
    height: calc(100vh - 48px - 40px); /* viewport minus navbar and footer */
    overflow: hidden;
  }

  #sidebar {
    height: 100%;
  }

  #results-pane {
    height: 100%;
  }
}

/* Ensure footer is always visible */
footer {
  min-height: 40px;
}

/* ─────────────────────────────────────────────
   10. DETAILS / SUMMARY — Remove default marker
───────────────────────────────────────────── */
details > summary {
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

/* ─────────────────────────────────────────────
   11. TRANSITIONS — Layout-safe global defaults
───────────────────────────────────────────── */
input[type="text"],
input[type="url"],
input[type="password"],
input[type="number"] {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ─────────────────────────────────────────────
   12. REDUCED MOTION — Accessibility
───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
