/* ==========================================================================
   MediaFlow - Premium Glassmorphism & High-Performance Design System
   Dual-Optimized for Desktop & Mobile UX
   ========================================================================== */

:root {
  --font-base: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --font-display: 'Outfit', var(--font-base);

  /* Color Palette: Deep Space Navy & Neon Indigo */
  --bg-app: #080b11;
  --bg-sidebar: #0d121c;
  --bg-surface: #121826;
  --bg-surface-elevated: #182235;
  --bg-glass: rgba(18, 24, 38, 0.75);
  --bg-glass-card: rgba(22, 30, 46, 0.65);
  --bg-glass-hover: rgba(30, 41, 62, 0.85);

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-highlight: rgba(96, 165, 250, 0.35);

  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --accent-glow: 0 0 24px rgba(59, 130, 246, 0.45);
  --accent-teal: #10b981;
  --accent-gold: #f59e0b;
  --accent-rose: #f43f5e;

  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 20px 40px -15px rgba(0, 0, 0, 0.7);

  --header-height: 68px;
  --mobile-nav-height: 68px;
  --sidebar-width: 250px;
  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-base);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  outline: none;
}

a {
  color: inherit;
  text-decoration: none;
}

input, select {
  font-family: inherit;
  color: inherit;
  outline: none;
}

/* Utilities */
.hidden { display: none !important; }
.w-full { width: 100%; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

/* ==========================================================================
   Top Header Navigation
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon-wrapper {
  position: relative;
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.4);
}

.logo-icon {
  width: 18px;
  height: 18px;
  stroke: #ffffff;
  fill: #ffffff;
}

.pulse-ring {
  position: absolute;
  inset: -3px;
  border-radius: 13px;
  border: 2px solid rgba(59, 130, 246, 0.5);
  animation: pulse-ring 2.4s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(1.15); opacity: 0; }
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-name span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-full);
}

/* Search Bar (Desktop) */
.header-center {
  flex: 1;
  max-width: 520px;
  margin: 0 32px;
}

.search-input-box {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  padding: 0 16px;
  transition: all var(--transition-fast);
}

.search-input-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  background: var(--bg-surface-elevated);
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 10px;
}

.search-input-box input {
  width: 100%;
  height: 42px;
  background: transparent;
  border: none;
  font-size: 0.92rem;
}

.search-input-box input::placeholder {
  color: var(--text-dim);
}

.btn-clear {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 4px;
}

/* Header Buttons */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.pill-btn svg {
  width: 17px;
  height: 17px;
}

.primary-gradient {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.primary-gradient:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.primary-gradient:active {
  transform: translateY(0);
}

.secondary-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
}

.secondary-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-highlight);
}

/* Data Saver Toggle */
.data-saver-btn {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.data-saver-btn.active {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.data-saver-btn:not(.active) .indicator-dot {
  background-color: var(--text-dim);
  box-shadow: none;
}

.icon-circle-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.icon-circle-btn svg {
  width: 19px;
  height: 19px;
}

.icon-circle-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-glass);
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--accent-rose);
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-app);
}

/* Speed / HTTP 206 Optimization Banner */
.speed-banner {
  background: linear-gradient(90deg, rgba(30, 58, 138, 0.4) 0%, rgba(16, 185, 129, 0.15) 100%);
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  padding: 8px 24px;
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.bolt-icon {
  font-size: 1rem;
  animation: pulse-bolt 1.5s infinite alternate;
}

@keyframes pulse-bolt {
  from { opacity: 0.6; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.1); }
}

/* ==========================================================================
   Main Layout: Sidebar + Feed
   ========================================================================== */
.main-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height) - 40px);
}

/* Desktop Sidebar */
.desktop-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  flex-shrink: 0;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 0 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
  font-weight: 600;
}

