/* Google / YouTube Inspired Dark Theme Premium Stylesheet */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Outfit:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

:root {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1f1f1f;
  --bg-tertiary: #2d2d2d;
  --text-primary: #f1f1f1;
  --text-secondary: #aaaaaa;
  --accent-color: #3ea6ff; /* YouTube dark-mode blue accent */
  --accent-hover: #65b8ff;
  --danger-color: #ff4e4e;
  --success-color: #2ecc71;
  --border-color: #3f3f3f;
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 72px;
  --header-height: 72px;
  --font-main: 'Roboto', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --card-radius: 12px;
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.5);
}

body.light-mode {
  --bg-primary: #f9f9f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f1f1;
  --text-primary: #0f0f0f;
  --text-secondary: #606060;
  --accent-color: #1a73e8;
  --accent-hover: #1557b0;
  --border-color: #e5e5e5;
  --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.05);
}

body.light-mode .search-form {
  background-color: var(--bg-primary);
}

body.light-mode .search-btn {
  background-color: var(--bg-tertiary);
}

/* Theme Toggle Slider Component */
.theme-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
}

.admin-theme-toggle {
  display: flex !important;
}

.theme-icon {
  font-size: 20px !important;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
  user-select: none;
}

.theme-icon.active {
  color: var(--accent-color);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-knob {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: 0.3s;
}

.slider-knob:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

input:checked + .slider-knob {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
}

input:checked + .slider-knob:before {
  transform: translateX(22px);
  background-color: #ffffff;
}

.slider-knob.round {
  border-radius: 22px;
}

.slider-knob.round:before {
  border-radius: 50%;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #4f4f4f;
}

/* Material Symbols Helper */
.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}
.material-symbols-rounded.filled {
  font-variation-settings: 'FILL' 1;
}

/* HEADER / NAVBAR */
.header {
  height: var(--header-height);
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
}

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

.menu-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}
.menu-btn:hover {
  background-color: var(--bg-tertiary);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  color: #ff0000;
  font-size: 32px !important;
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #ff0000, #ff5c5c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-center {
  flex: 0 1 600px;
  display: flex;
  align-items: center;
}

.search-form {
  display: flex;
  width: 100%;
  background-color: #121212;
  border: 1px solid var(--border-color);
  border-radius: 40px;
  overflow: hidden;
  padding-left: 16px;
  transition: var(--transition-smooth);
}
.search-form:focus-within {
  border-color: var(--accent-color);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}

.search-category-select {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  padding: 8px 10px 8px 0;
  cursor: pointer;
  max-width: 130px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-category-select option {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}
.search-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-color);
  margin: auto 8px auto 0;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  padding: 8px 0;
}
.search-input::placeholder {
  color: var(--text-secondary);
}

.search-btn {
  background-color: var(--bg-secondary);
  border: none;
  border-left: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}
.search-btn:hover {
  background-color: var(--bg-tertiary);
}

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

.admin-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: 20px;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition-smooth);
}
.admin-nav-btn:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--text-secondary);
}

.admin-nav-btn.active {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: #000;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a73e8, #8ab4f8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  cursor: pointer;
}

/* MAIN LAYOUT (SIDEBAR + MAIN CONTENT) */
.layout {
  display: flex;
  flex: 1;
  margin-top: var(--header-height);
  position: relative;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-primary);
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  z-index: 90;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
  transition: var(--transition-smooth);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-text {
  display: none;
}

.sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: 12px;
  border-radius: 50%;
}

.sidebar-heading {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 8px 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.sidebar.collapsed .sidebar-heading {
  display: none;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 16px;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  font-size: 14px;
}

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

.sidebar-item.active {
  background-color: var(--bg-tertiary);
  font-weight: 500;
}

.sidebar-item.active .material-symbols-rounded {
  font-variation-settings: 'FILL' 1;
  color: var(--accent-color);
}

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 24px;
  min-height: calc(100vh - var(--header-height));
  transition: var(--transition-smooth);
}

.main-content.expanded {
  margin-left: var(--sidebar-collapsed-width);
}

/* CATEGORY PILLS (TOP OF VIDEOS) */
.categories-bar {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 16px;
}
.categories-bar::-webkit-scrollbar {
  height: 4px;
}

