/* CSS Reset & Variables */
:root {
  --bg-primary: hsl(225, 20%, 97%);
  --bg-secondary: hsl(0, 0%, 100%);
  --bg-tertiary: hsl(225, 15%, 92%);
  --accent-primary: rgb(92, 37, 123);
  --accent-primary-glow: rgba(92, 37, 123, 0.15);
  --accent-secondary: rgb(92, 37, 123);
  --accent-secondary-glow: rgba(92, 37, 123, 0.15);
  --text-main: hsl(225, 25%, 15%);
  --text-muted: hsl(225, 10%, 45%);
  --text-dim: hsl(225, 8%, 62%);
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(0, 0, 0, 0.07);
  --glass-highlight: rgba(255, 255, 255, 0.8);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"],
[data-theme="system"] {
  /* Default dark rules when dark attribute or system is dark */
}

html[data-theme="dark"] {
  --bg-primary: hsl(225, 20%, 10%);
  --bg-secondary: hsl(225, 18%, 15%);
  --bg-tertiary: hsl(225, 15%, 22%);
  --accent-primary: rgb(165, 88, 208);
  --accent-primary-glow: rgba(165, 88, 208, 0.2);
  --accent-secondary: rgb(165, 88, 208);
  --accent-secondary-glow: rgba(165, 88, 208, 0.2);
  --text-main: hsl(225, 20%, 94%);
  --text-muted: hsl(225, 10%, 70%);
  --text-dim: hsl(225, 8%, 50%);
  --glass-bg: rgba(25, 28, 38, 0.85);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-highlight: rgba(255, 255, 255, 0.05);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg-primary: hsl(225, 20%, 10%);
    --bg-secondary: hsl(225, 18%, 15%);
    --bg-tertiary: hsl(225, 15%, 22%);
    --accent-primary: rgb(165, 88, 208);
    --accent-primary-glow: rgba(165, 88, 208, 0.2);
    --accent-secondary: rgb(165, 88, 208);
    --accent-secondary-glow: rgba(165, 88, 208, 0.2);
    --text-main: hsl(225, 20%, 94%);
    --text-muted: hsl(225, 10%, 70%);
    --text-dim: hsl(225, 8%, 50%);
    --glass-bg: rgba(25, 28, 38, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.05);
  }
}


* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
}

/* Hide overall application scroll bars but preserve scrolling functionality */
::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

html, body, * {
  -ms-overflow-style: none !important;  /* IE and Edge */
  scrollbar-width: none !important;  /* Firefox */
}

/* Background interactive glow effects */
.radial-bg {
  display: none;
}

/* App Loading Screen */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.spinner {
  width: 50px;
  height: 50px;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23000'%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(30 50 50)' opacity='0.083'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(60 50 50)' opacity='0.166'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(90 50 50)' opacity='0.25'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(120 50 50)' opacity='0.333'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(150 50 50)' opacity='0.416'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(180 50 50)' opacity='0.5'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(210 50 50)' opacity='0.583'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(240 50 50)' opacity='0.666'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(270 50 50)' opacity='0.75'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(300 50 50)' opacity='0.833'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(330 50 50)' opacity='0.916'/%3E%3C/g%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23000'%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(30 50 50)' opacity='0.083'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(60 50 50)' opacity='0.166'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(90 50 50)' opacity='0.25'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(120 50 50)' opacity='0.333'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(150 50 50)' opacity='0.416'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(180 50 50)' opacity='0.5'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(210 50 50)' opacity='0.583'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(240 50 50)' opacity='0.666'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(270 50 50)' opacity='0.75'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(300 50 50)' opacity='0.833'/%3E%3Crect x='46.5' y='18' width='7' height='16' rx='3.5' ry='3.5' transform='rotate(330 50 50)' opacity='0.916'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
  background-color: var(--accent-primary);
  animation: spin 1s steps(12, end) infinite;
  display: inline-block;
}

.loading-text {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: pulse 1.5s ease-in-out infinite;
}

/* Common Layout Containers */
#app {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.view-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: fadeIn var(--transition-normal) forwards;
  overflow: hidden;
}

/* Premium Card (Glassmorphism) */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.06);
  border-radius: var(--radius-md);
  padding: 32px;
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  display: none;
}

/* Typography Utility */
.text-gradient-purple-cyan {
  color: var(--text-main);
}

