/* ==========================================================================
   MEDIA HUB 2.0.0 - DESIGN SYSTEM & CORE STYLES
   ========================================================================== */

:root {
  --bg-app: #0c0e14;
  --bg-sidebar: #12151e;
  --bg-card: #181c28;
  --bg-card-hover: #202536;
  --bg-input: #11131a;
  --border-color: #262c3e;
  --border-subtle: #1e2333;
  --border-focus: rgba(0, 122, 204, 0.6);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent: #007acc;
  --accent-rgb: 0, 122, 204;
  --accent-hover: #008be6;
  --accent-glow: rgba(0, 122, 204, 0.35);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --purple: #a855f7;
  --purple-bg: rgba(168, 85, 247, 0.12);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 18px var(--accent-glow);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 68px;
  --header-height: 64px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  min-height: -webkit-fill-available;
  background-color: #0c0e14 !important;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* App Layout */
.app-layout {
  display: flex;
  /* v2.5.141: kolumna — baner administracyjny (góra) + rząd (sidebar + treść) */
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  background-color: #0c0e14;
}

/* v2.5.141: rząd layoutu (sidebar + main-wrapper) wypełnia przestrzeń pod banerem */
.app-layout-row {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
}

/* v2.5.141: globalny baner „Aplikacja jest w trakcie aktualizacji" (włączany przez Administratora) */
.maintenance-banner {
  flex: 0 0 auto;
  width: 100%;
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 50%, #f59e0b 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  z-index: 100;
  animation: bannerIn 0.25s ease-out;
}

/* v2.6.19: globalny czerwony baner błędu krytycznego (włączany przez Administratora) */
.critical-banner {
  flex: 0 0 auto;
  width: 100%;
  background: linear-gradient(90deg, #991b1b 0%, #dc2626 50%, #991b1b 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 14px rgba(220, 38, 38, 0.4);
  z-index: 101;
  animation: bannerIn 0.25s ease-out;
  color: #fff;
}

.module-lock-badge {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  font-size: 13px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.6));
  animation: pulseLock 2s infinite ease-in-out;
  cursor: help;
}

@keyframes pulseLock {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.1); opacity: 1; }
}

@keyframes bannerIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, visibility 0.25s ease;
  z-index: 50;
}

.sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border-right: none !important;
  overflow: hidden !important;
  visibility: hidden;
  opacity: 0;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-color);
}

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

.brand-icon {
  font-size: 22px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.2), rgba(var(--accent-rgb), 0.05));
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: 0 0 12px var(--accent-glow);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.brand-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Nav Groups & Items */
.nav-group {
  margin-bottom: 4px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-group-header:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.nav-label {
  flex: 1;
}

.nav-arrow {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform var(--transition-fast);
}

.nav-group.collapsed .nav-arrow {
  transform: rotate(-90deg);
}

.nav-group.collapsed .nav-group-items {
  display: none;
}

.nav-group-items {
  padding-left: 24px;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-main);
  transform: translateX(2px);
}

.nav-item.active {
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--accent);
}

.sub-icon {
  font-size: 13px;
}

.nav-single {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
}

.nav-settings-item {
  padding: 10px 12px;
}

/* Mini Stats Footer */
.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}

.stats-mini {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

.stats-mini span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-app);
  height: 100%;
  overflow: hidden;
}

/* Top Header */
.top-header {
  height: var(--header-height);
  min-height: var(--header-height);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}

.top-header.player-expanded {
  min-height: 92px;
  padding: 6px 24px;
}

/* ============================================================
   Spotify "Now Playing" (v2.5.19)
   Lekki, globalny odtwarzacz na górnym pasku — pokazuje PRAWDZIWY
   utwór aktualnie grający na Spotify (nawet ten uruchomiony prywatnie
   w aplikacji / na innym urządzeniu) oraz sterowanie: ⏮ ⏯ ⏭ + otwórz
   w aplikacji Spotify. Stan pobierany z Web API (currently-playing),
   odświeżany co ~5 s (pauza gdy karta w tle).
   ============================================================ */
#top-spotify-player-container {
  flex: 1;
  min-width: 0;
  max-width: 640px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 10px;
}

.spnp-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 14px;
  background: #0f172a;
  border: 1px solid rgba(30, 215, 96, 0.35);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.spnp-bar.spnp-playing {
  border-color: rgba(30, 215, 96, 0.85);
  box-shadow: 0 3px 16px rgba(30, 215, 96, 0.25);
}

.spnp-art-wrap {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.spnp-art {
  width: 40px;
  height: 40px;
  object-fit: cover;
  display: block;
}

.spnp-art-ph {
  font-size: 20px;
  line-height: 1;
}

.spnp-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.spnp-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.spnp-sub {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  margin-top: 1px;
  display: flex;
  align-items: center;
  min-width: 0;
}

.spnp-controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.spnp-ctrls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.spnp-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  border-radius: 9px;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
  user-select: none;
}