.category-pill {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.category-pill:hover {
  background-color: var(--bg-tertiary);
}
.category-pill.active {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

/* VIDEOS GRID */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.video-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  background-color: var(--bg-secondary);
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: var(--transition-smooth);
  position: relative;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-premium);
  border-color: rgba(255, 255, 255, 0.15);
}

.thumbnail-container {
  width: 100%;
  height: 0;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  position: relative;
  background-color: #000;
  overflow: hidden;
}

.thumbnail-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-smooth);
}
.video-card:hover .thumbnail-img {
  transform: scale(1.03);
}

.duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #ffffff; /* Always white text for high contrast */
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  z-index: 3;
}

.video-details {
  display: flex;
  padding: 12px;
  gap: 12px;
}

.channel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff0000, #ff8c00);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.video-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.video-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-metadata {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.video-category-tag {
  display: inline-block;
  background-color: var(--bg-tertiary);
  color: var(--accent-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  width: fit-content;
  margin-top: 4px;
}

/* NO VIDEOS FOUND */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.no-results-icon {
  font-size: 64px !important;
  color: var(--bg-tertiary);
  margin-bottom: 16px;
}

.no-results h3 {
  font-family: var(--font-display);
  color: var(--text-primary);
  margin-bottom: 8px;
}

/* VIDEO PLAYER MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-premium);
  position: relative;
  animation: modalFadeIn 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  background-color: var(--accent-color);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #000;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.close-modal:hover {
  background-color: var(--danger-color);
  color: #fff;
  transform: rotate(90deg);
}

.player-wrapper {
  width: 100%;
  aspect-ratio: 16/9;
  background-color: #000;
  position: relative;
  overflow: hidden;
}

.player-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Prevents video zooming and cropping */
  display: block;
}

/* Custom Video Controls Overlay */
.video-controls-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.4) 70%, transparent);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 5;
  pointer-events: auto;
}

.player-wrapper:hover .video-controls-overlay,
.player-wrapper.show-controls .video-controls-overlay {
  opacity: 1;
}

.timeline-container {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: height 0.1s ease;
}

.timeline-container:hover {
  height: 6px;
}

.timeline-bar {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
}

.timeline-current {
  height: 100%;
  background-color: var(--accent-color);
  width: 0%;
  position: absolute;
  left: 0;
  top: 0;
}

.controls-buttons-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.control-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

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

.control-btn .material-symbols-rounded {
  font-size: 24px !important;
}

.video-time-display {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-main);
  user-select: none;
}

/* Logo Sizing */
.logo-img {
  height: 64px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Splash Screen */
.intro-splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.intro-splash.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  animation: introScaleIn 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

.intro-logo {
  max-width: 320px;
  height: auto;
}

.intro-spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

body.light-mode .intro-spinner {
  border-color: rgba(0, 0, 0, 0.05);
  border-top-color: var(--accent-color);
}

@keyframes introScaleIn {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

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

/* Video Ended Overlay */
.video-ended-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 15, 15, 0.95);
  z-index: 8;
  display: none;
  flex-direction: column;
  padding: 20px;
  box-sizing: border-box;
}

.video-ended-overlay.active {
  display: flex;
}

.ended-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.ended-header h3 {
  font-family: var(--font-display);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.ended-video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  flex-grow: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.ended-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s ease;
}

.ended-card:hover {
  transform: translateY(-4px);
}

.ended-thumb {
  width: 100%;
  height: 0;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: #000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.ended-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ended-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 4px;
  border-radius: 4px;
}

.ended-title {
  color: #f1f1f1;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-details {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 540px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.modal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.modal-description-box {
  background-color: var(--bg-tertiary);
  padding: 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-line;
}