/* General Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-primary-glow);
}

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

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

.btn-secondary:hover {
  background: hsl(225, 15%, 86%);
  border-color: var(--text-muted);
}

/* Keyframes */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

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

/* =========================================
   App Shell Layout (HomeView)
   ========================================= */

.app-shell {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-primary);
}

/* Desktop Sidebar */
.app-sidebar {
  width: 280px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 10;
  transition: transform var(--transition-normal), margin-left var(--transition-normal), width var(--transition-normal);
  position: relative;
}

.app-shell.sidebar-collapsed .app-sidebar {
  width: 68px;
  margin-left: 0;
  align-items: center;
  transition: width var(--transition-normal);
}

.app-shell.sidebar-collapsed .app-sidebar-top {
  padding: 12px 0 4px 0;
  border-bottom: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-shell.sidebar-collapsed .app-brand {
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.app-shell.sidebar-collapsed .app-brand-logo-group {
  cursor: pointer;
}

.app-shell.sidebar-collapsed #desktop-close-sidebar-btn {
  display: none !important;
}

.app-shell.sidebar-collapsed .app-brand-title,
.app-shell.sidebar-collapsed .app-date,
.app-shell.sidebar-collapsed .app-user-info,
.app-shell.sidebar-collapsed .app-nav-item span {
  display: none !important;
}

.app-shell.sidebar-collapsed .app-nav {
  padding: 12px 0;
  align-items: center;
  width: 100%;
}

.app-shell.sidebar-collapsed .app-nav-item {
  justify-content: center;
  padding: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.app-shell.sidebar-collapsed .app-nav-item i {
  margin-right: 0;
  font-size: 18px;
}

.app-shell.sidebar-collapsed .app-sidebar-footer {
  padding: 16px 0;
  border-top: none;
  flex-direction: column-reverse;
  gap: 16px;
  align-items: center;
  width: 100%;
}

.app-shell.sidebar-collapsed .app-user-profile {
  justify-content: center;
  flex: none;
}

.app-shell.sidebar-collapsed .settings-popover {
  left: 0;
  bottom: calc(100% + 8px);
  right: auto;
}

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

.app-btn-icon:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
}

#desktop-close-sidebar-btn {
  display: flex;
}

.app-desktop-open-sidebar {
  display: none;
}

.app-shell.sidebar-collapsed .app-desktop-open-sidebar {
  display: flex;
}

.app-sidebar-top {
  padding: 12px 14px 4px 14px;
  border-bottom: none;
}

.app-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.app-brand-logo-group {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.app-brand-logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.app-brand-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-main);
  line-height: 20px;
}

.app-date {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

/* Sidebar Navigation */
.app-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-nav::-webkit-scrollbar {
  width: 4px;
}
.app-nav::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 4px;
}

.app-nav-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  transition: all var(--transition-fast);
}

.app-nav-item i {
  margin-right: 12px;
  width: 18px;
  text-align: center;
  font-size: 16px;
  color: var(--text-muted);
}

.app-nav-item:hover {
  background: var(--bg-tertiary);
}

.app-nav-item.active {
  background: var(--bg-tertiary);
  color: var(--text-main);
  font-weight: 500;
}
.app-nav-item.active i {
  color: var(--accent-primary);
}

.app-nav-item.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Sidebar Footer (User & Settings) */
.app-sidebar-footer {
  padding: 12px 14px;
  border-top: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.app-user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  flex: 1;
}

.app-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.app-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: 1.3;
}

.app-user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 20px;
}

.app-user-package {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 16px;
}

.app-user-package.pro {
  color: var(--text-muted);
}

.app-settings-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.app-settings-btn:hover {
  background: var(--bg-tertiary);
}

/* Settings Desktop Popover (Reference Screenshot Style) */
.settings-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: auto;
  width: 260px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
  animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-popover.hidden {
  display: none !important;
}

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

.settings-popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  cursor: pointer;
  transition: background var(--transition-fast);
  text-align: left;
  position: relative;
}

.settings-popover-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-popover-item i.item-icon,
.settings-popover-item svg.item-icon {
  width: 18px;
  height: 18px;
  text-align: center;
  color: var(--text-main);
  font-size: 16px;
  flex-shrink: 0;
}