.nav-item .count-pill {
  margin-left: auto;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.nav-item.active .count-pill {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

/* Server Stats Card in Sidebar */
.server-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-val {
  font-weight: 600;
  color: var(--text-main);
}

.stat-val.highlight {
  color: #34d399;
}

.sidebar-footer {
  margin-top: auto;
}

/* ==========================================================================
   Content Area & Media Grid
   ========================================================================== */
.content-area {
  flex: 1;
  padding: 24px 32px 64px;
  overflow-y: auto;
}

.feed-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.horizontal-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-chip {
  padding: 8px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.tab-chip:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-glass);
}

.tab-chip.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.sort-and-view-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-mode-toggle {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.view-btn {
  padding: 6px 9px;
  border-radius: 6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.view-btn svg {
  width: 16px;
  height: 16px;
}

.view-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
}

.styled-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.styled-select:hover {
  border-color: var(--border-glass);
  color: var(--text-main);
}

/* Filter Status Banner */
.filter-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: #93c5fd;
}

.filter-status-banner button {
  text-decoration: underline;
  color: #60a5fa;
  font-weight: 600;
}

/* ==========================================================================
   Media Grid Layout (Desktop Multi-Column)
   ========================================================================== */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.media-grid.feed-mode {
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 32px;
}

/* Media Card Styling */
.media-card {
  position: relative;
  background: var(--bg-glass-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-smooth), border-color var(--transition-fast), box-shadow var(--transition-smooth);
  display: flex;
  flex-direction: column;
}

.media-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-highlight);
  box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.6);
}

/* Thumbnail & Hover Preview Box */
.card-media-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0d121c;
  overflow: hidden;
  cursor: pointer;
}

.card-media-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  display: block;
}

.media-card:hover .card-media-box img {
  transform: scale(1.04);
}

/* Hover Preview Video (Desktop only, silent 3s snippet) */
.hover-preview-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.hover-preview-video.is-playing {
  opacity: 1;
}

/* Badges on Thumbnail */
.card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
  pointer-events: none;
}

.badge-res {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: #60a5fa;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.badge-duration {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  color: #f8fafc;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-size {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

/* Play Center Overlay Icon */
.play-overlay-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.play-overlay-icon .circle-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transform: scale(0.85);
  transition: transform var(--transition-fast);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.play-overlay-icon .circle-icon svg {
  width: 22px;
  height: 22px;
  margin-left: 2px;
}

.card-media-box:hover .play-overlay-icon {
  opacity: 1;
}

.card-media-box:hover .circle-icon {
  transform: scale(1);
}

/* Card Content Details */
.card-details {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}

.card-title:hover {
  color: #60a5fa;
}

.favorite-btn {
  color: var(--text-dim);
  padding: 2px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.favorite-btn svg {
  width: 18px;
  height: 18px;
}

.favorite-btn:hover, .favorite-btn.favorited {
  color: var(--accent-rose);
}

.favorite-btn.favorited svg {
  fill: var(--accent-rose);
}

.card-description {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.tag-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 7px;
  border-radius: 4px;
}

/* Card Footer Actions (Fast Download & View) */
.card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-dl-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-sm);
  color: #60a5fa;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.quick-dl-btn svg {
  width: 15px;
  height: 15px;
}

.quick-dl-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.view-detail-btn {
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.view-detail-btn:hover {
  color: var(--text-main);
}

/* ==========================================================================
   Custom Video Player Modal (Full Experience)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(4, 7, 12, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modal-fade-in 0.25s ease;
}

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

.modal-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
  max-width: 1080px;
  width: 100%;
}

.player-modal-container {
  display: flex;
  flex-direction: column;
}

.player-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(18, 24, 38, 0.95);
  border-bottom: 1px solid var(--border-subtle);
}

.player-title-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.video-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.video-badge {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.video-modal-size {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.player-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.small-btn {
  padding: 6px 14px;
  font-size: 0.82rem;
}

/* Video Wrapper */
.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
}

/* Video Loading Spinner */
.video-loading-spinner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.75);
  padding: 20px 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  color: #93c5fd;
  font-size: 0.85rem;
  z-index: 20;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Custom Controls Bar */
.custom-video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
  padding: 24px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 1;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.custom-video-controls.autohide {
  opacity: 0;
  pointer-events: none;
}

