/* Font Loading */
@font-face {
  font-family: 'DM Sans';
  src: url('../fonts/DMSans-Variable.ttf') format('truetype');
  font-weight: 100 1000;
  font-style: normal;
  font-optical-sizing: auto;
  font-display: swap;
  font-variation-settings: 'opsz' auto;
}

@font-face {
  font-family: 'Outfit';
  src: url('../fonts/Outfit-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

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

/* Critical above-the-fold styles */
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background-color: #000000;
  color: white;
  height: 100vh;
  margin: 0;
  transition: background-color 0.3s, color 0.3s;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Ensure background extends to iOS status bar */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.theme-light {
  background-color: #ffffff;
  color: #000000;
}

/* Sidebar container - critical for layout */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 32px 0 32px 16px;
  width: 74px;
  background-color: inherit;
  overflow: hidden;
  transition: width 0.42s ease, box-shadow 0.42s ease;
  z-index: 1000;
  will-change: width;
}

.sidebar:hover {
  width: 200px !important;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.3);
}

.theme-light .sidebar:hover {
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.1);
}

.icon-row {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  transition: background-color 0.2s ease;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  width: calc(100% - 20px);
  margin: 0 10px;
  box-sizing: border-box;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.sidebar .icon-container svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  transform: scale(1.08) translateY(-1px);
}