/* ADMIN PANEL PAGE SPECIFICS */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.admin-title-group h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
}
.admin-title-group p {
  color: var(--text-secondary);
  font-size: 14px;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: rgba(58, 166, 255, 0.1);
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.admin-layout-columns {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
}

.admin-layout-columns.full-width {
  grid-template-columns: 1fr !important;
}

@media (max-width: 900px) {
  .admin-layout-columns {
    grid-template-columns: 1fr !important;
  }
}

.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* FORM ELEMENTS */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-control {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-main);
  outline: none;
  transition: var(--transition-smooth);
}
.form-control:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(62, 166, 255, 0.2);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* File selector wrapper */
.file-upload-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-input {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-dropzone {
  position: relative;
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  background-color: var(--bg-tertiary);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.file-dropzone:hover {
  border-color: var(--accent-color);
  background-color: rgba(62, 166, 255, 0.03);
}

.file-dropzone-icon {
  font-size: 32px !important;
  color: var(--text-secondary);
}

.upload-progress-container {
  display: none;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
}

.progress-bar-wrapper {
  background-color: var(--bg-primary);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin: 6px 0;
}

.progress-bar {
  background-color: var(--accent-color);
  height: 100%;
  width: 0%;
  transition: width 0.1s ease;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.btn {
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}
.btn-danger:hover {
  background-color: #ff3333;
}

/* LISTS / TABLES FOR MANAGING CONTENT */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  gap: 12px;
}

.admin-item-preview {
  width: 80px;
  height: 45px; /* 16:9 ratio for 80px width */
  border-radius: 4px;
  background-color: #000;
  overflow: hidden;
  flex-shrink: 0;
}
.admin-item-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-item-title {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-item-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.admin-item-actions {
  display: flex;
  gap: 6px;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}
.action-btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}
.action-btn.delete:hover {
  background-color: rgba(255, 78, 78, 0.1);
  color: var(--danger-color);
}

/* Category Grid on Admin page */
.category-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-chip {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-chip-delete {
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px !important;
}
.category-chip-delete:hover {
  color: var(--danger-color);
}

/* Toast Notification Styles */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background-color: var(--bg-secondary);
  border-left: 4px solid var(--accent-color);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: 6px;
  box-shadow: var(--shadow-premium);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
  animation: slideInRight 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}

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

.toast.success {
  border-left-color: var(--success-color);
}
.toast.error {
  border-left-color: var(--danger-color);
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
  .sidebar {
    width: var(--sidebar-collapsed-width);
  }
  .sidebar-text {
    display: none;
  }
  .sidebar-heading {
    display: none;
  }
  .sidebar-item {
    justify-content: center;
    padding: 12px;
    border-radius: 50%;
  }
  .main-content {
    margin-left: var(--sidebar-collapsed-width);
    padding: 16px;
  }
  .header-center {
    flex: 1;
    margin: 0 10px;
  }
  .search-form {
    padding-left: 8px;
  }
  .search-btn {
    padding: 0 10px;
  }
  .admin-nav-btn {
    padding: 6px;
  }
  .admin-nav-btn span:not(.material-symbols-rounded) {
    display: none;
  }
}

/* User Profile Menu Dropdown */
.user-menu-wrapper {
  position: relative;
}

.user-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--accent-color);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: var(--transition-smooth);
  user-select: none;
}

.user-avatar-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(58, 166, 255, 0.4);
}

.user-dropdown-menu {
  position: absolute;
  top: 45px;
  right: 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  width: 180px;
  box-shadow: var(--shadow-premium);
  display: none;
  flex-direction: column;
  padding: 6px 0;
  z-index: 100;
}

.user-dropdown-menu.active {
  display: flex;
}

.user-dropdown-item {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.user-dropdown-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--accent-color);
}

.user-dropdown-item.logout-btn:hover {
  color: var(--danger-color);
}

/* Auth tab adjustments */
.auth-tab:hover {
  color: var(--text-primary) !important;
}

@media (min-width: 768px) {
  .profile-modal-body {
    flex-direction: row !important;
  }
}

/* Player Ads Layout (Left column stacked ads) */
.player-ad-container-new {
  display: flex;
  width: 100%;
  gap: 20px;
  align-items: stretch;
}

