/* Webdal - Medal for Web */
/* Cloud clip platform with sidebar navigation */

:root {
  --bg: #0a0a0a;
  --bg-elev: #111111;
  --card: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --muted: #888888;
  --primary: #BFFF00;
  --primary-600: #a8e600;
  --success: #BFFF00;
  --warning: #ffca3a;
  --danger: #ff4444;
  --info: #00C9A7;
  --shadow: 0 10px 40px rgba(0,0,0,0.5);
  --sidebar-width: 72px;
  --sidebar-expanded: 200px;
}

/* Ensure elements with the hidden attribute are not displayed */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { 
  height: 100%; 
  overflow: hidden;
}
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-attachment: fixed;
}

/* ============================================
   App Layout
   ============================================ */

.app {
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-expanded);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 24px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
}

.sidebar-logo svg {
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-btn i {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.sidebar-label {
  opacity: 1;
}

.sidebar-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.sidebar-btn.active {
  background: rgba(191, 255, 0, 0.1);
  color: var(--primary);
}

.sidebar-btn.active i {
  color: var(--primary);
}

.sidebar-bottom {
  padding: 12px;
  border-top: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Sidebar Storage Meter */
.sidebar-storage {
  padding: 0 4px;
}

.sidebar-storage-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.sidebar-storage-text {
  font-weight: 600;
  color: var(--text);
}

.sidebar-storage-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.sidebar-storage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--info), var(--primary));
  border-radius: 2px;
  width: 0%;
  transition: width 300ms ease;
}

.sidebar-storage-fill.warning {
  background: linear-gradient(90deg, var(--warning), #ff8800);
}

.sidebar-storage-fill.danger {
  background: linear-gradient(90deg, var(--danger), #ff6666);
}

/* User Menu */
.user-menu {
  position: relative;
}

.user-btn {
  width: 100%;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--info));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #0a0a0a;
  flex-shrink: 0;
}

.user-dropdown {
  position: absolute;
  left: 100%;
  bottom: 0;
  margin-left: 8px;
  width: 240px;
  background: rgba(15, 15, 15, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.user-dropdown-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.user-dropdown-email {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.user-dropdown-storage {
  font-size: 12px;
  color: var(--muted);
}

.storage-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-bottom: 12px;
  overflow: hidden;
}

.storage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--info), var(--primary));
  border-radius: 2px;
  width: 0%;
  transition: width 300ms ease;
}

.user-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 150ms ease;
}

.user-dropdown-btn:hover {
  background: rgba(255, 68, 68, 0.15);
  color: var(--danger);
}

.user-dropdown-btn i {
  width: 18px;
  height: 18px;
}

.signin-btn {
  width: 100%;
  color: var(--primary);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
  flex: 1;
  margin-left: var(--sidebar-expanded);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.view-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.view-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.view-header .clip-count {
  color: var(--muted);
  font-size: 14px;
}

.back-btn {
  padding: 8px;
}

/* ============================================
   Record View (existing styles adapted)
   ============================================ */

.stack {
  width: 100%;
  max-width: 900px;
  margin: 24px auto;
  padding: 0 20px 40px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: floatIn 500ms ease both;
}

.card.audio-settings {
  overflow: visible;
}

@keyframes floatIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.preview-card { padding: 16px; position: relative; }
.preview-card.centered { text-align: center; }
.video-wrap {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--card-border);
}
video#preview { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-wrap.trimming { display: none; }
.video-wrap.trimming + .trim-inline { margin-top: 0; }

.video-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px;
  padding-bottom: 48px;
  color: var(--muted);
}
.video-placeholder i { width: 48px; height: 48px; color: var(--muted); opacity: 0.9; }
.video-placeholder p { margin: 0; opacity: 0.95; text-align: center; }
.video-placeholder p.sub { font-size: 12px; opacity: 0.6; }

.rec-indicator {
  position: absolute; top: 12px; left: 12px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 68, 68, 0.15);
  color: #ff6b6b;
  border: 1px solid rgba(255, 68, 68, 0.3);
  box-shadow: 0 2px 12px rgba(255, 68, 68, 0.2);
  opacity: 0; transform: translateY(-8px);
  pointer-events: none;
  font-weight: 600;
  font-size: 13px;
}
.rec-indicator.active { opacity: 1; transform: translateY(0); transition: all 300ms ease; }
.rec-indicator .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.6);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(255, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0); }
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04); color: var(--text); font-weight: 600; letter-spacing: 0.2px; cursor: pointer;
  font-family: inherit;
  transform: translateZ(0);
  transition: transform 120ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.btn i { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.08); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn.primary { 
  border-color: rgba(191,255,0,0.4); 
  background: linear-gradient(180deg, rgba(191,255,0,0.2), rgba(191,255,0,0.08)); 
  color: #BFFF00;
}
.btn.primary:hover {
  background: linear-gradient(180deg, rgba(191,255,0,0.3), rgba(191,255,0,0.15));
  box-shadow: 0 6px 24px rgba(191,255,0,0.15);
}

