/* Video Duration Badge */
.video-duration {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 2px 4px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 4px;
  pointer-events: none;
  line-height: 1;
}

.video-published {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 2px 4px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 4px;
  pointer-events: none;
  line-height: 1;
}

.videoWrapper {
  width: auto; /* Reset fixed width */
  margin: 0;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
  cursor: pointer;
}

.videoMiniature {
  width: 100%;
  aspect-ratio: 16/9; /* Modern aspect ratio check */
  height: auto;
  border-radius: var(--radius-md);
  background-size: cover;
  background-position: center;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
  background-color: #e2e8f0; /* Fallback color */
  position: relative;
  display: block;
}

.videoWrapper:hover .videoMiniature {
  box-shadow: var(--shadow-md), var(--shadow-md);
}

.videoWrapper:hover .videoTitle {
  text-shadow: 1px 1px 0.2rem rgb(0 0 0 / 30%);
}

.videoTitle {
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--color-text-main);
  font-weight: 500;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  text-align: left; /* Reset center align */
}

/* Heart Icon for Favorites */
.heart-icon {
  width: 24px;
  height: 24px;
  cursor: pointer;
  fill: none; /* Empty heart by default */
  stroke: var(--color-text-muted);
  stroke-width: 2;
  transition: all 0.2s ease;
  margin-left: 1rem;
}

.heart-icon.active {
  fill: #ef4444; /* Red fill */
  stroke: #ef4444;
  transform: scale(1.1);
}

.heart-icon:hover {
  transform: scale(1.1);
  stroke: #ef4444;
}

.channelWrapper {
  width: 100%;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  box-sizing: border-box;
  overflow: hidden;
  background-color: #f6f6f6;
  border: 1px solid rgb(0 0 0 / 13%);
  border-bottom: 0;
}

.channelWrapper:first-child {
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.channelWrapper:last-child {
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  border-bottom: 1px solid rgb(0 0 0 / 13%);
}

.channeltitleBar {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 1rem 1.5rem 0.5rem 1.5rem;
}

.channeltitleLogo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  margin-right: 0.75rem;
  box-shadow: var(--shadow-sm);
  background-color: #cbd5e1;
}

.channeltitleText {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-main);
  cursor: pointer;
  transition: color 0.15s;
}

.channeltitleText:hover {
  color: var(--color-primary);
}

.lastPublished {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Channel Tags */
.channelTags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
}

.tag-chip {
  background-color: var(--color-bg-app);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: default;
}

.tag-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.tag-remove {
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  line-height: 0.8;
  opacity: 0.5;
}

.tag-remove:hover {
  opacity: 1;
  color: #ef4444;
}

.tag-add-btn {
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: 12px;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  padding: 2px 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.tag-add-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.tag-input {
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  outline: none;
  width: 100px;
}

/* Video Grid */
.channelVideosWrapper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  padding: 0 1.5rem 1.5rem 1.5rem;
}

/* Responsive Grid Breakpoints */

/* < 900px -> 3 columns */
@media (max-width: 900px) {
  .channelVideosWrapper {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* < 500px -> 2 columns */
@media (max-width: 500px) {
  .channelVideosWrapper {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* < 320px -> 1 column */
@media (max-width: 320px) {
  .channelVideosWrapper {
    grid-template-columns: 1fr;
  }
}

/* Header / Command Panel */
.commandPanel {
  background-color: var(--color-bg-sidebar);
  border-bottom: 1px solid var(--color-border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 50;
  height: var(--header-height);
  box-sizing: border-box;
  flex-shrink: 0;
  position: relative;
  background-color: #f3f3f3;
  box-shadow: 0rem 0.5rem 0.5rem rgba(0, 0, 0, 0.2);
  /* Remove space-between if we rely on margins, or keep it as failsafe */
  justify-content: flex-start;
}

.commandPanel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-main);
  white-space: nowrap;
  margin-right: 0; /* Push controls to right - overridden at bottom of style.css, keeping 0 */
}

.commandPanel-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

/* Nav Controls Group */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  justify-content: flex-end;
}

/* Inputs & Selects */
.input-control {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  background-color: var(--color-surface);
  color: var(--color-text-main);
  min-width: 150px;
}

.input-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Mobile Menu Toggle (Hamburger) */
.menu-toggle {
  display: none; /* Hidden on Desktop */
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--color-text-main);
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

/* --- MENU DROPDOWN & HAMBURGER --- */

.menu-toggle-wrapper {
  display: flex;
  align-items: center;
  position: relative;
}

.hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--color-text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: background-color 0.2s;
}

.hamburger-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.hamburger-btn svg {
  width: 24px;
  height: 24px;
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 240px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md); /* Slight border radius */
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  padding: 0.5rem 0;
  z-index: 100;
}

.menu-dropdown.open {
  display: flex;
}

.menu-label {
  padding: 0.5rem 1rem 0.25rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.menu-item {
  margin: 0.25rem 1rem;
  width: auto; /* Override default input-control/button widths */
  box-sizing: border-box;
}

select.menu-item {
  width: calc(100% - 2rem);
}

.menu-btn {
  text-align: left;
  justify-content: flex-start;
  border: none;
  background: none;
  box-shadow: none;
  padding: 0.5rem 1rem;
  margin: 0;
  border-radius: 0;
  width: 100%;
}

.menu-btn:hover {
  background-color: #f1f5f9;
  transform: none; /* Disable button1 lift effect for menu items if preferred */
}

.menu-separator {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0.5rem 0;
  width: 100%;
}

/* Override input-control in menu to look better */
.menu-dropdown .input-control {
  font-size: 0.9rem;
  padding: 0.4rem;
}
.menu-container {
  position: relative;
  display: flex;
  align-items: center;
  width: auto;
}

/* Desktop Filter/Sort Controls */
.desktop-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  margin-right: 0.5rem; /* Little gap between controls and hamburger */
}