/* Timeline */
.timeline-bar {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  cursor: pointer;
  transition: height 0.15s ease;
}

.timeline-bar:hover {
  height: 10px;
}

.timeline-buffer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 3px;
  width: 0%;
}

.timeline-progress {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--accent-gradient);
  border-radius: 3px;
  width: 0%;
}

.timeline-hover-time {
  position: absolute;
  bottom: 16px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--border-glass);
  color: white;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  display: none;
  pointer-events: none;
}

.timeline-bar:hover .timeline-hover-time {
  display: block;
}

/* Controls Bottom Row */
.controls-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.control-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f1f5f9;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.control-btn svg {
  width: 20px;
  height: 20px;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.08);
}

/* Volume Control */
.volume-control-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
}

.time-display {
  font-size: 0.82rem;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
  margin-left: 6px;
}

.control-text-btn {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

.speed-picker-wrapper {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  min-width: 120px;
  box-shadow: var(--shadow-elevated);
  z-index: 100;
}

.dropdown-menu button {
  padding: 6px 10px;
  text-align: left;
  font-size: 0.82rem;
  border-radius: 6px;
  color: var(--text-secondary);
}

.dropdown-menu button:hover, .dropdown-menu button.active {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  font-weight: 600;
}

/* ==========================================================================
   Photo Viewer Modal
   ========================================================================== */
.photo-modal-container {
  display: flex;
  flex-direction: column;
  height: 90vh;
  max-width: 1200px;
}

.photo-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.photo-info h2 {
  font-size: 1.05rem;
  font-weight: 700;
}

.photo-info span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.photo-content-box {
  position: relative;
  flex: 1;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.photo-img-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.photo-img-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
  user-select: none;
}

.photo-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-glass);
  color: white;
  border-radius: 50%;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-fast);
}

.photo-nav-btn:hover {
  background: rgba(59, 130, 246, 0.7);
}

.prev-btn { left: 16px; }
.next-btn { right: 16px; }

.photo-bottom-toolbar {
  padding: 10px 20px;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-top: 1px solid var(--border-subtle);
}

.tool-btn {
  padding: 6px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.tool-btn:hover {
  color: var(--text-main);
  background: var(--bg-glass-hover);
}

/* ==========================================================================
   Quality Selection & Download Modal
   ========================================================================== */
.modal-small {
  max-width: 480px;
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
  position: relative;
}

.header-icon-pill {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-icon-pill svg {
  width: 22px;
  height: 22px;
}

.upload-icon-pill {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close-icon {
  position: absolute;
  top: 0;
  right: 0;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.quality-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.quality-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quality-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-highlight);
}

.quality-card.selected {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.12);
}

.quality-card-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quality-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.quality-badge-sub {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.quality-badge-green {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.quality-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.quality-card-right {
  text-align: right;
}

.quality-size {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.quality-speed-tag {
  font-size: 0.72rem;
  color: #34d399;
}

/* ==========================================================================
   Download Drawer (Progress Tracking)
   ========================================================================== */
.download-drawer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  max-height: 480px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slide-up 0.25s ease;
}

@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.drawer-header {
  padding: 14px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-title svg {
  width: 18px;
  height: 18px;
  color: #60a5fa;
}

.drawer-title h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.text-link-btn {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.text-link-btn:hover {
  color: var(--text-main);
}

.drawer-body {
  padding: 12px;
  overflow-y: auto;
  max-height: 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.download-task-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.dl-filename {
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dl-status-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: #60a5fa;
}

.dl-status-tag.completed {
  color: #34d399;
}

.dl-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.dl-progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 3px;
  transition: width 0.2s linear;
}

.dl-task-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.empty-downloads {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ==========================================================================
   Upload Modal & Drop Zone
   ========================================================================== */
.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  padding: 36px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.02);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.08);
}

.drop-icon {
  width: 44px;
  height: 44px;
  color: var(--accent-primary);
  margin-bottom: 12px;
}

.drop-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.drop-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: center;
}

.file-hidden-input {
  display: none;
}

.selected-files-preview {
  margin-top: 14px;
  max-height: 120px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.selected-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
}

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

.form-group label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-group input {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.form-group input:focus {
  border-color: var(--accent-primary);
}

.upload-progress-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.upload-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-main);
  font-weight: 600;
}

.highlight-percent {
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
}

.upload-progress-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Desktop Shortcut Guide Modal
   ========================================================================== */
.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}

