html, body {
  max-width: 100%;
}

* {
  box-sizing: border-box;
}

:root {
  --bg-color: #07090c;
  --secondary-bg: #0b0f15;
  --card-bg: #0e1218;
  --text-color: #ffffff;
  --text-color-dark: #000000;
  --secondary-text: #aaaaaa;
  --secondary-border-color: rgba(80,130,255,.35); 
  --secondary-border-color: #aaaaaa;
  --accent-color: #5dade2;
  --recommendation-color: #f5b041;
  --strong-buy-color: #58d68d;
  --strong-buy-bg-color: #0062269d;
  --buy-color: #2ecc71;
  --neutral-color: #e3e684;
  --cautious-color: #fc5938;
  --shadow-color: rgba(255, 251, 251, 0.108);
  --down-arrow-color: #333333;
}

html.light {
  --bg-color: #ffffff;
  --secondary-bg: #ffffffcc;
  --card-bg: #f9f9f9;
  --text-color: #000000;
  --text-color-dark: #000000;
  --secondary-text: #555555;
  --secondary-border-color: rgba(80,130,255,.35);
  --secondary-border-color: rgba(80,130,255,.35); 
  --accent-color: #3498db;
  --recommendation-color: #e67e22;
  --strong-buy-color: #2ecc71;
  --strong-buy-bg-color: #cff0dd;
  --buy-color: #2ecc71;
  --neutral-color: #afa300;
  --cautious-color: #e53f3f;
  --shadow-color: rgba(0, 0, 0, 0.08);
  --down-arrow-color: #e0dada;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Modern Navbar Styles */
.navbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 2000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar.scrolled {
  background: rgba(10, 10, 10, 0.95);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

html.light .navbar {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

html.light .navbar.scrolled {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.navbar-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.875rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.content-wrapper {
  padding: 20px;
  box-sizing: border-box;
}

/* Logo Section */
.navbar-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  gap: 0.75rem;
  transition: transform 0.3s ease;
}

.logo-link:hover {
  transform: translateY(-1px);
}

.logo {
  height: 32px;
  width: auto;
  vertical-align: middle;
}

.brand-name {
  font-weight: 700;
  font-size: 1.25rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

/* Navigation Links */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  justify-content: flex-end;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  position: relative;
  padding: 0.625rem 1rem;
  text-decoration: none;
  color: var(--text-color);
  font-weight: 500;
  font-size: 0.9375rem;
  border-radius: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.nav-link::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 80%;
  height: 2px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
  transition: transform 0.3s ease;
}

.nav-link:hover {
  color: #667eea;
  background: rgba(102, 126, 234, 0.08);
}

.nav-link:hover::before {
  transform: translateX(-50%) scaleX(1);
}

/* Active state for current page - gradient button style */
.nav-link.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white !important;
  padding: 0.625rem 1.25rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

html.light .nav-link.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white !important;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.nav-link.active::before {
  display: none;
}

.nav-link.active:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  color: white !important;
}

html.light .nav-link.active:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  color: white !important;
}

/* Search Bar */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 0.5rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--secondary-text);
  pointer-events: none;
  transition: color 0.3s ease;
}