.btn.success { 
  border-color: rgba(191,255,0,0.5); 
  background: #BFFF00; 
  color: #0a0a0a;
  font-weight: 700;
}
.btn.success:hover {
  background: #d4ff4d;
  box-shadow: 0 6px 24px rgba(191,255,0,0.3);
}

.btn.warning { border-color: rgba(255,202,58,0.35); background: linear-gradient(180deg, rgba(255,202,58,0.22), rgba(255,202,58,0.10)); }
.btn.danger { 
  border-color: rgba(255,68,68,0.4); 
  background: linear-gradient(180deg, rgba(255,68,68,0.25), rgba(255,68,68,0.12)); 
  color: #ff6b6b;
}
.btn.info { border-color: rgba(0,201,167,0.35); background: linear-gradient(180deg, rgba(0,201,167,0.22), rgba(0,201,167,0.10)); color: #00C9A7; }
.btn.subtle { background: rgba(255,255,255,0.03); }
.btn.full-width { width: 100%; justify-content: center; }

/* ============================================
   Form Fields
   ============================================ */

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 150ms ease;
}

.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(191,255,0,0.2);
}

.field input::placeholder {
  color: var(--muted);
}

.select-wrap { display: flex; align-items: center; gap: 8px; }
select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04); color: var(--text);
  outline: none; box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--card-border); background: rgba(255,255,255,0.04); color: var(--text); display: grid; place-items: center; cursor: pointer; transition: all 150ms ease; }
.icon-btn i { width: 18px; height: 18px; color: var(--muted); }
.icon-btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }

/* ============================================
   Preview Actions & Timer
   ============================================ */

