/* ==========================================================================
   MAIN THEME & LAYOUT STYLES - SCHOOLBROS CLONE
   ========================================================================== */

:root {
  /* --- Black & White Liquid Glass theme --- */
  --bg-primary: #050506;
  --bg-secondary: rgba(255, 255, 255, 0.045);
  --bg-card: rgba(255, 255, 255, 0.06);
  --bg-card-hover: rgba(255, 255, 255, 0.13);
  --bg-glass: rgba(16, 16, 18, 0.55);

  --accent-purple: #ffffff;
  --accent-purple-light: #e5e5e7;
  --accent-purple-glow: rgba(255, 255, 255, 0.22);
  --accent-cyan: #d1d1d6;
  --accent-cyan-light: #e5e5e7;
  --accent-pink: #d1d1d6;
  --accent-amber: #d1d1d6;
  --accent-emerald: #d1d1d6;
  --accent-rose: #d1d1d6;

  --text-main: #f5f5f7;
  --text-muted: #a1a1a6;
  --text-dim: #78787d;

  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(255, 255, 255, 0.55);

  --glass-blur: saturate(170%) blur(22px);

  --sidebar-width: 240px;
  --sidebar-collapsed-width: 68px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

html, body {
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(1100px 620px at 78% -8%, rgba(255,255,255,0.10), transparent 60%),
    radial-gradient(900px 560px at 8% 108%, rgba(255,255,255,0.06), transparent 60%),
    linear-gradient(180deg, #0a0a0c 0%, #050506 60%, #000000 100%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #2a2e45;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b4162;
}

/* App Container */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ==========================================================================
   TOP HEADER
   ========================================================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  transition: padding var(--transition-normal);
}

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

.sidebar-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.sidebar-toggle-btn:hover {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--accent-purple);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.brand-logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--accent-purple-glow);
}
.brand-name {
  background: linear-gradient(135deg, #fff 40%, var(--accent-cyan-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-tag {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-light));
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-left: 2px;
}

/* Header Search */
.header-search {
  flex: 1;
  max-width: 520px;
  margin: 0 24px;
  position: relative;
}
.search-input-wrapper {
  position: relative;
  width: 100%;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 0 42px 0 42px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: all var(--transition-fast);
}
.search-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
  background: #1a1c2c;
}
.search-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: #25283d;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #333854;
  pointer-events: none;
}
.search-clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: none;
  padding: 4px;
}
.search-clear-btn:hover {
  color: var(--text-main);
}

/* Header Right Actions */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-header-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
  height: 38px;
  padding: 0 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-header-pill:hover {
  background: var(--bg-card-hover);
  color: #fff;
  border-color: #475569;
}

.btn-notification {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-notification:hover {
  background: var(--bg-card-hover);
  color: #fff;
}
.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #8e8e93;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-primary);
}

.btn-login-lime {
  background: #ffffff;
  color: #000000;
  border: none;
  height: 38px;
  padding: 0 22px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(203, 245, 92, 0.3);
  transition: all var(--transition-fast);
}
.btn-login-lime:hover {
  background: #f2f2f4;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(203, 245, 92, 0.45);
}

.btn-header-action {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-header-action:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--accent-purple);
}
.btn-header-action.primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-light));
  color: #fff;
  border: none;
  box-shadow: 0 2px 10px var(--accent-purple-glow);
}
.btn-header-action.primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.badge-count {
  background: var(--accent-rose);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
}

/* ==========================================================================
   LEFT SIDEBAR (COLLAPSIBLE)
   ========================================================================== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  padding: 16px 10px 24px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  z-index: 90;
  transition: width var(--transition-normal);
}

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

.sidebar-heading {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 12px 14px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition-fast);
}
.app-container.sidebar-collapsed .sidebar-heading {
  opacity: 0;
  pointer-events: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-main);
}
.nav-item.active {
  background: rgba(124, 58, 237, 0.16);
  color: #d1d1d6;
  border-left: 3px solid var(--accent-purple);
}
.nav-item-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item-count {
  font-size: 11px;
  background: #23273c;
  color: var(--text-dim);
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 700;
}
.app-container.sidebar-collapsed .nav-item-label,
.app-container.sidebar-collapsed .nav-item-count {
  display: none;
}
.app-container.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 10px 6px;
}

/* ==========================================================================
   MAIN CONTENT WRAPPER
   ========================================================================== */
.main-wrapper {
  flex: 1;
  min-width: 0; /* allow carousels to scroll instead of stretching the flex item */
  overflow-x: hidden;
  margin-top: var(--header-height);
  margin-left: var(--sidebar-width);
  padding: 24px 32px 60px 32px;
  min-height: calc(100vh - var(--header-height));
  transition: margin-left var(--transition-normal);
}

.app-container.sidebar-collapsed .main-wrapper {
  margin-left: var(--sidebar-collapsed-width);
}

/* View Sections */
.view-section {
  display: none;
  animation: fadeIn 0.2s ease;
}
.view-section.active {
  display: block;
}

#player-view {
  animation: none !important;
  transform: none !important;
}

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

/* Responsive adjustments */
@media (max-width: 900px) {
  :root {
    --sidebar-width: 0px;
    --sidebar-collapsed-width: 0px;
  }
  .sidebar {
    transform: translateX(-100%);
    width: 240px !important;
  }
  .app-container.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0 !important;
    padding: 16px;
  }
  .header-search {
    margin: 0 10px;
  }
}