.search-bar {
  padding: 0.625rem 1rem 0.625rem 2.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(26, 26, 26, 0.6);
  color: var(--text-color);
  outline: none;
  width: clamp(200px, 36vw, 320px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.875rem;
  font-weight: 400;
}

html.light .search-bar {
  background: rgba(248, 250, 252, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}

.search-bar:focus {
  border-color: #667eea;
  background: rgba(26, 26, 26, 0.8);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
  width: clamp(240px, 25vw, 380px);
}

html.light .search-bar:focus {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
}

.search-container:focus-within .search-icon {
  color: #667eea;
}

.search-bar::placeholder {
  color: var(--secondary-text);
  font-size: 0.875rem;
  opacity: 0.7;
}

.search-bar:hover {
  border-color: rgba(102, 126, 234, 0.3);
}

/* User Dropdown */
.user-dropdown {
  position: relative;
  display: inline-block;
}

.user-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: rgba(26, 26, 26, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--text-color);
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

html.light .user-button {
  background: rgba(248, 250, 252, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}

.user-button:hover {
  background: rgba(102, 126, 234, 0.1);
  border-color: rgba(102, 126, 234, 0.3);
  transform: translateY(-1px);
}

/* Active state for user button when on account pages */
.user-button.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white !important;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

html.light .user-button.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white !important;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.user-button.active .user-icon,
.user-button.active .dropdown-arrow {
  stroke: white;
}

.user-button.active:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

html.light .user-button.active:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.dropdown-arrow {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  transition: transform 0.3s ease;
}

.user-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.user-dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 200px;
  background: rgba(26, 26, 26, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  z-index: 3000;
  animation: dropdownFadeIn 0.2s ease;
}

html.light .user-dropdown-content {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

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

.user-dropdown.open .user-dropdown-content {
  display: block;
}

.dropdown-form {
  margin: 0;
  padding: 0;
  width: 100%;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}

.dropdown-item:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.1) 100%);
  color: #667eea;
}

/* Active state for dropdown items */
.dropdown-item.active {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.15) 100%);
  color: #667eea;
  font-weight: 600;
  border-left: 3px solid #667eea;
  padding-left: calc(1.25rem - 3px);
}

.dropdown-item.active svg {
  stroke: #667eea;
}

.dropdown-item.active:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.2) 100%);
}

.logout-btn {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #fc5938;
}