.settings-popover-item i.chevron-icon {
  font-size: 11px;
  color: var(--text-muted);
}

.settings-popover-item:hover,
.settings-popover-item.active-hover {
  background: var(--bg-tertiary);
}

.settings-popover-item.logout {
  color: #d32f2f;
  margin-top: 4px;
  border-top: 1px solid var(--glass-border);
  border-radius: 0 0 10px 10px;
}
.settings-popover-item.logout i.item-icon,
.settings-popover-item.logout svg.item-icon {
  color: #d32f2f;
}

.settings-popover-item.logout:hover {
  background: rgba(211, 47, 47, 0.08);
}

/* Theme Flyout SubMenu */
.theme-flyout-submenu {
  position: absolute;
  left: calc(100% + 6px);
  bottom: -6px;
  width: 170px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 105;
  animation: popoverFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-flyout-submenu.hidden {
  display: none !important;
}

.theme-flyout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.theme-flyout-item:hover {
  background: var(--bg-tertiary);
}

.theme-flyout-item i.check-icon {
  font-size: 13px;
  color: var(--text-main);
  opacity: 0;
}

.theme-flyout-item.active i.check-icon {
  opacity: 1;
}
  background: var(--bg-secondary);
  color: var(--accent-primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Mobile Settings Screen Overlay */
.mobile-settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--bg-primary);
  z-index: 200;
  display: flex;
  flex-direction: column;
  animation: mobileSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-settings-overlay.hidden {
  display: none !important;
}

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

.mobile-settings-header {
  padding: 16px 24px;
  padding-top: calc(16px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.mobile-settings-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.mobile-settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}


/* Main Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.app-main-header {
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.app-main-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.app-main-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.app-mobile-topbar {
  display: none !important;
}

.mobile-menu-toggle-btn {
  display: none !important;
}

.app-btn-menu {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-main);
  cursor: pointer;
  padding: 4px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }
  
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height to prevent hiding under address bar */
    transform: translateX(-100%);
    z-index: 100;
  }
  
  #desktop-close-sidebar-btn {
    display: none !important;
  }

  .app-btn-close-menu {
    display: flex !important;
    background: var(--bg-tertiary);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }
  
  .app-sidebar.open {
    transform: translateX(0);
  }
  
  .mobile-menu-toggle-btn {
    display: flex !important;
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 50;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    font-size: 18px;
    cursor: pointer;
  }
  
  .app-main-header {
    display: none !important;
  }
}

/* iOS Style Bottom Navigation for Dashboard */
.dashboard-ios-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 30px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);
  padding: 10px 24px;
  margin-bottom: 24px;
  width: max-content;
  gap: 32px;
  margin-left: 0; /* Keep it left aligned on desktop under title */
}

.dashboard-ios-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  transition: all var(--transition-fast);
  min-width: 48px;
}

.dashboard-ios-nav-item i {
  font-size: 20px;
  padding: 8px 16px;
  border-radius: 20px;
  transition: all var(--transition-fast);
}

.dashboard-ios-nav-item:hover {
  color: var(--accent-primary);
}

.dashboard-ios-nav-item:hover i {
  background: var(--accent-primary-glow);
}

.dashboard-ios-nav-item.active {
  color: var(--accent-primary);
}

.dashboard-ios-nav-item.active i {
  background: transparent;
  color: var(--accent-primary);
  box-shadow: none;
}

@media (max-width: 768px) {
  .dashboard-ios-nav {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    margin-bottom: 0;
    gap: 0;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 50;
  }
  
  .dashboard-ios-nav-item i {
    padding: 6px 12px;
    font-size: 18px;
  }
  
  .dashboard-ios-nav-item span {
    display: none;
  }
  
  .nav-lock-icon {
    top: 2px;
    right: 6px;
    font-size: 10px;
  }
}

.nav-lock-icon {
  font-size: 10px;
  color: var(--accent-primary);
  position: absolute;
  top: 4px;
  right: 8px;
  font-style: normal;
}

/* Profile Input Responsive Styles */
.profile-input {
  width: 300px; /* 50% of 600px form container max-width */
}

/* Save Button responsive styles */
#profile-save-btn {
  width: auto;
  min-width: 140px;
  padding: 12px 24px;
  font-size: 14px;
  border-radius: var(--radius-full);
  transition: all 0.3s ease;
}