.shortcut-action {
  color: var(--text-secondary);
}

.shortcut-key kbd {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  border-radius: 4px;
  padding: 3px 8px;
  font-family: monospace;
  font-size: 0.8rem;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(18, 24, 38, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-elevated);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
  font-size: 0.88rem;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 280px;
}

@keyframes toast-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-icon {
  font-size: 1.1rem;
}

.toast.success {
  border-left: 4px solid #10b981;
}

.toast.info {
  border-left: 4px solid #3b82f6;
}

.toast.error {
  border-left: 4px solid #f43f5e;
}

/* ==========================================================================
   MOBILE DEDICATED OPTIMIZATIONS (@media max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* Toggle Visibility */
  .desktop-only { display: none !important; }
  .mobile-only { display: flex !important; }

  /* Compact Header */
  .app-header {
    height: 58px;
    padding: 0 16px;
  }

  .brand-name {
    font-size: 1.15rem;
  }

  .badge-tag {
    display: none;
  }

  /* Mobile Search Bar */
  .mobile-search-bar {
    padding: 8px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
  }

  .mobile-search-bar .search-input-box {
    height: 38px;
  }

  .mobile-search-bar input {
    height: 38px;
    font-size: 0.88rem;
  }

  .speed-banner {
    padding: 6px 16px;
    font-size: 0.75rem;
  }

  /* Main Feed Layout */
  .main-layout {
    min-height: calc(100vh - 170px);
  }

  .content-area {
    padding: 16px 16px 90px; /* space for mobile bottom dock */
  }

  .feed-control-bar {
    gap: 12px;
    margin-bottom: 16px;
  }

  /* Mobile Grid: 1 column full width or 2 column compact */
  .media-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .card-media-box {
    aspect-ratio: 16 / 9;
  }

  .card-details {
    padding: 12px 14px 14px;
  }

  .card-title {
    font-size: 0.92rem;
  }

  /* Mobile Bottom Navigation Dock Bar */
  .mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: rgba(13, 18, 28, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px env(safe-area-inset-bottom, 8px);
    z-index: 800;
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    transition: color var(--transition-fast);
  }

  .bottom-nav-item svg {
    width: 22px;
    height: 22px;
  }

  .bottom-nav-item.active {
    color: #60a5fa;
    font-weight: 600;
  }

  .badge-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-notification-dot {
    position: absolute;
    top: -2px;
    right: -4px;
    width: 8px;
    height: 8px;
    background: var(--accent-rose);
    border-radius: 50%;
  }

  /* Center Upload Floating Button on Mobile */
  .upload-highlight-btn {
    position: relative;
  }

  .floating-add-circle {
    width: 44px;
    height: 44px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.5);
    margin-top: -14px;
    border: 3px solid var(--bg-app);
  }

  .floating-add-circle svg {
    width: 20px;
    height: 20px;
  }

  /* Modals on Mobile: full width, bottom sheets */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-container {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 94vh;
  }

  .player-modal-container {
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .video-wrapper {
    aspect-ratio: auto;
    flex: 1;
  }

  .photo-modal-container {
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .download-drawer {
    left: 12px;
    right: 12px;
    bottom: 76px;
    width: auto;
  }

  .toast-container {
    top: 70px;
    left: 16px;
    right: 16px;
  }

  .toast {
    min-width: unset;
    width: 100%;
  }
}

/* ==========================================================================
   DESKTOP DEDICATED OPTIMIZATIONS (@media min-width: 769px)
   ========================================================================== */
@media (min-width: 769px) {
  .mobile-only { display: none !important; }
  .desktop-only { display: flex !important; }
}