.icon-label {
  font-size: 16px;
  font-weight: 500;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar:hover .icon-label {
  opacity: 1;
  transform: translateX(0);
}


/* Hover and active states */
.icon-row:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.theme-light .icon-row:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

.icon-row.active {
  background-color: rgba(255, 255, 255, 0.15);}

.theme-light .icon-row.active {
  background-color: rgba(0, 0, 0, 0.15);
}

.icon-row.active:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.theme-light .icon-row.active:hover {
  background-color: rgba(0, 0, 0, 0.2);
}

.icon-row:active {
  transform: none;
}

/* Status circle */
.status-circle {
  width: 20px;
  height: 20px;
  border-radius: 80%;
  background-color: #4CAF50;
  border: 2px solid rgb(255, 255, 255);
  transition: background-color 0.2s ease, border-color 0.2s ease;
  margin-left: 1px;
}

.theme-light .status-circle {
  border: 2px solid rgb(86, 85, 85);
}

.status-circle.unavailable {
  background-color: #9e9e9e;
}

.status-circle.filtered {
  background-color: #87CEEB;
}

/* Main content area */
.content {
  flex: 1;
  margin-left: 56px;
  padding: 32px;
  transition: margin-left 0.3s ease;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
}

.main-content {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Settings and Status chevron menu styles */
.settings-parent,
.status-parent {
  position: relative;
}

.chevron-icon {
  position: absolute;
  right: 3px;
  top: 60%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.1s ease, transform 0.1s ease;
  pointer-events: none;
}

.sidebar:hover .chevron-icon {
  opacity: 1;
}

.chevron-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.settings-parent.expanded .chevron-icon,
.status-parent.expanded .chevron-icon {
  transform: translateY(-50%) rotate(90deg);
}

.settings-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
  border-radius: 6px;
  margin: 2px 0;
}


.settings-submenu.expanded {
  max-height: 160px;
  padding: 4px 0;
  overflow: visible;
}

/* Ensure submenu items are visible and properly spaced */
.settings-submenu .submenu-item {
  margin-bottom: 1px;
  min-height: 32px;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.submenu-item {
  /* Keep exactly the same styling as regular icon-row items */
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  transition: background-color 0.2s ease;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  width: calc(100% - 16px);
  box-sizing: border-box;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.submenu-item .icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.submenu-item .icon-container svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  transform: scale(1.08) translateY(-1px);
}

.submenu-item .icon-label {
  font-size: 16px;
  font-weight: 400;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar:hover .submenu-item .icon-label {
  opacity: 1;
  transform: translateX(0);
}

.submenu-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.theme-light .submenu-item:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

/* Dropdown styles */
.language-dropdown {
  position: absolute;
  top: 100%;
  left: 20px;
  background: #0f0f0f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 0;
  min-width: 120px;
  display: none;
  flex-direction: column;
  z-index: 1002;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.theme-light .language-dropdown {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.language-option {
  padding: 2px 16px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s ease;
}

.language-option:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.theme-light .language-option:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

/* Notification badge - Global styles with important to override any app-specific styles */
.notification-badge {
  position: absolute !important;
  top: -5px !important;
  right: -4px !important;
  background-color: #ca4e01 !important;
  color: white !important;
  border-radius: 50% !important;
  width: 18px !important;
  height: 18px !important;
  display: flex;
  align-items: center !important;
  justify-content: center !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  z-index: 10 !important;
  line-height: 1 !important;
  text-align: center !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

/* Hide badge when display is set to none (for zero counts) */
.notification-badge[style*="display: none"] {
  display: none !important;
}

/* Ensure text inside badge is perfectly centered */
.notification-badge:not([style*="display: none"]) {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-content: center !important;
  text-indent: 0 !important;
  letter-spacing: 0 !important;
}

/* Override ALL badge animations and effects from any app */
.notification-badge,
.top-bar-icon .notification-badge,
#alerts-badge,
#sidebar-alerts-badge,
#chat-badge,
#sidebar-chat-badge,
#rewards-badge {
  animation: none !important;
  animation-name: none !important;
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
  animation-timing-function: none !important;
  animation-fill-mode: none !important;
  animation-play-state: paused !important;
  transition: none !important;
  transform: none !important;
  opacity: 1 !important;
}

/* Separator */
.separator {
  width: calc(90% - 24px);
  margin-left: 16px;
  margin-right: 12px;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 8px;
  margin-bottom: 8px;
}

.theme-light .separator {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Logo section */
.shuren-logo {
  margin-top: -8px;
  margin-bottom: 4px;
  margin-left: -6px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0px;
  width: calc(100% - 16px);
  box-sizing: border-box;
  justify-content: flex-start;
  order: -1;
}

.logo-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon img {
  width: 52px;
  height: 68px;
  object-fit: contain;
}

/* Dark theme by default - show white logo and white text */
.logo-icon .logo-dark {
  display: block;
}

.logo-icon .logo-light {
  display: none;
}

/* Light theme - show black logo and black text */
.theme-light .logo-icon .logo-dark {
  display: none;
}

.theme-light .logo-icon .logo-light {
  display: block;
}

.logo-text {
  font-size: 1.6rem;
  font-weight: 600;
  color: #ffffff;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
  margin-left: -0.5rem;
}

.theme-light .logo-text .a {
  text-decoration: none;
}


.theme-light .logo-text {
  color: #000000;
}

.sidebar:hover .logo-text {
  opacity: 1;
  transform: translateX(0);
}

/* Responsive design - Enable scrolling on smaller screens */
@media (max-height: 1000px) {
  .sidebar {
    overflow-y: auto !important;
    overflow-x: hidden;
    padding-top: 12px;
    padding-bottom: 12px;
    max-height: 100vh;
    position: fixed !important;
  }
  
  .sidebar::-webkit-scrollbar {
    width: 6px;
  }
  
  .sidebar::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
  }
  
  .theme-light .sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
  }
  
  .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
  }
  
  .theme-light .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
  }

  /* Reduce spacing between elements on smaller screens */
  .sidebar {
    gap: 6px;
  }

  .icon-row {
    padding: 2px 9px;
    min-height: 32px;
  }

  .separator {
    margin-top: 4px;
    margin-bottom: 4px;
  }

  /* Make settings submenu more compact but ensure visibility */
  .settings-submenu {
    border-radius: 6px;
    margin: 2px 0;
  }


  .settings-submenu.expanded {
    max-height: 140px !important;
    padding: 4px 0;
    overflow: visible;
  }

  .submenu-item {
    padding: 4px 12px;
    min-height: 32px;
    margin-bottom: 2px;
  }

  /* Ensure submenu items are fully visible */
  .settings-submenu .submenu-item {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: transparent;
  }

  .settings-submenu .submenu-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
  }

  .theme-light .settings-submenu .submenu-item:hover {
    background: rgba(0, 0, 0, 0.08) !important;
  }
}

/* Mobile UI Elements - Hidden by default, shown only on mobile */
.mobile-top-bar,
.mobile-bottom-bar {
  display: none;
}

/* Mobile styles for screens 768px and below */
@media (max-width: 768px) {
  /* Hide desktop sidebar on mobile */
  .sidebar {
    display: none !important;
  }
  
  /* Show mobile bars only on mobile */
  .mobile-top-bar,
  .mobile-bottom-bar {
    display: flex;
  }
  
  /* Adjust main content for mobile bars */
  .content {
    margin-left: 0;
    padding: 16px;
    padding-top: calc(76px + env(safe-area-inset-top)); /* Space for top bar + safe area */
    padding-bottom: calc(80px + env(safe-area-inset-bottom)); /* Space for bottom bar + safe area */
    transition: padding-top 0.3s ease;
    position: relative;
    z-index: 1;
    min-height: 100vh; /* Ensure content fills viewport */
  }

  /* Mobile Top Bar */
  .mobile-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(60px + env(safe-area-inset-top));
    background: #000000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: env(safe-area-inset-top) 1rem 0 1rem;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    transition: transform 0.3s ease;
  }

  .theme-light .mobile-top-bar {
    background: #ffffff;
    color: #000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  /* Mobile Logo Section */
  .mobile-logo-section {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 18%;
    min-width: 90px;
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer;
    transition: opacity 0.2s ease;

  }
  
  .mobile-logo-section:visited {
    color: inherit !important;
    text-decoration: none !important;
  }
  
  .mobile-logo-section:link {
    color: inherit !important;
    text-decoration: none !important;
  }
  
  .mobile-logo-section:hover {
    opacity: 0.8;
    text-decoration: none !important;
  }
  
  .mobile-logo-section:active {
    opacity: 0.6;
    text-decoration: none !important;
  }

  .mobile-logo-icon {
    position: relative;
    width: 48px;
    height: 54px;
    flex-shrink: 0;
  }

  .mobile-logo-icon img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .mobile-logo-icon .logo-dark {
    display: block;
  }

  .mobile-logo-icon .logo-light {
    display: none;
  }

  .theme-light .mobile-logo-icon .logo-dark {
    display: none;
  }

  .theme-light .mobile-logo-icon .logo-light {
    display: block;
  }

  .mobile-logo-text {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
    margin-left: -6px;
  }

  /* Mobile Top Icons */
  .mobile-top-icons {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .top-bar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    text-decoration: none;
    color: inherit;
  }

  .top-bar-icon:hover,
  .top-bar-icon.active {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
  }

  .theme-light .top-bar-icon:hover,
  .theme-light .top-bar-icon.active {
    background-color: rgba(0, 0, 0, 0.1);
  }

  .top-bar-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
  }

  /* Mobile notification badges - ensure proper centering */
  .top-bar-icon .notification-badge {
    position: absolute !important;
    top: 4px !important;
    right: 6px !important;
    background-color: #ca4e01 !important;
    color: white !important;
    border-radius: 50% !important;
    width: 18px !important;
    height: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    z-index: 10 !important;
    line-height: 1 !important;
    text-align: center !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
  
  /* Override display for hidden badges on mobile */
  .top-bar-icon .notification-badge[style*="display: none"] {
    display: none !important;
  }

  /* Mobile Bottom Bar */
  .mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + env(safe-area-inset-bottom));
    background: #000000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px 16px calc(4px + env(safe-area-inset-bottom)) 16px;
    z-index: 100;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    transition: transform 0.3s ease;
  }

  .theme-light .mobile-bottom-bar {
    background: #ffffff;
    color: #000;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  /* PWA Mode - Reduce bottom spacing and fix top spacing */
  @media (display-mode: standalone) {
    .mobile-bottom-bar {
      padding-bottom: calc(2px + env(safe-area-inset-bottom));
      height: calc(58px + env(safe-area-inset-bottom));
    }
    
    .content {
      padding-top: calc(60px + env(safe-area-inset-top)) !important; /* Reduced top padding for PWA */
      padding-bottom: calc(78px + env(safe-area-inset-bottom)) !important;
    }
  }

  /* Bottom bar items */
  .bottom-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
    min-width: 52px;
    flex: 1;
    max-width: 72px;
    text-decoration: none;
    color: inherit;
  }

  .bottom-bar-item:hover,
  .bottom-bar-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
  }

  .theme-light .bottom-bar-item:hover,
  .theme-light .bottom-bar-item.active {
    background-color: rgba(0, 0, 0, 0.1);
  }

  .bottom-bar-item svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
  }

  .bottom-bar-item span {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
  }

  /* Panel overlay */
  .panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: none;
    display: block;
    backdrop-filter: blur(0px);
  }

  .panel-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    backdrop-filter: blur(4px);
  }

  .theme-light .panel-overlay {
    background: rgba(255, 255, 255, 0.7);
  }

  /* Slide-up panels for mobile */
  .slide-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #000000;
    color: #fff;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 2000;
    max-height: 50vh;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 40px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    display: block;
    opacity: 0;
    visibility: hidden;
    will-change: transform, opacity;
  }

  .theme-light .slide-panel {
    background: #ffffff;
    color: #000;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
  }

  .slide-panel.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .slide-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateY(10px);
    animation: slideInHeader 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) 0.1s forwards;
  }

  .theme-light .slide-panel-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  .slide-panel-title {
    font-size: 18px;
    font-weight: 600;
    opacity: 0;
    transform: translateX(-10px);
    animation: slideInTitle 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) 0.2s forwards;
  }

  .slide-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    opacity: 0;
    transform: scale(0.8) rotate(180deg);
    animation: slideInClose 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) 0.3s forwards;
  }

  .theme-light .slide-panel-close {
    background: rgba(0, 0, 0, 0.1);
  }

  .slide-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05) rotate(0deg);
  }

  .theme-light .slide-panel-close:hover {
    background: rgba(0, 0, 0, 0.2);
  }

  .slide-panel-close:active {
    transform: scale(0.95) rotate(0deg);
  }

  .slide-panel-close svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
  }

  .slide-panel-close:hover svg {
    transform: rotate(90deg);
  }

  /* Panel options */
  .panel-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .panel-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-height: 56px;
    text-decoration: none;
    color: inherit;
    opacity: 0;
    transform: translateY(15px) scale(0.95);
    animation: slideInOption 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
  }

  .panel-option:nth-child(1) { animation-delay: 0.4s; }
  .panel-option:nth-child(2) { animation-delay: 0.5s; }
  .panel-option:nth-child(3) { animation-delay: 0.6s; }
  .panel-option:nth-child(4) { animation-delay: 0.7s; }
  .panel-option:nth-child(5) { animation-delay: 0.8s; }
  .panel-option:nth-child(6) { animation-delay: 0.9s; }

  .panel-option:hover,
  .panel-option.active {
    background-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  .theme-light .panel-option:hover,
  .theme-light .panel-option.active {
    background-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }

  .panel-option:active {
    transform: translateY(0) scale(0.98);
  }

  .panel-option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  }

  .panel-option:hover .panel-option-icon {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.15);
  }

  .theme-light .panel-option:hover .panel-option-icon {
    background: rgba(0, 0, 0, 0.15);
  }

  .theme-light .panel-option-icon {
    background: rgba(0, 0, 0, 0.1);
  }

  .panel-option-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
  }

  .panel-option-text {
    font-size: 16px;
    font-weight: 400;
  }

  /* Handle for slide panels */
  .slide-panel::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    opacity: 0;
    animation: slideInHandle 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) 0.2s forwards;
  }

  .theme-light .slide-panel::before {
    background: rgba(0, 0, 0, 0.3);
  }

  /* Status circle in mobile panels */
  .panel-option-icon .status-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #4CAF50;
    border: 3px solid rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
  }

  .theme-light .panel-option-icon .status-circle {
    border: 2px solid rgb(85, 85, 85);
  }

  .panel-option-icon .status-circle.unavailable {
    background-color: #9e9e9e;
  }

  .panel-option-icon .status-circle.filtered {
    background-color: #87CEEB;
  }

  /* Keyframe animations for slide panels */
  @keyframes slideInHeader {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes slideInTitle {
    from {
      opacity: 0;
      transform: translateX(-10px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  @keyframes slideInClose {
    from {
      opacity: 0;
      transform: scale(0.8) rotate(180deg);
    }
    to {
      opacity: 1;
      transform: scale(1) rotate(0deg);
    }
  }

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

  /* Slide-out animations for closing panels */
  @keyframes slideOutHeader {
    from {
      opacity: 1;
      transform: translateY(0);
    }
    to {
      opacity: 0;
      transform: translateY(-10px);
    }
  }

  @keyframes slideOutClose {
    from {
      opacity: 1;
      transform: scale(1) rotate(0deg);
    }
    to {
      opacity: 0;
      transform: scale(0.8) rotate(90deg);
    }
  }

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

  /* Closing state for panels */
  .slide-panel.closing .panel-option {
    pointer-events: none;
  }

  .slide-panel.closing .slide-panel-close {
    pointer-events: none;
  }

  /* Handle animation */
  @keyframes slideInHandle {
    0% {
      opacity: 0;
      transform: translateX(-50%) scale(0.8);
    }
    50% {
      opacity: 0.8;
      transform: translateX(-50%) scale(1.1);
    }
    100% {
      opacity: 1;
      transform: translateX(-50%) scale(1);
    }
  }
}

/* Small phones */
@media (max-width: 480px) {
  .mobile-top-bar {
    height: calc(56px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0 12px;
  }

  .content {
    padding: 12px;
    padding-top: calc(68px + env(safe-area-inset-top));
    padding-bottom: calc(76px + env(safe-area-inset-bottom)); /* Space for bottom bar */
  }

  .mobile-bottom-bar {
    height: calc(56px + env(safe-area-inset-bottom));
    padding: 6px 12px calc(4px + env(safe-area-inset-bottom)) 12px;
  }

  /* PWA Mode adjustments for small phones */
  @media (display-mode: standalone) {
    .mobile-bottom-bar {
      padding-bottom: calc(2px + env(safe-area-inset-bottom));
      height: calc(54px + env(safe-area-inset-bottom));
    }
    
    .content {
      padding-top: calc(56px + env(safe-area-inset-top)) !important; /* Reduced top padding for PWA on small phones */
    }
  }

  .bottom-bar-item {
    min-width: 44px;
    max-width: 56px;
  }

  .bottom-bar-item span {
    font-size: 10px;
  }

  .mobile-logo-text {
    font-size: 18px;
  }
}

/* PWA Mode - Fix sidebar scrolling for desktop PWA installations */
@media (display-mode: standalone) and (min-width: 769px) {
  .sidebar {
    overflow-y: auto !important;
    overflow-x: hidden;
    padding-top: 16px;
    padding-bottom: 16px;
    max-height: 100vh;
    position: fixed !important;
  }
  
  .sidebar::-webkit-scrollbar {
    width: 6px;
  }
  
  .sidebar::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
  }
  
  .theme-light .sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
  }
  
  .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
  }
  
  .theme-light .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
  }
}