@media (max-width: 768px) {
  .profile-input {
    width: 100%; /* Restore full width on mobile */
  }

  #profile-save-btn {
    position: fixed;
    bottom: 92px; /* 24px bottom + ~56px nav bar height + 12px gap */
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px); /* Match width of text fields (100% minus 16px padding on each side) */
    z-index: 40;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border-radius: var(--radius-sm); /* Match border radius of text fields */
  }

  /* Prevent content from hiding behind the fixed bottom nav and save button */
  #profile-subview-container {
    padding-bottom: 180px !important;
  }

  /* Add blur effect behind mobile bottom navigation to hide scrollable content elegantly */
  .view-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 110px; /* Covers the nav bar and bottom spacing */
    background: linear-gradient(to top, var(--bg-primary) 15%, rgba(255, 255, 255, 0) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    mask-image: linear-gradient(to top, black 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(to top, black 40%, transparent 100%);
    pointer-events: none;
    z-index: 40; /* Sits behind nav (z-index 50) */
  }
}

/* Cubic Calendar */
.ag-cubic-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px;
}
.ag-cubic-row::-webkit-scrollbar {
  display: none;
}
.ag-cubic-day {
  min-width: 90px;
  height: 100px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  box-shadow: 
    -2px 2px 8px rgba(0,0,0,0.05),
    inset 1px 1px 4px rgba(255,255,255,0.7),
    inset -1px -1px 4px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  padding: 10px;
  position: relative;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
  transform-style: preserve-3d;
  perspective: 500px;
}
.ag-cubic-day:hover {
  transform: translateY(-8px) rotateX(4deg) rotateY(-4deg);
  box-shadow: 
    -6px 8px 12px rgba(0,0,0,0.1),
    inset 1px 1px 4px rgba(255,255,255,0.9),
    inset -1px -1px 4px rgba(0,0,0,0.02);
  background: rgba(255,255,255,0.5);
}
.ag-cubic-date {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-primary);
  line-height: 1;
  text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}
.ag-cubic-weekday {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.ag-cubic-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}
.ag-cubic-content::-webkit-scrollbar {
  display: none;
}
.ag-cubic-empty {
  font-size: 8px;
  color: rgba(99, 110, 114, 0.5);
  text-align: center;
  margin-top: auto;
  margin-bottom: auto;
  font-weight: 500;
}
.ag-cubic-item {
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.15) 0%, rgba(162, 155, 254, 0.1) 100%);
  border-radius: 6px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: 1px solid rgba(108, 92, 231, 0.2);
}
.ag-cubic-item-type {
  font-size: 7px;
  font-weight: 700;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ag-cubic-item-title {
  font-size: 8px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-main);
}

.ag-cubic-day.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(92, 37, 123, 0.4), inset 1px 1px 4px rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.7);
  transform: translateY(-5px);
}
.ag-detail-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 24px;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: -2px 2px 10px rgba(0,0,0,0.05);
  animation: fadeIn 0.3s ease forwards;
}
.ag-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding-bottom: 16px;
}
.ag-detail-stats {
  display: flex;
  gap: 32px;
}
.ag-detail-stat {
  display: flex;
  flex-direction: column;
}
.ag-detail-stat-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-primary);
}
.ag-detail-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.ag-detail-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ag-detail-row {
  display: flex;
  gap: 12px;
}
.ag-detail-label {
  font-weight: 700;
  color: var(--text-main);
  min-width: 130px;
  font-size: 14px;
}
.ag-detail-value {
  color: var(--text-muted);
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
}

/* Global Bottom Sheet Confirmation / Alert Popup Styles */
.global-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.global-popup-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.global-popup-card {
  width: 100%;
  max-width: 500px;
  background: #ffffff;
  border-radius: 28px 28px 0 0;
  padding: 20px 24px 32px 24px;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18), 0 -2px 10px rgba(0, 0, 0, 0.05);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.global-popup-overlay.visible .global-popup-card {
  transform: translateY(0);
}

.global-popup-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #cbd5e1;
  margin-bottom: 20px;
}

.global-popup-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.global-popup-icon-box.danger {
  background: #fef2f2;
}

.global-popup-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Google Sans", sans-serif;
  letter-spacing: -0.01em;
}