.preview-actions { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.preview-actions .timer { margin-left: 0; }
.preview-actions #btnSource[hidden] { display: none; }
.timer { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }

/* ============================================
   Trim UI
   ============================================ */

.trim-inline { padding: 12px; position: relative; margin-top: 12px; }
.trim-inline.busy { pointer-events: none; }
.preview-actions.busy { pointer-events: none; opacity: 0.7; }
.trim-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.trim-header h3 { margin: 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.trim-body { display: grid; gap: 12px; }
.trim-body video { width: 100%; border-radius: 10px; background: #000; border: 1px solid var(--card-border); }
.trim-timeline { display: grid; gap: 8px; }
.trim-timeline .canvas-container { position: relative; }
.trim-timeline canvas { width: 100%; height: 84px; border-radius: 8px; background: rgba(255,255,255,0.04); border: 1px solid var(--card-border); display: block; }
.range { position: absolute; top: 1px; left: 1px; right: 1px; bottom: 1px; pointer-events: none; }
.range .selection { position: absolute; top: 0; height: 100%; background: rgba(191,255,0,0.1); border: 1px solid rgba(191,255,0,0.3); border-left: none; border-right: none; z-index: 0; pointer-events: none; }
.range .handle { position: absolute; top: 0; width: 8px; height: 100%; background: linear-gradient(180deg, #BFFF00, #a8e600); border-radius: 4px; cursor: ew-resize; display: grid; place-items: center; z-index: 1; pointer-events: auto; }
.range .handle .bubble { position: absolute; top: -28px; left: 0; padding: 4px 6px; font-size: 12px; border-radius: 6px; background: rgba(0,0,0,0.8); color: #fff; white-space: nowrap; z-index: 10; font-weight: 500; }
.range .handle.start { left: 0; }
.range .handle.end { left: auto; }
.range .playhead { position: absolute; top: 0; width: 2px; height: 100%; background: #fff; opacity: 0.9; z-index: 2; pointer-events: none; }
.time-rail { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

/* ============================================
   Busy/Loading Overlay
   ============================================ */

.modal-busy { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; background: rgba(0,0,0,0.85); backdrop-filter: blur(4px); border-radius: 16px; z-index: 10; pointer-events: all; }
.modal-busy[hidden] { display: none !important; }
.spinner { width: 28px; height: 28px; border: 3px solid rgba(191,255,0,0.25); border-top-color: #BFFF00; border-radius: 50%; animation: spin 1s linear infinite; }
.spinner.small { width: 20px; height: 20px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { width: min(520px, 80%); height: 6px; border-radius: 999px; background: rgba(255,255,255,0.1); overflow: hidden; }
.progress .bar { width: 0%; height: 100%; background: linear-gradient(90deg, #00C9A7, #BFFF00); transition: width 120ms linear; }

/* ============================================
   Audio Settings
   ============================================ */

.audio-settings {
  padding: 16px;
  animation-delay: 100ms;
  overflow: visible;
}

.audio-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.audio-settings-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.audio-settings-header h3 i {
  width: 16px;
  height: 16px;
  color: var(--info);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  transition: all 200ms ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: var(--muted);
  border-radius: 50%;
  transition: all 200ms ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: rgba(191,255,0,0.2);
  border-color: rgba(191,255,0,0.4);
}

.toggle-switch input:checked + .toggle-slider::before {
  left: calc(100% - 19px);
  background: var(--success);
  box-shadow: 0 0 12px rgba(191,255,0,0.5);
}

.audio-settings-body {
  display: grid;
  gap: 14px;
}

.audio-settings-body.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.level-section {
  display: grid;
  gap: 6px;
}

.level-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.level-db {
  font-family: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  font-size: 11px;
  color: var(--text);
  min-width: 60px;
  text-align: right;
}

.level-meter-wrap {
  display: grid;
  gap: 4px;
}

.level-meter {
  position: relative;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.5) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
}

.level-fill {
  position: absolute;
  inset: 2px;
  right: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #00C9A7 0%, #BFFF00 60%, #ffca3a 80%, #ff4444 100%);
  transition: right 50ms linear;
}

.level-peak {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 3px;
  left: 0;
  background: #fff;
  border-radius: 1px;
  opacity: 0.9;
  transition: left 50ms linear, opacity 300ms ease;
  box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

.level-ticks {
  position: absolute;
  inset: 0;
  display: flex;
  pointer-events: none;
}

.level-ticks span {
  flex: 1;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.level-ticks span:last-child {
  border-right: none;
}

.level-scale {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
  opacity: 0.6;
  padding: 0 2px;
}

#btnMuteMic.muted {
  border-color: rgba(255,68,68,0.4);
  background: rgba(255,68,68,0.15);
}

#btnMuteMic.muted i {
  color: var(--danger);
}

/* Custom select dropdown */
.custom-select {
  position: relative;
  flex: 1;
}

.custom-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 150ms ease;
}

.custom-select-trigger:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
}

.custom-select-trigger:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(191,255,0,0.2);
}

.custom-select.open .custom-select-trigger {
  border-color: var(--primary);
}

.custom-select-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-arrow {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.custom-select.open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 15, 15, 0.98);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  max-height: 280px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 150ms ease;
}

.custom-select.open .custom-select-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.custom-select-options {
  padding: 6px;
}

.custom-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  transition: all 100ms ease;
}

.custom-select-option:hover {
  background: rgba(255,255,255,0.06);
}

.custom-select-option.selected {
  background: rgba(191,255,0,0.1);
  color: var(--success);
}

.custom-select-option.selected::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.custom-select-dropdown::-webkit-scrollbar {
  width: 6px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

.mic-active-dot {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px var(--success);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
  z-index: 2;
}

.mic-active-dot.active {
  opacity: 1;
  animation: pulse-mic 1.5s infinite;
}

.mic-active-dot.active ~ .custom-select-trigger {
  padding-left: 28px;
}

@keyframes pulse-mic {
  0% { box-shadow: 0 0 0 0 rgba(191, 255, 0, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(191, 255, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(191, 255, 0, 0); }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   Library View
   ============================================ */

.library-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.library-auth-prompt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 20px;
  text-align: center;
}

.auth-prompt-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-prompt-icon i {
  width: 40px;
  height: 40px;
  color: var(--muted);
}

.library-auth-prompt h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.library-auth-prompt p {
  margin: 0;
  color: var(--muted);
  max-width: 400px;
}

.library-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  min-height: 0; /* Critical for flex children to respect overflow */
}

/* Date Scroller - Hidden for now */
.date-scroller {
  display: none;
}

.date-scroller:empty {
  display: none;
}

/* The track background */
.date-scroller-track {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 4px;
  width: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

/* The draggable thumb */
.date-scroller-thumb {
  position: absolute;
  right: 4px;
  width: 8px;
  min-height: 50px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  cursor: grab;
  transition: background 150ms ease, width 150ms ease, right 150ms ease;
}

.date-scroller-thumb:hover,
.date-scroller.dragging .date-scroller-thumb {
  background: var(--primary);
  width: 10px;
  right: 3px;
}

.date-scroller.dragging .date-scroller-thumb {
  cursor: grabbing;
}

/* Year labels positioned proportionally along the track */
.date-scroller-labels {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 18px;
  pointer-events: auto;
}

.date-scroller-year-label {
  position: absolute;
  right: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
  opacity: 0.5;
  transition: opacity 150ms ease;
  transform: translateY(-50%);
}

.date-scroller:hover .date-scroller-year-label,
.date-scroller.dragging .date-scroller-year-label {
  opacity: 1;
}

/* Floating date indicator */
.date-scroller-indicator {
  position: fixed;
  right: 52px;
  padding: 8px 14px;
  background: var(--primary);
  color: #0a0a0a;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 100ms ease;
  pointer-events: none;
  z-index: 10000;
}

.date-scroller-indicator::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: var(--primary);
}

.date-scroller.dragging .date-scroller-indicator {
  opacity: 1;
}

.date-scroller-indicator::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: var(--primary);
}

/* Native scrollbar - styled */
.clips-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.clips-container::-webkit-scrollbar {
  width: 8px;
}

.clips-container::-webkit-scrollbar-track {
  background: transparent;
}

.clips-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 4px;
}

.clips-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.5);
}

/* Clips Container */
.clips-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-height: 0; /* Critical for flex children to respect overflow */
}

/* Month sections for virtual scroll */
.month-section {
  margin-bottom: 24px;
}

.month-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--muted);
}

.placeholder-loading {
  width: 24px;
  height: 24px;
  border: 2px solid var(--muted);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.day-group {
  margin-bottom: 16px;
}

.day-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.no-clips {
  color: var(--muted);
  font-style: italic;
}

.library-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  text-align: center;
}

.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon i {
  width: 32px;
  height: 32px;
  color: var(--muted);
}

.library-empty h3 {
  margin: 0;
  font-size: 18px;
}

.library-empty p {
  margin: 0;
  color: var(--muted);
}

/* Clips Groups */
.clips-groups {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.clip-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clip-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg) 80%, transparent 100%);
  padding: 8px 0 16px;
  z-index: 10;
}