/* Desktop layout adjustments */
@media (min-width: 769px) {
  .content {
    margin-left: 74px;
    padding: 32px;
    transition: margin-left 0.42s ease;
  }

  /* Hide mobile panels on desktop */
  #postPanel,
  #statusPanel {
    display: none !important;
  }
}

/* Sidebar Music Controls */
.sidebar-audio-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.sidebar-speaker-muted, .sidebar-speaker-active {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    color: inherit;
    transition: all 0.3s ease;
}

/* Initially show muted icon */
.sidebar-speaker-muted {
    opacity: 1;
    transform: scale(1);
}

.sidebar-speaker-active {
    opacity: 0;
    transform: scale(0.9);
}

/* Sound wave animations for sidebar */
.sidebar-sound-wave-1 {
    animation: sidebarSoundWave1 2s ease-in-out infinite;
}

.sidebar-sound-wave-2 {
    animation: sidebarSoundWave2 2s ease-in-out infinite 0.3s;
}

@keyframes sidebarSoundWave1 {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }
}

@keyframes sidebarSoundWave2 {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.03);
    }
}

/* Music control hover effect */
.settings-submenu .icon-row.submenu-item:hover .sidebar-audio-icon {
    transform: scale(1.05);
}

/* Logout button styling */
.logout-item {
    color: #ff4757 !important;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.logout-item:hover {
    background-color: rgba(255, 71, 87, 0.1) !important;
    border-color: rgba(255, 71, 87, 0.3);
    color: #ff4757 !important;
}