.global-popup-description {
  font-size: 14px;
  color: #475569;
  margin: 0 0 24px 0;
  line-height: 1.45;
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
}

.global-popup-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.global-popup-actions.single .global-popup-btn {
  width: 100%;
}

.global-popup-btn {
  flex: 1;
  height: 48px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.global-popup-btn-secondary {
  background: #f1f5f9;
  color: #334155;
}

.global-popup-btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.global-popup-btn-primary {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.global-popup-btn-primary:hover {
  background: #1d4ed8;
}

.global-popup-btn-primary.danger {
  background: #ef4444;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}

.global-popup-btn-primary.danger:hover {
  background: #dc2626;
}

/* =========================================
   Global Responsive Side Panel
   ========================================= */

.app-side-panel {
  width: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 90;
  overflow: hidden;
  transition: width var(--transition-normal), opacity var(--transition-normal), transform var(--transition-normal), margin var(--transition-normal), border-radius var(--transition-normal), box-shadow var(--transition-normal);
  opacity: 0;
  position: relative;
}

.side-panel-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: none;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

[data-theme="dark"] .side-panel-header {
  background: rgba(15, 23, 42, 0.4);
}

.side-panel-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
}

.side-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#side-panel-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

#side-panel-close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
}

/* Desktop open state */
@media (min-width: 769px) {
  .app-shell.side-panel-open .app-main {
    flex: 0 0 30% !important;
    width: 30% !important;
    transition: width var(--transition-normal), flex var(--transition-normal);
  }
  
  .app-shell.side-panel-open .app-side-panel {
    width: calc(70% - 68px - 16px) !important;
    opacity: 1 !important;
    margin: 16px 16px 16px 0px !important;
    height: calc(100vh - 32px) !important;
    border-radius: 24px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid var(--glass-border) !important;
  }
  
  /* Expanded open state */
  .app-shell.side-panel-open.side-panel-expanded .app-main {
    flex: 0 0 0% !important;
    width: 0% !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none;
    opacity: 0;
  }
  
  .app-shell.side-panel-open.side-panel-expanded .app-side-panel {
    width: calc(100% - 68px - 16px) !important;
    margin: 16px 16px 16px 0px !important;
  }
}

/* Bezel Expand Trigger Button */
.side-panel-expand-trigger {
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 56px;
  background: #e2e8f0;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: width var(--transition-fast), left var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  color: #64748b;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 0;
}

[data-theme="dark"] .side-panel-expand-trigger {
  background: #334155;
  color: #94a3b8;
}

/* Bezel expand icon: chevron left by default */
.side-panel-expand-trigger::before {
  content: '\f053';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 8px;
  transition: transform var(--transition-fast);
}

/* Rotate / change icon when expanded */
.app-shell.side-panel-expanded .side-panel-expand-trigger::before {
  content: '\f054';
}

/* Hover state: expands slightly, turns dark/accent */
.side-panel-expand-trigger:hover {
  width: 22px;
  left: -12px;
  background: var(--text-main);
  color: var(--bg-primary);
  border-color: var(--text-main);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Mobile responsive state */
@media (max-width: 768px) {
  .app-side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-primary);
    z-index: 150;
    transform: translateX(100%);
    opacity: 1;
    border-left: none;
  }
  
  .app-shell.side-panel-open .app-side-panel {
    transform: translateX(0);
  }
  
  .side-panel-expand-trigger {
    display: none !important;
  }
}

/* Aesthetics components for Insights inside the Panel */
.yt-panel-channel-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.yt-panel-avatar-wrap {
  position: relative;
  width: 80px;
  height: 80px;
}

.yt-panel-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--text-main);
  box-shadow: 0 0 20px rgba(0,0,0,0.15);
}

.yt-panel-channel-name {
  font-size: 20px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
  margin: 0;
}

.yt-panel-channel-handle {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.yt-panel-channel-handle:hover {
  color: var(--text-main);
}

.yt-panel-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.yt-panel-stat-card {
  padding: 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.yt-panel-stat-icon {
  font-size: 16px;
  color: var(--text-muted);
}

.yt-panel-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
}

.yt-panel-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.yt-panel-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin: 8px 0 0 0;
  font-family: 'Outfit', sans-serif;
  border-left: 3px solid var(--text-main);
  padding-left: 8px;
}