.ad-sidebar-left {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.ad-box {
  background-color: #1a1a1a;
  border: 2px dashed #444;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  box-sizing: border-box;
  padding: 20px;
  user-select: none;
}

.ad-box-1 {
  height: 250px;
}

.ad-box-2 {
  flex-grow: 1;
  min-height: 350px;
}

.ad-box-3 {
  height: 250px;
}

.player-main-section {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ad-label {
  user-select: none;
}

/* Video Inner Overlay Ad (TrueView Style) */
.video-inner-overlay-ad {
  position: absolute;
  bottom: 60px; /* Floats above custom controls */
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 480px;
  height: 60px;
  background-color: rgba(15, 15, 15, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  z-index: 8;
  display: none; /* activated dynamically via JS if ad is configured */
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.6);
  padding-right: 36px;
  box-sizing: border-box;
  overflow: hidden;
}

.close-overlay-ad {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 12;
  transition: var(--transition-smooth);
}

.close-overlay-ad:hover {
  background-color: var(--danger-color) !important;
}

.close-overlay-ad .material-symbols-rounded {
  font-size: 14px !important;
}

.overlay-ad-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-ad-content img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

/* Pre-roll Ad Overlay styling */
.video-preroll-ad-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preroll-content {
  position: relative;
  text-align: center;
}

.preroll-timer {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 32px;
  height: 32px;
  background-color: var(--accent-color);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(58, 166, 255, 0.4);
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

@media (max-width: 900px) {
  .ad-sidebar-left {
    display: none !important;
  }
}

#video-modal .modal-content {
  max-width: 880px;
}

/* Outer Surrounding Advertisement Layout */
.outer-ads-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 1620px;
  margin: 0 auto;
  box-sizing: border-box;
}

.outer-ads-middle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.outer-ad-side {
  width: 300px;
  height: 700px;
  background-color: #1a1a1a;
  border: 2px dashed #444;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
  box-sizing: border-box;
  flex-shrink: 0;
}

.outer-ad-top, .outer-ad-bottom {
  width: 1000px;
  height: 120px;
  background-color: #1a1a1a;
  border: 2px dashed #444;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.outer-ad-top img, .outer-ad-bottom img, .outer-ad-side img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* Hide outer ads on smaller screen bounds to avoid squishing modal content */
@media (max-width: 1620px) {
  .outer-ad-side {
    display: none !important;
  }
}

.outer-ad-mobile-top, .outer-ad-mobile-bottom {
  display: none !important;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS AND BOTTOM NAVIGATION HARDENING
   ========================================================================== */

/* Mobile Bottom Navigation Bar styling */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  z-index: 1000;
  align-items: center;
  justify-content: space-around;
  padding: 4px 8px;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.3);
}

.bottom-nav-item {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-main);
  flex: 1;
  transition: var(--transition-smooth);
  padding: 4px 0;
  border-radius: 8px;
}

.bottom-nav-item:active {
  background-color: var(--bg-tertiary);
}

.bottom-nav-item .material-symbols-rounded {
  font-size: 22px !important;
}

.bottom-nav-item.active {
  color: var(--accent-color);
}

.bottom-nav-item.active .material-symbols-rounded {
  font-variation-settings: 'FILL' 1;
}

.sticky-anchor-ad {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 728px;
  height: 90px;
  background-color: rgba(15, 15, 15, 0.95);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  z-index: 1500;
  display: none; /* activated dynamically via JS if ad is configured */
  align-items: center;
  justify-content: center;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.6);
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.close-sticky-ad {
  position: absolute;
  top: 6px;
  right: 6px;
  background-color: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: var(--transition-smooth);
}

.close-sticky-ad:hover {
  background-color: var(--danger-color) !important;
  border-color: var(--danger-color);
}

.close-sticky-ad .material-symbols-rounded {
  font-size: 14px !important;
}