.logout-item .icon-container svg {
    color: #ff4757;
    stroke: #ff4757;
}

.theme-light .logout-item {
    color: #e55656 !important;
}

.theme-light .logout-item:hover {
    background-color: rgba(229, 86, 86, 0.1) !important;
    border-color: rgba(229, 86, 86, 0.3);
    color: #e55656 !important;
}

.theme-light .logout-item .icon-container svg {
    color: #e55656;
    stroke: #e55656;
}
/* ============================================
   Base Template Component Styles
   Moved from inline styles in base.html
   ============================================ */

/* Entry Animation Overlay */
.entry-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000; /* Dark background for dark theme (default) */
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.8s ease-in-out;
}

/* Light theme overlay */
.theme-light .entry-animation-overlay {
    background-color: #FFFFFF; /* White background for light theme */
}

.entry-animation-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Publish Menu Popup Styles */
.publish-menu-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.publish-menu-content {
    background: var(--glass-bg, rgba(1, 1, 1, 0.95));
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.2));
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.theme-light .publish-menu-content {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.publish-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}

.theme-light .publish-menu-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.publish-menu-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #ffffff);
    font-family: var(--heading-font, 'DM Sans', sans-serif);
}

.theme-light .publish-menu-header h3 {
    color: #1a1a1a;
}