@media (max-width: 768px) {
  /* Mobile Header */
  .commandPanel {
    padding: 0 1rem;
    justify-content: space-between;
  }

  .commandPanel-header {
    margin-right: 0;
  }

  .menu-toggle {
    display: block;
    margin-left: auto;
  }

  /* Mobile Dropdown Menu */
  .nav-controls {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--color-bg-sidebar);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    box-sizing: border-box;
    gap: 1rem;
    display: none; /* JS toggles 'flex' */
  }

  .nav-controls.open {
    display: flex;
  }

  /* Hide desktop controls on mobile */
  .desktop-controls {
    display: none;
  }

  /* On mobile, push menu to the right since desktop-controls is hidden */
  .menu-container {
    margin-left: auto;
  }
}

/* Hide filter/sort from menu on desktop */
@media (min-width: 769px) {
  .menu-dropdown .menu-label,
  .menu-dropdown .menu-item.input-control {
    display: none;
  }
  .menu-dropdown hr:first-of-type {
    display: none;
  }
}

.no-subscriptions-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.logConsole {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 400px;
  max-width: 90vw;
  height: 300px;
  background-color: rgba(15, 23, 42, 0.95);
  color: #e2e8f0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 1rem;
  border-top-left-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none; /* Toggled via JS */
  overflow-y: auto;
  z-index: 60;
  backdrop-filter: blur(4px);
}

/* Progress Bar - Centered & Larger */
.progress-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  max-width: 600px;
  height: 12px;
  background-color: rgba(226, 232, 240, 0.8); /* Light track */
  border-radius: 12px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  overflow: hidden;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.2),
    0 8px 10px -6px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(2px);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #ec4899, #8b5cf6, #2563eb);
  background-size: 200% 100%;
  animation: gradientMove 1.5s linear infinite;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.6);
  transition: width 0.3s ease-out;
  border-radius: 12px;
}

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

/* Main Loading Message (Above Bar) */
.loading-message-main {
  position: fixed;
  top: calc(50% - 30px); /* Above centered bar */
  left: 50%;
  transform: translate(-50%, -10px);
  color: #000;
  font-size: 1.1rem;
  font-weight: 600;
  pointer-events: none;
  z-index: 1001;
  opacity: 0;
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
  white-space: nowrap;
}

.loading-message-main.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Sub Loading Message (Below Bar) */
.loading-message-sub {
  position: fixed;
  top: calc(50% + 20px); /* Below centered bar */
  left: 50%;
  transform: translate(-50%, 10px);
  color: #333; /* Slightly lighter/smaller */
  font-size: 0.95rem;
  font-weight: 500;
  pointer-events: none;
  z-index: 1001;
  opacity: 0;
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
  white-space: nowrap;
}

.loading-message-sub.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.loading-message.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Footer */
.footer {
  background-color: #f3f3f3;
  border-top: 1px solid var(--color-border);
  padding: 0.5rem;
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  box-shadow: 0rem -0.5rem 0.5rem rgba(0, 0, 0, 0.1);
  z-index: 50;
}

.footer a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s;
  font-weight: 500;
}

.footer a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* Login Prompt - Centered, shown when not logged in */
.login-prompt {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  z-index: 1000;
  text-align: center;
}

.login-prompt-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text-main);
}

.login-prompt-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

.login-prompt-desc {
  font-size: 1.3rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-top: -0.5rem; /* Pull closer to title */
}

.login-prompt-button {
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
}

:root {
  /* Palette */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-bg-app: #f8fafc;
  --color-bg-sidebar: #a1a1a1;
  --color-bg-content: #ffffff;
  --color-surface: #ffffff;
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Spacing & Sizes */
  --sidebar-width: 260px;
  --header-height: 60px;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;

  font-family:
    'Inter',
    system-ui,
    -apple-system,
    sans-serif;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: var(--color-bg-app);
  color: var(--color-text-main);
  font-size: 14px;
  overflow: hidden; /* App container handles scroll */
}

/* Base Utility Classes */
.noselect {
  user-select: none;
  -webkit-user-select: none;
}

/* Buttons */
.button1 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-weight: 500;

  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  border-radius: 5rem;

  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.button1:hover:not(.disabled) {
  box-shadow: 0rem 0rem 0.5rem rgb(223 118 216);
}

.button1:active:not(.disabled) {
  transform: translateY(0);
}

.disabled {
  opacity: 0.5;
  pointer-events: none;
  background-color: #f1f5f9;
}

@keyframes blinkRed {
  0% {
    border-color: var(--color-border);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    color: var(--color-text-main);
  }
  50% {
    border-color: #ef4444;
    box-shadow: 0 0 10px 0 rgba(239, 68, 68, 0.3);
    color: #ef4444;
  }
  100% {
    border-color: var(--color-border);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    color: var(--color-text-main);
  }
}

.blink-red {
  animation: blinkRed 2s infinite ease-in-out;
}

/* App Layout: Vertical Stack (Header + Content) */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Main Content Area */
.mainApp {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  background-color: var(--color-bg-content);
  scroll-behavior: smooth;
}

@media (max-width: 768px) {
  /* Content adjustment */
  .content {
    padding: 1rem;
  }
}