.yt-panel-chart-container {
  padding: 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yt-panel-tips-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.yt-panel-tip-item {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  display: flex;
  gap: 12px;
}

.yt-panel-tip-icon {
  font-size: 16px;
  color: #fbbf24;
  margin-top: 2px;
}

.yt-panel-tip-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.yt-panel-tip-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.yt-panel-tip-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* =========================================
   Redesigned Insights Side Panel
   ========================================= */

.side-panel-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.side-panel-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--glass-border);
}

.side-panel-header-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.side-panel-header-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  line-height: 1.25;
}

.side-panel-header-handle {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 1px;
}

.side-panel-header-separator {
  width: 1px;
  height: 24px;
  background: var(--glass-border);
  margin: 0 16px;
  opacity: 0.8;
}

/* Stats Row */
.yt-insights-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 4px 16px 4px;
  margin-bottom: 8px;
}

.yt-insights-stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 1;
}

.yt-insights-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  line-height: 1.1;
}

.yt-insights-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Videos List */
.yt-insights-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin: 16px 0 4px 4px; /* Reduced bottom margin from 12px to 4px */
  font-family: 'Outfit', sans-serif;
}

.yt-insights-videos-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.yt-video-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 16px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
  transition: background-color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, transform 0.15s ease;
}

.yt-video-row:hover {
  background: var(--bg-secondary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  border-color: var(--glass-border);
}

.yt-video-info-flow {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
  margin-right: 12px;
}

.yt-video-title {
  font-size: 14px;
  font-weight: 600;
  color: #000000; /* Show title in black color */
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
}

html[data-theme="dark"] .yt-video-title {
  color: #ffffff; /* Support dark theme white color fallback */
}

.yt-video-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: #64748b; /* Show metadata in gray color */
  margin-top: 2px;
}

html[data-theme="dark"] .yt-video-meta {
  color: #a1a1aa; /* Support dark theme fallback */
}

.yt-video-date {
  color: inherit;
  white-space: nowrap;
}

.yt-video-separator {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  display: inline-block;
}

.yt-video-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: inherit;
  white-space: nowrap;
}

.yt-video-stat i {
  font-size: 12px;
  opacity: 0.85;
}

.yt-video-arrow {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  font-size: 12px;
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.yt-video-row:hover .yt-video-arrow {
  transform: translateX(3px);
  color: var(--text-main);
}

/* Mobile specific styling for Insights side view */
@media (max-width: 768px) {
  .yt-insights-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 12px;
    align-items: start;
  }
  .yt-video-title {
    font-weight: 400; /* Don't show title in bold for mobile version */
  }
}

/* =========================================
   Comparison View Styling
   ========================================= */
.side-panel-compare-btn {
  background: var(--accent-primary, #5c257b);
  color: white !important;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast, 0.2s ease);
  font-family: 'Outfit', sans-serif;
  white-space: nowrap;
}
.side-panel-compare-btn:hover {
  background: #7c3aed; /* slightly lighter purple */
  transform: translateY(-1px);
}
.yt-compare-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  overflow-x: auto;
  padding: 0;
  background: transparent;
  border: none;
}
.yt-compare-header-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(3, 1fr);
  align-items: center;
  gap: 16px;
  min-width: 600px;
  padding: 8px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .yt-compare-header-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.yt-compare-header-col-channel {
  /* empty column for channel logo/name */
}
.yt-compare-header-col {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #64748b);
  font-family: 'Outfit', sans-serif;
}
[data-theme="dark"] .yt-compare-header-col {
  color: #a1a1aa;
}
.yt-compare-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(3, 1fr);
  align-items: center;
  gap: 16px;
  min-width: 600px;
  padding: 12px 16px;
  border-radius: 16px;
  background: transparent;
  border: 1px solid transparent;
  transition: background-color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.yt-compare-row:hover {
  background: #ffffff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.03);
}
[data-theme="dark"] .yt-compare-row:hover {
  background: #212121 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}
.yt-compare-col-channel {
  min-width: 0;
}
.yt-compare-col-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.yt-compare-stat-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main, #0f172a);
  font-family: 'Inter', sans-serif;
}
[data-theme="dark"] .yt-compare-stat-number {
  color: #ffffff !important;
}
.yt-compare-bar-track {
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  overflow: hidden;
  width: 90%;
}
[data-theme="dark"] .yt-compare-bar-track {
  background: rgba(255, 255, 255, 0.1);
}
.yt-compare-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-primary, #5c257b), #8b5cf6);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Preferred Script Language Banner */
.pref-lang-banner-container {
  width: 100%;
  position: relative;
  z-index: 50;
}