.publish-menu-close {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

.publish-menu-close:hover {
    background: var(--glass-bg, rgba(255, 255, 255, 0.1));
    transform: rotate(90deg);
}

.theme-light .publish-menu-close {
    color: #666;
}

.theme-light .publish-menu-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.publish-menu-options {
    padding: 16px;
}

.publish-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    margin-bottom: 12px;
    background: var(--glass-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-light .publish-option {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.publish-option:hover {
    transform: translateY(-2px);
    background: var(--glass-bg, rgba(255, 255, 255, 0.1));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.theme-light .publish-option:hover {
    background: rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.publish-option-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex-shrink: 0;
}

.publish-option-icon.training {
    background: linear-gradient(135deg, var(--primary-orange, #ff6b01) 0%, var(--dark-orange, #e55a00) 100%);
}

.publish-option-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.publish-option-content {
    flex: 1;
}

.publish-option-content h4 {
    margin: 0 0 6px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    font-family: var(--heading-font, 'DM Sans', sans-serif);
}

.theme-light .publish-option-content h4 {
    color: #1a1a1a;
}

.publish-option-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    line-height: 1.4;
}

.theme-light .publish-option-content p {
    color: #666;
}

.publish-option-arrow {
    width: 24px;
    height: 24px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.5));
    flex-shrink: 0;
}

.theme-light .publish-option-arrow {
    color: #999;
}

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

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

/* Hide on mobile */
@media (max-width: 768px) {
    .publish-menu-popup {
        display: none !important;
    }
}

/* Annuncio Form Styles */
.annuncio-form-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    padding: 20px;
}

.annuncio-form-content {
    background: var(--glass-bg, rgba(1, 1, 1, 0.95));
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.2));
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.theme-light .annuncio-form-content {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.annuncio-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}

.theme-light .annuncio-form-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.annuncio-form-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #ffffff);
    font-family: var(--heading-font, 'DM Sans', sans-serif);
}