html.light .logout-btn {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.logout-btn:hover {
  background: rgba(252, 89, 56, 0.1);
  color: #fc5938;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(26, 26, 26, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  flex-shrink: 0;
}

html.light .theme-toggle-btn {
  background: rgba(248, 250, 252, 0.8);
  border-color: rgba(0, 0, 0, 0.1);
}

.theme-toggle-btn:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.15) 100%);
  border-color: rgba(102, 126, 234, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

.theme-icon {
  width: 20px;
  height: 20px;
  color: var(--text-color);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
}

.theme-toggle-btn:hover .theme-icon {
  color: #667eea;
}

.sun-icon {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

.moon-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

html.light .sun-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

html.light .moon-icon {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
  z-index: 2100;
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background: var(--text-color);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translateY(7px);
}

.menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translateY(-7px);
}

/* Tooltip */
.tooltip-container {
  position: relative;
  display: inline-block;
}

.tooltip-trigger {
  color: #667eea;
  font-weight: 600;
  cursor: help;
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
  width: 260px;
  background: var(--card-bg);
  color: var(--text-color);
  text-align: center;
  padding: 0.75rem;
  border-radius: 8px;
  position: absolute;
  z-index: 100;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

html.light .tooltip-text {
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tooltip-container:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Flash Messages */
.flash-error {
  color: #fc5938;
  font-weight: 600;
  margin-top: 1.5rem;
  text-align: center;
  padding: 0.75rem;
  background: rgba(252, 89, 56, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(252, 89, 56, 0.2);
}

/* Utility Classes */
.down-arrow-icon {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 10;
  background: var(--card-bg);
  border-radius: 4px;
  padding: 2px;
}

.center-content {
  min-height: 100vh;
  padding: 0 10px;
}

/* Responsive Design */
@media (min-width: 993px) {
  .content-wrapper {
    padding: 20px;
    box-sizing: border-box;
  }
}

/* Tablet styles */
@media (max-width: 1200px) and (min-width: 993px) {
  .navbar-container {
    padding: 0.875rem 1.5rem;
  }
  
  .search-bar {
    width: clamp(180px, 36vw, 380px);
  }
  
  .search-bar:focus {
    width: clamp(220px, 36vw, 320px);
  }
}

/* Large desktop styles */
@media (min-width: 1400px) {
  .search-bar {
    width: clamp(240px, 48vw, 360px);
  }
  
  .search-bar:focus {
    width: clamp(280px, 22vw, 420px);
  }
}

/* Mobile styles */
@media (max-width: 992px) {
  .content-wrapper {
    padding: 10px 8px;
    box-sizing: border-box;
  }

  .navbar {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  
  html.light .navbar {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .navbar-container {
    padding: 0.75rem 1rem;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0;
    align-items: center;
  }

  /* Logo stays in first column, first row */
  .navbar-left {
    grid-column: 1;
    grid-row: 1;
  }

  /* Hamburger menu in second column, first row */
  .menu-toggle {
    display: flex;
    grid-column: 2;
    grid-row: 1;
  }

  /* Navigation expands below on full width (spans both columns) */
  .navbar-right {
    display: none;
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    animation: mobileMenuSlideIn 0.3s ease;
  }
  
  html.light .navbar-right {
    border-top-color: rgba(0, 0, 0, 0.08);
  }

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

  .navbar-right.show {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  .nav-link {
    width: 100%;
    text-align: center;
    padding: 0.875rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: transparent;
  }
  
  html.light .nav-link {
    border-color: rgba(0, 0, 0, 0.08);
    background: transparent;
  }
  
  .nav-link:hover {
    background: rgba(102, 126, 234, 0.08);
  }

  .nav-link.active {
    text-align: center;
    padding: 0.875rem 1.25rem;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
  }
  
  html.light .nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
  }
  
  .nav-link.active:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    color: white !important;
  }
  
  html.light .nav-link.active:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    color: white !important;
  }

  .search-container {
    width: 100%;
    margin-right: 0;
    margin-bottom: 0.5rem;
  }

  .search-bar {
    width: 100%;
    max-width: none;
  }

  .search-bar:focus {
    width: 100%;
  }

  .user-dropdown {
    width: 100%;
  }

  .user-button {
    width: 100%;
    justify-content: space-between;
  }

  .user-dropdown-content {
    position: static;
    width: 100%;
    margin-top: 0.5rem;
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
  
  html.light .user-dropdown-content {
    border-color: rgba(0, 0, 0, 0.08);
  }

  .theme-toggle-btn {
    width: 100%;
    height: 44px;
    justify-content: center;
  }

  .brand-name {
    font-size: 1.125rem;
  }

  .logo {
    height: 28px;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .navbar-container {
    padding: 0.625rem 0.875rem;
  }

  .brand-name {
    font-size: 1rem;
  }

  .logo {
    height: 24px;
  }
}



/* Notification Badge */
.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 0.5rem;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(231, 76, 60, 0.4);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.6);
  }
}

.nav-link {
  display: flex;
  align-items: center;
}


/* ============================================================================
   HLC ANIMATION - WebSocket Real-time Updates
   ============================================================================ */

/* HLC flash animation - impactful flash without size change */
.hlc-flash {
  animation: hlcFlashImpact 0.6s ease-out !important;
}

@keyframes hlcFlashImpact {
  0% {
    background-color: rgba(59, 130, 246, 0.8);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.8), 0 0 40px rgba(59, 130, 246, 0.4);
    color: #ffffff;
  }
  50% {
    background-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.6), 0 0 50px rgba(59, 130, 246, 0.3);
    color: #ffffff;
  }
  100% {
    background-color: transparent;
    box-shadow: none;
    color: inherit;
  }
}

/* Ensure HLC values have proper styling for animation */
.hlc-high, .hlc-low, .hlc-current {
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s;
  display: inline-block;
}

/* Color classes for HLC values */
.hlc-high.positive, .hlc-current.positive {
  color: #2ecc71;
}

.hlc-low.negative, .hlc-current.negative {
  color: #e74c3c;
}

.hlc-high.neutral, .hlc-low.neutral, .hlc-current.neutral {
  color: #aaaaaa;
}