.pref-lang-banner {
  background: linear-gradient(135deg, rgba(92, 37, 123, 0.08) 0%, rgba(139, 92, 246, 0.04) 100%);
  border-bottom: 1px solid var(--glass-border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
  position: relative;
}

[data-theme="dark"] .pref-lang-banner {
  background: linear-gradient(135deg, rgba(165, 88, 208, 0.12) 0%, rgba(139, 92, 246, 0.06) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pref-lang-banner.dismissing {
  max-height: 0 !important;
  opacity: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-bottom-width: 0 !important;
  overflow: hidden !important;
  transform: translateY(-8px);
}

.pref-lang-banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.pref-lang-icon-wrapper {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-primary, #5c257b), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--accent-primary-glow, rgba(92, 37, 123, 0.2));
}

.pref-lang-text-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

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

.pref-lang-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-primary-glow, rgba(92, 37, 123, 0.1));
  color: var(--accent-primary);
  padding: 2px 8px;
  border-radius: 20px;
}

.pref-lang-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.3;
}

.pref-lang-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Custom Searchable Select Dropdown */
.pref-lang-dropdown {
  position: relative;
  min-width: 250px;
}

.pref-lang-dropdown-trigger {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 10px;
  transition: all var(--transition-fast);
  user-select: none;
}

.pref-lang-dropdown-trigger:hover,
.pref-lang-dropdown-trigger.open {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.pref-lang-dropdown-trigger i {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.pref-lang-dropdown-trigger.open i {
  transform: rotate(180deg);
}

.pref-lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  max-height: 320px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  animation: prefDropdownFade 0.18s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

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

.pref-lang-search-wrapper {
  padding: 10px 12px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pref-lang-search-wrapper i {
  font-size: 12px;
  color: var(--text-muted);
}

.pref-lang-search-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
}

.pref-lang-list {
  overflow-y: auto;
  flex: 1;
  max-height: 240px;
}

.pref-lang-group-header {
  padding: 6px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  background: var(--bg-tertiary);
}

.pref-lang-item {
  padding: 9px 14px;
  font-size: 13.5px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s ease, color 0.15s ease;
}

.pref-lang-item:hover,
.pref-lang-item.highlighted {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
}

.pref-lang-item.selected {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  font-weight: 600;
}

.pref-lang-item.top-priority {
  font-weight: 600;
}

.pref-lang-item-check {
  font-size: 11px;
  color: var(--accent-primary);
}

.pref-lang-btn-save {
  background: var(--accent-primary, #5c257b);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 8px var(--accent-primary-glow, rgba(92, 37, 123, 0.25));
}

.pref-lang-btn-save:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--accent-primary-glow, rgba(92, 37, 123, 0.35));
}

.pref-lang-btn-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 768px) {
  .pref-lang-banner {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  
  .pref-lang-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .pref-lang-dropdown {
    width: 100%;
  }

  .pref-lang-dropdown-menu {
    width: 100%;
    right: 0;
    left: 0;
  }

  .pref-lang-btn-save {
    justify-content: center;
    width: 100%;
  }
}

/* =========================================
   Shimmering Avatar Container & Image Caching Styles
   ========================================= */
.yt-avatar-shimmer-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background-color: #f1f5f9;
}

.yt-avatar-shimmer-wrap.shimmering {
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
  animation: yt-avatar-shimmer-anim 1.4s infinite ease-in-out;
}

[data-theme="dark"] .yt-avatar-shimmer-wrap {
  background-color: #27272a;
}

[data-theme="dark"] .yt-avatar-shimmer-wrap.shimmering {
  background: linear-gradient(90deg, #27272a 0%, #3f3f46 50%, #27272a 100%);
  background-size: 200% 100%;
  animation: yt-avatar-shimmer-anim 1.4s infinite ease-in-out;
}

@keyframes yt-avatar-shimmer-anim {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.yt-avatar-shimmer-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: block;
}

.yt-avatar-shimmer-wrap img.loaded {
  opacity: 1;
}