.theme-light .annuncio-form-header h3 {
    color: #1a1a1a;
}

.annuncio-form-close {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

.annuncio-form-close:hover {
    background: var(--glass-bg, rgba(255, 255, 255, 0.1));
    transform: rotate(90deg);
}

.theme-light .annuncio-form-close {
    color: #666;
}

.annuncio-form {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    font-size: 0.95rem;
}

.theme-light .form-group label {
    color: #333;
}

.char-count {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

.theme-light .char-count {
    color: #666;
}

/* Type Selector */
.type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.type-option {
    position: relative;
    cursor: pointer;
}

.type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: var(--glass-bg, rgba(255, 255, 255, 0.05));
    border: 2px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    transition: all 0.3s ease;
    text-align: center;
}

.theme-light .type-card {
    background: rgba(0, 0, 0, 0.02);
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.type-option input[type="radio"]:checked + .type-card {
    background: var(--glass-bg, rgba(255, 255, 255, 0.1));
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.theme-light .type-option input[type="radio"]:checked + .type-card {
    background: rgba(0, 123, 255, 0.1);
}

.type-emoji {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
}

.type-card span {
    font-weight: 500;
    color: var(--text-primary, #ffffff);
}

.theme-light .type-card span {
    color: #333;
}

/* Form Inputs */
.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    background: var(--glass-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.2));
    border-radius: 8px;
    color: var(--text-primary, #ffffff);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.theme-light .form-group input[type="text"],
.theme-light .form-group textarea,
.theme-light .form-group select {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #333;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

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

/* Character Counter */
.char-counter {
    text-align: right;
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
}

.theme-light .char-counter {
    color: #666;
}

/* Location Selects */
.location-selects {
    display: grid;
    gap: 12px;
}

@media (min-width: 480px) {
    .location-selects {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.btn-cancel,
.btn-submit {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: transparent;
    color: var(--text-primary, #ffffff);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.2));
}

.theme-light .btn-cancel {
    color: #666;
    border-color: rgba(0, 0, 0, 0.2);
}

.btn-cancel:hover {
    background: var(--glass-bg, rgba(255, 255, 255, 0.1));
}

.btn-submit {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .annuncio-form-popup {
        padding: 10px;
    }
    
    .annuncio-form-content {
        max-height: 100vh;
        border-radius: 16px;
    }
    
    .type-selector {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-cancel,
    .btn-submit {
        width: 100%;
    }
}