.clip-group-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.clip-group-count {
  font-size: 12px;
  color: var(--muted);
}

.clip-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Clip Card */
.clip-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 200ms ease;
}

.clip-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.clip-thumbnail {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  overflow: hidden;
}

.clip-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clip-thumbnail-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(191, 255, 0, 0.1), rgba(0, 201, 167, 0.1));
}

.clip-thumbnail-placeholder i {
  width: 48px;
  height: 48px;
  color: var(--muted);
  opacity: 0.5;
}

.clip-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.clip-info {
  padding: 12px;
}

.clip-info-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.clip-info-text {
  flex: 1;
  min-width: 0;
}

.clip-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clip-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.clip-copy-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: all 150ms ease;
}

.clip-copy-btn:hover {
  background: rgba(191, 255, 0, 0.1);
  border-color: rgba(191, 255, 0, 0.3);
  color: var(--primary);
}

.clip-copy-btn.copied {
  background: rgba(191, 255, 0, 0.2);
  border-color: rgba(191, 255, 0, 0.4);
  color: var(--primary);
}

.clip-copy-btn i {
  width: 16px;
  height: 16px;
}

.library-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ============================================
   Watch View
   ============================================ */

.watch-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
}

.watch-player {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.watch-player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.watch-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.watch-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.watch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================
   Modals
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--bg-elev);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  position: relative;
  animation: modalIn 200ms ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: all 150ms ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.modal-close i {
  width: 18px;
  height: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* Auth Modal */
.auth-modal {
  padding-top: 48px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 150ms ease;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  background: rgba(191, 255, 0, 0.15);
  color: var(--primary);
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-error {
  padding: 12px;
  background: rgba(255, 68, 68, 0.1);
  border: 1px solid rgba(255, 68, 68, 0.3);
  border-radius: 8px;
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 16px;
}

/* Title Modal */
.title-modal h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: toastIn 200ms ease;
  min-width: 280px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast.success {
  border-color: rgba(191, 255, 0, 0.3);
}

.toast.error {
  border-color: rgba(255, 68, 68, 0.3);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error .toast-icon {
  color: var(--danger);
}

.toast-message {
  flex: 1;
  font-size: 14px;
}

.toast-close {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 150ms ease;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.toast-close i {
  width: 16px;
  height: 16px;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
  :root {
    --sidebar-expanded: 72px;
  }
  
  .sidebar-label {
    display: none;
  }
  
  .sidebar-btn {
    justify-content: center;
  }
  
  .user-dropdown {
    left: auto;
    right: 0;
    bottom: 100%;
    margin-bottom: 8px;
    margin-left: 0;
  }
  
  .clip-group-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
  
  .date-scroller {
    width: 44px;
  }
}

@media (max-width: 480px) {
  .stack {
    padding: 0 12px 24px;
  }
  
  .view-header {
    padding: 16px;
  }
  
  .clip-group-grid {
    grid-template-columns: 1fr;
  }
  
  .watch-content {
    padding: 16px;
  }
  
  .watch-info {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .watch-actions {
    width: 100%;
  }
  
  .watch-actions .btn {
    flex: 1;
    justify-content: center;
  }
}