.spnp-btn:hover {
  background: rgba(30, 215, 96, 0.22);
  border-color: #1ed760;
  color: #fff;
  transform: scale(1.05);
}

.spnp-btn-main {
  min-width: 36px;
  height: 34px;
  background: #1ed760;
  border-color: #1ed760;
  color: #04140a;
  font-size: 15px;
  font-weight: 700;
}

.spnp-btn-main:hover {
  background: #22e367;
  color: #04140a;
}

.spnp-btn-accent {
  min-width: auto;
  height: 30px;
  padding: 0 14px;
  background: #1ed760;
  border-color: #1ed760;
  color: #04140a;
  font-size: 12px;
  font-weight: 700;
}

.spnp-btn-accent:hover {
  background: #22e367;
  color: #04140a;
}

/* v2.5.29: przycisk „Oznacz jako przesłuchane” (🏆) w belce Spotify — subtelny złoty akcent. */
.spnp-btn-marklistened {
  min-width: 32px;
  height: 30px;
  font-size: 15px;
  line-height: 1;
}

.spnp-btn-marklistened:hover {
  background: rgba(251, 191, 36, 0.28);
  border-color: #fbbf24;
  color: #fbbf24;
}

/* v2.5.83: przycisk „Oznacz jako polubione” (❤️) w belce Spotify — zsynchronizowany z mechaniką kolejki */
.spnp-btn-markliked {
  min-width: 32px;
  height: 30px;
  font-size: 15px;
  line-height: 1;
  color: #f43f5e;
}

.spnp-btn-markliked:hover {
  background: rgba(244, 63, 94, 0.28);
  border-color: #f43f5e;
  color: #f43f5e;
}

/* v2.5.30 / v2.5.80: zablokowany przycisk „Oznacz jako przesłuchane” (utwór jest już w Rankingu lub brak w kolejce — muzyka prywatna) */
.spnp-btn-disabled {
  opacity: 0.35;
  cursor: not-allowed !important;
  pointer-events: auto;
  filter: grayscale(1);
  background: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #64748b !important;
}
.spnp-btn-disabled:hover {
  background: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #64748b !important;
  transform: none !important;
}

@media (max-width: 720px) {
  #top-spotify-player-container { max-width: 320px; }
  .spnp-sub { display: none; }
  .spnp-btn { min-width: 28px; height: 28px; padding: 0 6px; }
}

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

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--text-dim);
}

.module-breadcrumbs {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.breadcrumb-cat {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.breadcrumb-separator {
  color: var(--border-color);
  font-size: 13px;
}

.breadcrumb-active {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

.header-center {
  flex: 1;
  max-width: 480px;
}

.global-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.global-search-box .search-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  color: var(--text-dim);
}

.global-search-box input {
  width: 100%;
  height: 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 65px 0 36px;
  color: var(--text-main);
  font-size: 13px;
  transition: all var(--transition-fast);
}

.global-search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2);
}

.search-kbd {
  position: absolute;
  right: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
}

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

/* Color Accent Picker */
.color-picker-dropdown {
  position: relative;
}

.theme-accent-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-accent-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.accent-circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.color-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.color-menu.hidden {
  display: none;
}

.color-menu-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.swatch:hover {
  transform: scale(1.15);
  border-color: #fff;
}

.color-custom-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

.color-custom-input input[type="color"] {
  background: none;
  border: none;
  width: 28px;
  height: 28px;
  cursor: pointer;
  border-radius: 4px;
}

/* Content Container & Module Panes */
.content-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden; /* v2.6.33: blokada poziomego scrollbara na poziomie całego widoku */
  /* v2.5.25: FIX przewijania — klasyczny flexbox-overflow bug. Jako element flex w
     kolumnie .main-wrapper domyślnie ma min-height:auto, więc rosł do wysokości treści,
     overflow-y:auto nie startował, a dolna część była przycinana przez overflow:hidden.
     min-height:0 pozwala mu się skurczyć do wysokości kontenera i przewijać wewnątrz. */
  min-height: 0;
  min-width: 0;
  width: 100%;
  padding: 24px;
  position: relative;
  box-sizing: border-box;
}

.module-view {
  display: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  animation: fadeIn 0.2s ease-out;
}

.module-view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Zapobieganie niepożądanemu autouzupełnianiu Chrome poza stroną logowania */
input:not(#login-username):not(#login-password):-webkit-autofill,
input:not(#login-username):not(#login-password):-webkit-autofill:hover,
input:not(#login-username):not(#login-password):-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text-main) !important;
  -webkit-box-shadow: 0 0 0px 1000px #151923 inset !important;
  box-shadow: 0 0 0px 1000px #151923 inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