.sticky-ad-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sticky-ad-content img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mobile Media Queries (width <= 576px) */
@media (max-width: 576px) {
  /* Show bottom navigation bar */
  .bottom-nav {
    display: flex !important;
  }

  /* Force main content full width and pad the bottom so nav bar doesn't overlay cards */
  .main-content {
    margin-left: 0 !important;
    padding: 12px !important;
    padding-bottom: 80px !important;
  }

  /* Transform Left Sidebar into a sliding Drawer overlay on mobile */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -280px; /* Hidden offscreen */
    width: 260px !important;
    z-index: 1010;
    background-color: var(--bg-secondary);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.7);
    transition: var(--transition-smooth);
    border-right: 1px solid var(--border-color);
    display: flex !important; /* Force flex display even if collapsed */
  }

  .sidebar.active-mobile {
    left: 0 !important;
  }

  /* Sidebar items resetting to normal text drawer lists */
  .sidebar-text, .sidebar-heading {
    display: block !important;
  }

  .sidebar-item {
    justify-content: flex-start !important;
    padding: 12px 16px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
  }

  /* Mobile Backdrop Overlay */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1005;
    animation: fadeIn 0.25s ease;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  /* Header sizing adjustments */
  .menu-btn {
    display: none !important;
  }

  .logo-text, .admin-header-subtitle {
    display: none !important; /* Hide logo text to fit search bar on extremely small screens */
  }

  .logo-img {
    height: 42px !important;
  }

  .admin-sidebar {
    display: none !important; /* Hide admin sidebar on mobile, using bottom nav navigation instead */
  }

  .header-left {
    gap: 8px;
  }

  /* Optimize search bar to fit on 1 row */
  .header-center {
    flex: 1;
    margin: 0 4px;
  }

  .search-form {
    padding-left: 8px;
  }

  .search-category-select, .search-divider {
    display: none !important;
  }
  
  .search-input {
    font-size: 14px;
    padding: 6px 0;
  }

  .search-btn {
    padding: 0 12px;
  }

  .theme-toggle-wrapper {
    display: none !important; /* Hide theme switch on small headers, they can set it in profile */
  }

  /* Grid layout to stack video cards nicely */
  .video-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .video-card {
    border-radius: 8px;
  }

  /* Video Modal Player adjustments to fit small screens */
  .modal-overlay {
    padding: 8px !important;
  }

  .modal-content {
    max-height: 98vh;
    border-radius: 8px;
  }

  .modal-details {
    padding: 16px !important;
    max-height: calc(98vh - 250px) !important;
  }

  .modal-title {
    font-size: 17px !important;
  }

  .modal-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
  }

  #modal-fav-btn {
    margin-left: 0 !important;
    margin-top: 6px;
    display: flex !important;
    width: fit-content;
  }

  /* Stack ended recommendation videos vertically on mobile screens */
  .ended-video-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .ended-card {
    flex-direction: row;
    align-items: center;
    background-color: var(--bg-tertiary);
    padding: 8px;
    border-radius: 8px;
  }

  .ended-thumb {
    width: 100px !important;
    height: 56px !important;
    padding-top: 0 !important;
    border-radius: 6px;
  }

  .ended-title {
    font-size: 11px !important;
    -webkit-line-clamp: 1;
  }

  /* Hide desktop outer ads on mobile */
  .outer-ad-top, .outer-ad-bottom, .outer-ad-left, .outer-ad-right {
    display: none !important;
  }

  /* Show mobile-specific outer ads on mobile viewports */
  .outer-ad-mobile-top, .outer-ad-mobile-bottom {
    display: flex !important;
    width: 100%;
    max-width: 480px;
    height: 80px;
    background-color: #1a1a1a;
    border: 2px dashed #444;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    color: #666;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 12px;
    box-sizing: border-box;
    flex-shrink: 0;
    margin: 8px auto;
    overflow: hidden;
  }
  
  .outer-ad-mobile-top img, .outer-ad-mobile-bottom img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
  }

  /* Stack auth form tabs vertically if needed */
  .auth-modal-content {
    width: calc(100% - 24px) !important;
    max-width: 380px !important;
    padding: 24px 16px !important;
    margin: 40px auto !important;
    max-height: calc(100vh - 120px) !important;
    overflow-y: auto !important;
  }

  /* Mobile Sticky Bottom Floating Banner Ad Overrides */
  .sticky-anchor-ad {
    bottom: 64px; /* clears the mobile bottom nav bar */
    max-width: 480px;
    height: 60px;
    border-radius: 8px 8px 0 0;
  }

  /* Mobile Video Inner Overlay Ad Overrides */
  .video-inner-overlay-ad {
    bottom: 50px;
    width: 90%;
    height: 48px;
    padding-right: 30px;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
