:root {
  --primary: #1D3557;
  --accent: #E63946;
  --bg: #F1FAEE;
  --text: #333;
  --soft: #A8DADC;
}

/* Base Layout */
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  font-family: 'Segoe UI', sans-serif;
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  align-items: center;
}

/* Header */
header {
  text-align: center;
  padding: 30px 0 20px;
  position: relative;
}

/* User Profile Navigation */
.user-profile-nav {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Alert Icon Button */
.alert-nav-button {
  display: inline-block;
  padding: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(230, 57, 70, 0.3);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  position: relative;
}

.alert-nav-button:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.95));
  border-color: rgba(230, 57, 70, 0.5);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.alert-icon-badge {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #E63946 0%, #dc3545 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  border: 2px solid rgba(230, 57, 70, 0.6);
  position: relative;
}

.alert-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff4757;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.profile-nav-button {
  display: inline-block;
  padding: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}

.profile-nav-button:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.95));
  border-color: rgba(255, 215, 0, 0.5);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.profile-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #1D3557 0%, #E63946 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  border: 2px solid rgba(255, 215, 0, 0.6);
}

.profile-arrow {
  font-size: 10px;
  color: #666;
  transition: transform 0.3s ease;
}

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

.profile-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 280px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.95));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  overflow: hidden;
}

.user-profile-dropdown.open .profile-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.profile-header {
  padding: 20px;
  background: linear-gradient(135deg, #1D3557 0%, #E63946 100%);
  color: white;
}

.profile-info {
  text-align: left;
}

.profile-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-email {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 8px;
}

.profile-plan {
  font-size: 12px;
  background: rgba(255, 215, 0, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 215, 0, 0.5);
  display: inline-block;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
}

.profile-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
  margin: 0;
}

.profile-menu-items {
  padding: 8px 0;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.profile-menu-item:hover {
  background: linear-gradient(135deg, rgba(29, 53, 87, 0.05), rgba(230, 57, 70, 0.05));
  color: #1D3557;
}

.profile-menu-item.logout-item:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
  color: #dc2626;
}

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

header img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 10px;
}

header h1 {
  margin: 0;
  color: var(--primary);
  font-size: 2rem;
}

header p {
  margin: 10px 0 0;
  font-size: 1.1rem;
  color: #555;
}

/* Premium Logo Styling */
.premium-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.logo-circle {
  position: relative;
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, #1D3557 0%, #E63946 25%, #ffd700 50%, #E63946 75%, #1D3557 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 0 30px rgba(255, 215, 0, 0.4),
    0 10px 25px rgba(0, 0, 0, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
  animation: logoGlow 3s ease-in-out infinite alternate;
  border: 3px solid rgba(255, 215, 0, 0.8);
}

@keyframes logoGlow {
  0% {
    box-shadow: 
      0 0 30px rgba(255, 215, 0, 0.4),
      0 10px 25px rgba(0, 0, 0, 0.2),
      inset 0 2px 0 rgba(255, 255, 255, 0.3);
  }
  100% {
    box-shadow: 
      0 0 50px rgba(255, 215, 0, 0.7),
      0 15px 35px rgba(0, 0, 0, 0.3),
      inset 0 2px 0 rgba(255, 255, 255, 0.5);
  }
}

.logo-inner {
  position: relative;
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 215, 0, 0.3);
}

.logo-text {
  font-size: 32px;
  font-weight: 900;
  color: #1D3557;
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 2;
}

.logo-diamond {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 20px;
  background: linear-gradient(45deg, #ffd700, #ffed4e);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.6);
  animation: diamondPulse 2s ease-in-out infinite;
}

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

/* Premium Title Styling */
.premium-title {
  margin: 20px 0 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.title-main {
  font-size: 3.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #1D3557 0%, #E63946 50%, #1D3557 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  letter-spacing: 3px;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  position: relative;
}

.title-main::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ffd700, transparent);
  border-radius: 2px;
}

.title-premium {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffd700;
  background: linear-gradient(135deg, #1D3557 0%, #E63946 100%);
  padding: 4px 16px;
  border-radius: 20px;
  border: 2px solid #ffd700;
  text-transform: uppercase;
  letter-spacing: 3px;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
  animation: premiumShimmer 3s ease-in-out infinite;
}

@keyframes premiumShimmer {
  0%, 100% { 
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
    border-color: #ffd700;
  }
  50% { 
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
    border-color: #ffed4e;
  }
}

/* Premium Tagline */
.premium-tagline {
  margin: 15px 0 0;
  font-size: 1.3rem;
  font-weight: 500;
  color: #555;
  font-style: italic;
  position: relative;
}

.premium-tagline::before,
.premium-tagline::after {
  content: '✦';
  color: #ffd700;
  font-size: 1rem;
  margin: 0 15px;
  animation: starTwinkle 2s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
  0% { opacity: 0.6; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1.1); }
}

/* Free User State Styling */
.logo-circle.free-user {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 25%, #9ca3af 50%, #4b5563 75%, #6b7280 100%);
  border-color: #9ca3af;
  animation: none;
  box-shadow: 
    0 0 15px rgba(156, 163, 175, 0.3),
    0 8px 20px rgba(0, 0, 0, 0.15),
    inset 0 2px 0 rgba(255, 255, 255, 0.2);
}

.logo-diamond.free-user {
  display: none;
}

.title-premium.free-user {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: #d1d5db;
  border-color: #9ca3af;
  animation: none;
  box-shadow: 0 2px 6px rgba(107, 114, 128, 0.2);
}

.title-premium.free-user::before {
  content: "FREE";
}

.title-premium.free-user::after {
  content: "";
  display: none;
}

/* Main App Container */
main, #app-container {
  flex-grow: 1;
  width: 100%;
  max-width: 1200px;
  padding: 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Input Section */
.input-group {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.input-group input {
  padding: 12px 16px;
  width: 280px;
  max-width: 90%;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 53, 87, 0.1), 0 4px 8px rgba(0, 0, 0, 0.1);
  background: white;
}

.input-group button {
  padding: 12px 20px;
  background: linear-gradient(135deg, #2874f0 0%, #1864c0 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(40, 116, 240, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.input-group button:hover {
  background: linear-gradient(135deg, #1864c0 0%, #2874f0 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 116, 240, 0.3);
}

/* Refresh Button Styling */
.refresh-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2) !important;
}

.refresh-btn:hover {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%) !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
  transform: translateY(-2px);
}

.refresh-btn:active {
  background: linear-gradient(135deg, #b45309 0%, #d97706 100%) !important;
  transform: translateY(0);
}

/* Asset Type Selector */
.asset-type-selector, .currency-pair-dropdown {
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  font-size: 1rem;
  cursor: pointer;
  min-width: 160px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  font-weight: 500;
}

.asset-type-selector:focus, .currency-pair-dropdown:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 53, 87, 0.1), 0 4px 8px rgba(0, 0, 0, 0.1);
  background: white;
}

.currency-pair-dropdown {
  background: linear-gradient(135deg, #f0f8f0 0%, #e8f5e8 100%);
  border-color: #22c55e;
  transition: all 0.3s ease;
  position: relative;
}

.currency-pair-dropdown option {
  padding: 8px;
  font-size: 13px;
}

.currency-options {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #28a745;
  border-radius: 4px;
  margin-top: 2px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.currency-option {
  padding: 10px 15px;
  color: #333;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #eee;
}

.currency-option:hover {
  background: #f0f8f0;
}

.currency-option:last-child {
  border-bottom: none;
}

/* Auth & Google Button */
#googleSignInButton, #logoutButton {
  background: linear-gradient(135deg, var(--accent) 0%, #c92f3d 100%);
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 3px 10px rgba(230, 57, 70, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#googleSignInButton:hover, #logoutButton:hover {
  background: linear-gradient(135deg, #c92f3d 0%, #b91c1c 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(230, 57, 70, 0.4);
}

#authStatus {
  margin-top: 15px;
  font-size: 14px;
  color: #444;
}

/* Chart Canvas */
#stockChart {
  max-width: 100%;
  margin-top: 30px;
}

/* Tab Buttons */
.tabs {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.timeframe-btn {
  background: linear-gradient(135deg, var(--primary) 0%, #16324d 100%);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(29, 53, 87, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.timeframe-btn.active,
.timeframe-btn:hover {
  background: linear-gradient(135deg, var(--accent) 0%, #cc2936 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

#TableView {
  overflow-x: auto;
  width: 100%;
  display: flex;
  justify-content: center; /* Center the table horizontally */
}

#TableView table {
  width: 100%;
  min-width: 800px; /* or however wide your full table needs to be */
  max-width: 1200px; /* Add maximum width */
  border-collapse: collapse;
}

/* Standardized Table Styling for All Pages */
.portfolio-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 40px;
  font-size: 14px;
}

.portfolio-table th,
.portfolio-table td {
  border: 2px solid #999; /* Make borders thicker and darker */
  padding: 8px 10px;
  text-align: center;
}

.portfolio-table .header-row {
  background-color: #f2f2f2;
  font-weight: bold;
}

.portfolio-table .header-row th {
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: #f2f2f2;
}

/* Table row hover effect */
.portfolio-table tbody tr:hover {
  background-color: rgba(59, 130, 246, 0.1);
  transition: background-color 0.2s ease;
}

/* Specific column styling for semantic headers */
.symbol-header, .country-header { font-weight: bold; }
.price-header, .level-header { color: #2563eb; }
.volume-header { color: #7c3aed; }
.sentiment-header { color: #059669; }
.percent-header { color: #b91c1c; }
.trade-level-header { color: #c2410c; }
.signal-header { color: #4b5563; }

#stockTable {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 40px;
  font-size: 14px;
}

#stockTable th,
#stockTable td {
  border: 2px solid #999; /* Make borders thicker and darker */
  padding: 8px 10px;
  text-align: center;
}

#stockTable thead {
  position: sticky;
  top: 0;
  background-color: #f2f2f2;
  z-index: 2;
}

/* Standard Table Wrapper Styling */
#g20TableWrapper, #countriesTableWrapper, #cryptoTableWrapper, #sectorsTableWrapper, #portfolioTableWrapper, #macroTableWrapper, #tradeTableWrapper {
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid #ccc;
  margin-top: 20px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Color-coded classes */
.bullish {
  background-color: #2c5e1a;
  color: white;
  font-weight: bold;
}

.bearish {
  background-color: #f8d7da;
  color: #721c24;
  font-weight: bold;
}

.signal-low {
  background-color: #fbe8e7;
  color: #5c1e1e;
}

.signal-high {
  background-color: #e6f2ff;
  color: #1b4f72;
}

/* Help Icon */
.help-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 5px;
  background-color: #ccc;
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  line-height: 14px;
  text-align: center;
  cursor: help;
}

/* Text & Heading Styles */
h1, h2 {
  text-align: center;
  font-weight: 600;
  color: #222;
}

h2 {
  font-size: 1.4rem;
  margin-bottom: 10px;
}

#appInfo {
  text-align: center;
  font-size: 14px;
  color: #666;
  margin-top: 5px;
}

/* Footer */
footer {
  text-align: center;
  padding: 20px 0;
  font-size: 0.8rem;
  color: #666;
}

.performance-positive {
  background-color: #c6efce;
  color: #006100;
  font-weight: bold;
}
.performance-negative {
  background-color: #ffc7ce;
  color: #9c0006;
  font-weight: bold;
}

/* Ensure the container scrolls if table is tall */
#stockTableWrapper, #portfolioTableWrapper, #macroTableWrapper, #countriesTableWrapper, #g20TableWrapper, #cryptoTableWrapper, #currenciesTableWrapper, #middayTableWrapper, #tradeTableWrapper {
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid #ccc;
  margin-top: 20px;
}

#stockTable thead th {
  position: sticky;
  top: 0;
  background-color: #f9f9f9;
  z-index: 2;
  border-bottom: 2px solid #ccc;
}


.timeframe-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, #cc2936 100%);
  color: white;
  font-weight: 700;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
}

#stockSymbol {
  padding: 10px;
  width: 280px;
  max-width: 90%;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#fetchStockBtn {
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, #16324d 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 3px 10px rgba(29, 53, 87, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#fetchStockBtn:hover {
  background: linear-gradient(135deg, #16324d 0%, var(--primary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(29, 53, 87, 0.35);
}

#fetchStockBtn.active {
  background: linear-gradient(135deg, var(--accent) 0%, #cc2936 100%);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
}

/* ---- Tabs: Reusable & Consistent ---- */
.tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin: 20px auto;
  gap: 8px;
}

.tablinks {
  padding: 10px 20px;
  background-color: #f1f1f1;
  border: 1px solid #ccc;
  cursor: pointer;
  font-size: 16px;
  border-radius: 5px 5px 0 0;
  color: #333;
  transition: all 0.2s ease;
}

.tablinks:hover {
  background-color: #e2e2e2;
}

.tablinks.active {
  background-color: #fff;
  border-bottom: 1px solid #fff;
  color: var(--primary);
  font-weight: bold;
}

/* ---- Tab Content ---- */
.tabcontent {
  display: none;
  padding: 20px;
  border: 1px solid #ccc;
  border-radius: 0 5px 5px 5px;
  background: #fff;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
}

.tabcontent.active {
  display: block;
}

.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  text-align: center;
  font-size: 1.2rem;
  color: var(--primary);
}


.loading-screen img {
  width: 160px;
  height: auto;
  margin-bottom: 20px;
}

/* Toast notifications - Premium style */
#toast-container {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  z-index: 10000 !important;
  pointer-events: none !important;
  width: auto !important;
  max-width: 400px !important;
}

.toast {
  all: unset !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  padding: 16px 24px !important;
  margin-bottom: 10px !important;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85)) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(255, 215, 0, 0.3) !important;
  border-radius: 16px !important;
  color: #1a1a1a !important;
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
  box-shadow: 
    0 8px 32px rgba(255, 215, 0, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
  transform: translateX(400px) !important;
  opacity: 0 !important;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
  pointer-events: auto !important;
  position: relative !important;
  overflow: hidden !important;
  min-width: 280px !important;
  max-width: 380px !important;
}

.toast::before {
  content: '';
  position: absolute !important;
  top: 0 !important;
  left: -100% !important;
  width: 100% !important;
  height: 100% !important;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.3), transparent) !important;
  animation: shimmer 3s infinite !important;
  z-index: 1 !important;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.toast.show {
  transform: translateX(0) !important;
  opacity: 1 !important;
}

.toast.hide {
  transform: translateX(400px) !important;
  opacity: 0 !important;
}

/* Toast icon styling */
.toast-icon {
  font-size: 20px !important;
  filter: drop-shadow(0 0 8px rgba(0, 215, 255, 0.6)) !important;
  z-index: 2 !important;
  position: relative !important;
  flex-shrink: 0 !important;
}

/* Toast message text */
.toast-message {
  z-index: 2 !important;
  position: relative !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 280px !important;
}

.toast-error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border-left: 4px solid #f87171;
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.toast-info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-left: 4px solid #60a5fa;
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.toast-icon {
  margin-right: 12px;
  font-size: 22px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.toast-message {
  flex: 1;
}

/* Share Chart Button */
#shareChartBtn {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 20px auto;
  display: block;
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#shareChartBtn:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(139, 92, 246, 0.4);
}

@keyframes toast-fade-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-fade-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Action button styling */
.action-button {
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #111827;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  padding: 8px 16px;
  text-align: center;
  transition: all 0.15s ease-in-out;
}

.action-button:hover {
  background-color: #e5e7eb;
}

.action-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.action-bar {
  margin: 10px 0;
}

.plan-usage-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 15px 0;
  flex-wrap: wrap;
}

.plan-usage-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  background-color: white;
  padding: 8px 12px;
  border-radius: 9999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  color: white;
  font-size: 0.85rem;
  width: fit-content;
}

.pill {
  background-color: black;
  color: white;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}


.usage-counter {
  font-size: 0.9rem;
  color: #333;
  background: #f8f8f8;
  border: 1px solid #ccc;
  border-radius: 12px;
  padding: 6px 14px;
  font-weight: 500;
}

/* Premium Display Styling */
.premium-display {
  display: none; /* Hidden by default, shown for premium users */
  justify-content: center;
  align-items: center;
  margin: 15px 0;
}

.premium-badge {
  background: linear-gradient(135deg, #1D3557 0%, #E63946 100%);
  color: white;
  border: 2px solid #ffd700;
  border-radius: 25px;
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
  transition: all 0.3s ease;
}

.premium-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(230, 57, 70, 0.4);
}

.signal-toggles {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
}

.toggle-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.emoji-label {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.switch-label {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
  padding: 0;
}

.switch-label input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 3px;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.slider::before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  bottom: 3px;
  left: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.switch-label input:checked + .slider {
  background-color: var(--accent);
}

.switch-label input:checked + .slider::before {
  transform: translateX(28px);
}

#upgradeButton {
  margin-top: 8px;
  padding: 10px 16px;
  background-color: var(--accent);
  color: white;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.upgrade-pill:hover {
  background-color: #c92f3d;
}

.upgrade-pill {
  background-color: #e91e63;
  color: white;
  border: none;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}


.usage-warning {
  background-color: orange !important;
  color: white !important;
}

.hidden {
  display: none;
}

.upgrade-pill-options {
  display: block;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}

.upgrade-pill-options {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.upgrade-pill-options {
  background-color: var(--highlight);
}

.display-none {
  display: none;
}

.display-flex {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}

.upgrade-btn {
  background-color: #e91e63;
  color: white;
  border: none;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

#star-btn {
  padding: 12px 16px;
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(107, 114, 128, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#star-btn:hover {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

#star-btn.starred {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

#star-btn.starred:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Share Chart Button */
#shareChartBtn {
  padding: 12px 20px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 15px;
}

#shareChartBtn:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(139, 92, 246, 0.35);
}

.view-portfolio-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background-color: #1a73e8;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  z-index: 100;
}

.view-portfolio-btn:hover {
  background-color: #155ab6;
}

.back-to-app-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: background-color 0.2s;
  z-index: 100;
}

.back-to-app-btn:hover {
  background-color: #c92f3d;
}

.fade-out {
  background-color: #ffe5e5; /* soft red background */
  transition: opacity 300ms ease-out, background-color 300ms ease-out;
  opacity: 0;
}

/* Portfolio Table Layout */
#portfolio-table {
  width: 100%;
  border-collapse: collapse;
  font-family: Arial, sans-serif;
  font-size: 14px;
  margin-top: 20px;
}

#portfolio-table th,
#portfolio-table td {
  padding: 8px 10px;
  border: 1px solid #ccc;
  text-align: center;
}

#portfolio-table thead {
  background-color: #f2f2f2;
  font-weight: bold;
}

#portfolio-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* Distance coloring */
td[data-style="positive"] {
  color: green;
  font-weight: bold;
}
td[data-style="negative"] {
  color: red;
  font-weight: bold;
}

/* Remove Button */
.remove-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
}

.remove-btn:hover {
  color: crimson;
}

/* Action Buttons Container */
.action-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

/* Alert Button */
.alert-btn {
  background: transparent;
  border: 1px solid rgba(230, 57, 70, 0.3);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #E63946;
}

.alert-btn:hover {
  background: rgba(230, 57, 70, 0.1);
  border-color: #E63946;
  transform: translateY(-1px);
}

/* Alerts Navigation Button */
.alerts-nav-btn {
  background: linear-gradient(135deg, #E63946, #dc3545);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
}

.alerts-nav-btn:hover {
  background: linear-gradient(135deg, #dc3545, #c82333);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
}

/* Commentary Controls Container */
.commentary-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Navigation Buttons */
.nav-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 10px 0;
}

.nav-btn {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background-color 0.2s;
}

.nav-btn:hover {
  background-color: #16324d;
}

/* Premium Feature Styling */
.nav-btn.premium-only {
  position: relative;
  background: linear-gradient(135deg, #1D3557 0%, #E63946 100%);
  border: 2px solid #ffd700;
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
}

.nav-btn.premium-only:hover {
  background: linear-gradient(135deg, #16324d 0%, #cc2936 100%);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
  transform: translateY(-1px);
}

.nav-btn.premium-only::after {
  content: "💎";
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ffd700;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Premium User Styling - Same gradient without diamonds */
.nav-btn.premium-user {
  position: relative;
  background: linear-gradient(135deg, #1D3557 0%, #E63946 100%);
  border: 2px solid #ffd700;
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
}

.nav-btn.premium-user:hover {
  background: linear-gradient(135deg, #16324d 0%, #cc2936 100%);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
  transform: translateY(-1px);
}

/* Remove diamond for premium users - no ::after pseudo-element */

/* Sector Table Layout */
#sectors-table {
  width: 100%;
  border-collapse: collapse;
  font-family: Arial, sans-serif;
  font-size: 14px;
  margin-top: 20px;
}

#sectors-table th,
#sectors-table td {
  padding: 8px 10px;
  border: 1px solid #ccc;
  text-align: center;
}

#sectors-table thead {
  background-color: #f2f2f2;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 2;
}

#sectors-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

#sectors-table tbody tr:hover {
  background-color: #f5f5f5;
}

#sectors-table td a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

#sectors-table td a:hover {
  text-decoration: underline;
}

/* AI Sector Analysis Styling */
.sector-analysis {
  padding: 15px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin: 15px 0;
}

.sector-analysis .ticker {
  font-weight: 700;
  color: var(--primary);
  font-family: 'Monaco', 'Consolas', monospace;
}

.sector-analysis p {
  margin: 8px 0;
  line-height: 1.6;
  font-size: 14px;
}

.sector-analysis .analysis-section {
  margin: 15px 0;
  padding: 10px;
  border-left: 3px solid var(--soft);
  background-color: #fafafa;
}

.sector-analysis .section-header {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 15px;
}

.sector-analysis .ticker-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 5px 0;
  align-items: center;
}

.sector-analysis .ticker-label {
  background-color: var(--bg);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 13px;
}

/* Macro Table Layout */
#macro-table {
  width: 100%;
  border-collapse: collapse;
  font-family: Arial, sans-serif;
  font-size: 14px;
  margin-top: 20px;
}

#macro-table th,
#macro-table td {
  padding: 8px 10px;
  border: 1px solid #ccc;
  text-align: center;
}

#macro-table thead {
  background-color: #f2f2f2;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 2;
}

#macro-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

#macro-table tbody tr:hover {
  background-color: #f5f5f5;
}

#macro-table td a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

#macro-table td a:hover {
  text-decoration: underline;
}

/* Trade Table Styles */
#trade-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  margin-top: 0;
  background: transparent;
  border: none; /* Removed the border */
}

#trade-table th {
  background-color: rgba(233, 236, 239, 0.95); /* More neutral gray color */
  color: #2c3e50;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px 15px;
  text-align: center;
  border-bottom: 2px solid #d1d9e6; /* Lighter border color */
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.02);
}

#trade-table td {
  padding: 12px 15px;
  text-align: center;
  border: 1px solid #dee2e6;
  border-top: none;
  border-left: none;
  border-right: none;
}

#trade-table tr {
  background-color: rgba(255, 255, 255, 0.8);
}

#trade-table tr:nth-child(even) {
  background-color: rgba(240, 242, 245, 0.7); /* Much more subtle light gray with minimal blue tint */
}

#trade-table tr:hover {
  background-color: rgba(235, 235, 235, 0.8); /* Neutral light gray hover */
  transition: all 0.2s ease;
}

/* Symbol links */
#trade-table td a {
  color: #2874f0;
  font-weight: 600;
  text-decoration: none;
}

#trade-table td a:hover {
  text-decoration: underline;
}

/* Upside percentage styling - sliding green scale */
.upside-very-low {
  background-color: #8bc34a;
  color: white;
  border: 1px solid rgba(164, 213, 174, 0.5);
  padding: 5px 6px;
  border-radius: 3px;
  font-weight: bold;
  display: inline-block;
  min-width: 40px;
  text-align: center;
}

.upside-low {
  background-color: #66bb6a;
  color: white;
  border: 1px solid rgba(164, 213, 174, 0.5);
  padding: 5px 6px;
  border-radius: 3px;
  font-weight: bold;
  display: inline-block;
  min-width: 40px;
  text-align: center;
}

.upside-medium {
  background-color: #43a047;
  color: white;
  border: 1px solid rgba(164, 213, 174, 0.5);
  padding: 5px 6px;
  border-radius: 3px;
  font-weight: bold;
  display: inline-block;
  min-width: 40px;
  text-align: center;
}

.upside-high {
  background-color: #2e7d32;
  color: white;
  border: 1px solid rgba(164, 213, 174, 0.5);
  padding: 5px 6px;
  border-radius: 3px;
  font-weight: bold;
  display: inline-block;
  min-width: 40px;
  text-align: center;
}

.upside-very-high {
  background-color: #1b5e20;
  color: white;
  border: 1px solid rgba(164, 213, 174, 0.5);
  padding: 5px 6px;
  border-radius: 3px;
  font-weight: bold;
  display: inline-block;
  min-width: 40px;
  text-align: center;
}

/* Sentiment label styling - matching the darkest green */
.sentiment-label.bullish {
  background-color: #1b5e20;
  color: white;
  border: 1px solid rgba(164, 213, 174, 0.5);
  padding: 5px 6px;
  border-radius: 3px;
  font-weight: 600;
  display: inline-block;
  min-width: 40px;
  text-align: center;
}

/* Add to Portfolio button - Ultra specific selector to override everything */
table .add-to-portfolio-btn,
td .add-to-portfolio-btn,
.add-to-portfolio-btn {
  position: relative !important;
  background: linear-gradient(135deg, #1D3557 0%, #E63946 100%) !important;
  color: white !important;
  border: 2px solid #ffd700 !important;
  border-radius: 25px !important;
  padding: 8px 16px !important;
  font-size: 0.9rem !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  margin-top: 8px !important;
  font-weight: 600 !important;
  box-shadow: 0 3px 10px rgba(230, 57, 70, 0.3) !important;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  line-height: normal !important;
  min-width: auto !important;
  width: auto !important;
  height: auto !important;
}

table .add-to-portfolio-btn::after,
td .add-to-portfolio-btn::after,
.add-to-portfolio-btn::after {
  content: "💎" !important;
  position: absolute !important;
  top: -8px !important;
  right: -8px !important;
  background: #ffd700 !important;
  border-radius: 50% !important;
  width: 20px !important;
  height: 20px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 12px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
}

table .add-to-portfolio-btn:hover,
td .add-to-portfolio-btn:hover,
.add-to-portfolio-btn:hover {
  background: linear-gradient(135deg, #16324d 0%, #cc2936 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 5px 15px rgba(230, 57, 70, 0.4) !important;
}

table .add-to-portfolio-btn:active,
td .add-to-portfolio-btn:active,
.add-to-portfolio-btn:active {
  transform: translateY(-1px) !important;
}

table .add-to-portfolio-btn.added,
td .add-to-portfolio-btn.added,
.add-to-portfolio-btn.added {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
  border-color: #4ade80 !important;
  cursor: default !important;
  box-shadow: 0 3px 10px rgba(34, 197, 94, 0.3) !important;
}

table .add-to-portfolio-btn.added::after,
td .add-to-portfolio-btn.added::after,
.add-to-portfolio-btn.added::after {
  content: "✅" !important;
  background: #4ade80 !important;
}

/* Entry zone styling */
.entry-yes {
  color: #1b5e20;
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.entry-no {
  color: #c62828;
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

/* Success message animation */
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(10px); }
  10% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

.add-success-message {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
  animation: fadeInOut 3s ease-in-out forwards;
  z-index: 1000;
  border: 2px solid #34d399;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-success-message::before {
  content: "💎";
  font-size: 18px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* Trade Table Wrapper Styles */
#tradeTableWrapper {
  max-height: 70vh;
  overflow-y: auto;
  margin: 20px auto;
  max-width: 90%;
  width: 1000px;
  display: flex;
  justify-content: center;
  scrollbar-width: thin;
  scrollbar-color: #cfd8dc #f5f5f5;
}

#tradeTableWrapper::-webkit-scrollbar {
  width: 8px;
}

#tradeTableWrapper::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 4px;
}

#tradeTableWrapper::-webkit-scrollbar-thumb {
  background-color: #cfd8dc;
  border-radius: 4px;
  border: 2px solid #f5f5f5;
}

tr.goldilocks td {
  background-color: #fef9c3; /* yellow */
}
tr.boom td {
  background-color: #dcfce7; /* green */
}
tr.stagflation td {
  background-color: #ede9fe; /* purple */
}
tr.recession td {
  background-color: #dbeafe; /* blue */
}

/* Premium Modal Styles */
.premium-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.premium-modal-content {
  background: white;
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.premium-modal-header {
  background: linear-gradient(135deg, #1D3557 0%, #E63946 100%);
  color: white;
  padding: 20px;
  border-radius: 16px 16px 0 0;
  position: relative;
}

.premium-modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  color: white;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.premium-modal-close:hover {
  opacity: 1;
}

.premium-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.premium-modal-body {
  padding: 30px;
  text-align: center;
}

.premium-feature-icon {
  font-size: 4rem;
  margin-bottom: 15px;
}

.premium-modal-body h3 {
  color: var(--primary);
  margin: 0 0 15px 0;
  font-size: 1.3rem;
}

.premium-modal-body p {
  color: #666;
  margin-bottom: 20px;
  line-height: 1.6;
}

.premium-features-list {
  text-align: left;
  max-width: 350px;
  margin: 0 auto 25px auto;
  padding: 0;
  list-style: none;
}

.premium-features-list li {
  padding: 8px 0;
  color: #333;
  font-weight: 500;
}

.premium-pricing {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 20px;
  margin: 25px 0;
  border: 2px solid #ffd700;
}

.price-highlight {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin-bottom: 8px;
}

.price {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
}

.period {
  font-size: 1.1rem;
  color: #666;
  margin-left: 5px;
}

.price-description {
  margin: 0;
  color: #555;
  font-size: 0.9rem;
}

.premium-modal-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 25px;
}

.premium-upgrade-btn {
  background: linear-gradient(135deg, #E63946 0%, #dc2626 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

.premium-upgrade-btn:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(230, 57, 70, 0.4);
}

.premium-cancel-btn {
  background: transparent;
  color: #666;
  border: 2px solid #ddd;
  padding: 13px 25px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.premium-cancel-btn:hover {
  border-color: #999;
  color: #333;
}

/* Multi-Auth Styling - Popup Page Only */
.auth-alternatives {
  margin-top: 20px;
  text-align: center;
}

.auth-divider {
  color: #666;
  font-size: 0.9rem;
  margin: 15px 0;
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #ddd, transparent);
}

.auth-divider::before {
  left: 0;
}

.auth-divider::after {
  right: 0;
}

.auth-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 15px 0;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
  color: #333;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.auth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-icon {
  font-size: 1.1rem;
}

.facebook-btn:hover {
  border-color: #1877f2;
  background: #f0f8ff;
}

.github-btn:hover {
  border-color: #333;
  background: #f6f8fa;
}

.microsoft-btn:hover {
  border-color: #0078d4;
  background: #f0f8ff;
}

.apple-btn:hover {
  border-color: #000;
  background: #f9f9f9;
}

@media screen and (max-width: 480px) {
  .auth-buttons-grid {
    grid-template-columns: 1fr;
    max-width: 250px;
  }
  
  .auth-btn {
    padding: 14px 20px;
    font-size: 0.95rem;
  }
}

/* ===== BENEFIT CARDS STYLING ===== */

.benefits-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

/* CTA Section Styling */
.cta-section {
  text-align: center;
  margin: 40px auto;
  padding: 0 20px;
  max-width: 600px;
}

.primary-cta {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  border: none;
  padding: 20px 40px;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
  width: 100%;
  max-width: 400px;
  margin: 0 auto 20px auto;
  display: block;
  text-align: center;
}

.primary-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.cta-subtitle {
  display: block;
  font-size: 0.95rem;
  margin-top: 6px;
  opacity: 0.95;
  font-weight: normal;
}

.auth-benefits {
  margin-top: 24px;
  text-align: center;
}

.auth-benefits p {
  margin: 12px 0;
  color: #666;
  font-size: 1rem;
  line-height: 1.5;
}

.benefit-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.benefit-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
  transition: left 0.6s ease;
}

.benefit-card:hover::before {
  left: 100%;
}

.benefit-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.4);
}

.benefit-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
}

.benefit-card h3 {
  color: var(--primary);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.benefit-card p {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}

/* Mobile Responsiveness for Benefit Cards */
@media screen and (max-width: 768px) {
  .benefits-cards {
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 30px auto;
    padding: 0 16px;
  }
  
  .benefit-card {
    padding: 20px;
  }
  
  .benefit-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
  }
  
  .benefit-card h3 {
    font-size: 1.2rem;
  }
  
  .benefit-card p {
    font-size: 0.9rem;
  }
  
  /* Popup Page Mobile Optimization */
  .popup-page {
    padding: 0;
    margin: 0;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
  }
  
  .popup-page header {
    padding: 20px 16px !important;
    text-align: center;
  }
  
  .popup-page .premium-title {
    font-size: 1.8rem !important;
    margin: 16px 0 8px 0 !important;
  }
  
  .popup-page .premium-tagline {
    font-size: 1rem !important;
    margin-bottom: 20px !important;
    padding: 0 16px;
  }
  
  /* CTA Section Mobile */
  .popup-page .cta-section {
    padding: 20px 16px !important;
    margin: 0 !important;
  }
  
  .popup-page .primary-cta {
    width: 100% !important;
    max-width: none !important;
    padding: 16px 20px !important;
    font-size: 1.1rem !important;
    margin-bottom: 16px !important;
    border-radius: 12px !important;
    min-height: 56px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  
  .popup-page .cta-subtitle {
    font-size: 0.9rem !important;
    margin-top: 4px !important;
    opacity: 0.9;
  }
  
  .popup-page .auth-benefits {
    text-align: center;
    padding: 0 16px;
  }
  
  .popup-page .auth-benefits p {
    font-size: 0.9rem !important;
    margin: 8px 0 !important;
    line-height: 1.4;
  }
  
  /* Footer Mobile */
  .popup-page footer {
    padding: 20px 16px !important;
    text-align: center;
    font-size: 0.8rem !important;
  }
  
  .popup-page footer a {
    display: block !important;
    margin: 0 0 8px 0 !important;
  }
  
  /* Additional Popup Mobile Optimizations */
  .popup-page .premium-logo {
    margin: 20px auto !important;
    transform: scale(0.9);
  }
  
  .popup-page .logo-circle {
    width: 80px !important;
    height: 80px !important;
  }
  
  .popup-page .logo-text {
    font-size: 1.8rem !important;
  }
  
  .popup-page .logo-diamond {
    font-size: 1.2rem !important;
  }
  
  /* Improve touch targets */
  .popup-page button {
    min-height: 44px !important;
    touch-action: manipulation;
  }
  
  /* Prevent zoom on input focus */
  .popup-page input {
    font-size: 16px !important;
  }
  
  /* Better spacing for mobile */
  .popup-page section {
    margin: 20px 0 !important;
  }
  
  /* Benefits cards full width on mobile */
  .popup-page .benefits-cards {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    padding: 0 16px !important;
    box-sizing: border-box;
  }
}

/* Extra small mobile devices */
@media screen and (max-width: 480px) {
  .popup-page .premium-title {
    font-size: 1.5rem !important;
  }
  
  .popup-page .premium-tagline {
    font-size: 0.9rem !important;
  }
  
  .popup-page .primary-cta {
    font-size: 1rem !important;
    padding: 14px 18px !important;
  }
  
  .popup-page .cta-subtitle {
    font-size: 0.8rem !important;
  }
  
  .popup-page .auth-benefits p {
    font-size: 0.8rem !important;
  }
  
  .popup-page .benefit-card {
    padding: 16px !important;
  }
  
  .popup-page .benefit-card h3 {
    font-size: 1.1rem !important;
  }
  
  .popup-page .benefit-card p {
    font-size: 0.85rem !important;
  }
}

/* ===== MOBILE OPTIMIZATION STYLES ===== */

/* Base mobile optimizations */
@media screen and (max-width: 768px) {
  /* Header Mobile Optimizations */
  header {
    padding: 20px 16px 15px;
  }
  
  .premium-title .title-main {
    font-size: 1.8rem;
  }
  
  .premium-tagline {
    font-size: 0.9rem;
    margin: 8px 0;
  }
  
  /* User Profile Navigation Mobile */
  .user-profile-nav {
    top: 15px;
    right: 15px;
    gap: 8px;
  }
  
  .alert-icon-badge, .profile-avatar {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  
  /* Plan Usage Container Mobile */
  .plan-usage-container {
    flex-direction: column;
    gap: 8px;
    padding: 0 16px;
  }
  
  .plan-usage-container .pill {
    font-size: 0.8rem;
    padding: 6px 12px;
  }
  
  /* Main App Container Mobile */
  main, #app-container {
    padding: 8px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }
  
  /* Input Group Mobile Optimizations */
  .input-group {
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: stretch;
  }
  
  .input-group input {
    width: 100%;
    max-width: none;
    padding: 14px 16px;
    font-size: 1rem;
    box-sizing: border-box;
    color: #333 !important;
    background-color: #fff !important;
    border: 2px solid #ddd !important;
  }
  
  .input-group button {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    box-sizing: border-box;
  }
  
  .asset-type-selector, .currency-pair-dropdown {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    box-sizing: border-box;
    color: #333 !important;
    background-color: #fff !important;
    border: 2px solid #ddd !important;
  }
  
  /* Navigation Buttons Mobile */
  .nav-buttons {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 10px 0;
    padding: 0 4px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .nav-btn {
    flex: 1 1 calc(50% - 3px);
    min-width: 120px;
    max-width: calc(50% - 3px);
    padding: 10px 6px;
    font-size: 0.8rem;
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* Timeframe Tabs Mobile */
  .timeframe-tabs {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }
  
  .timeframe-btn {
    flex: 1 1 calc(33.333% - 4px);
    min-width: 60px;
    padding: 10px 8px;
    font-size: 0.85rem;
  }
  
  .toggle-tips-btn {
    flex: 1 1 100%;
    margin: 8px 0 0 0 !important;
  }
  
  /* Chart Containers Mobile */
  .chart-container {
    height: 300px !important;
    margin: 8px 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }
  
  #chartWrapper, #candlestickWrapper {
    height: 320px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 8px 0 !important;
    padding: 0 !important;
  }
  
  #dailySentimentWrapper, #sentiment15DayWrapper {
    height: 280px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 8px 0 !important;
    padding: 0 !important;
  }
  
  #volumeWrapper, #volatilityWrapper, #customCorrelationWrapper, 
  #standardVolatilityWrapper {
    height: 250px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 8px 0 !important;
    padding: 0 !important;
  }
  
  #correlationWrapper {
    height: 200px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 8px 0 !important;
    padding: 0 !important;
  }
  
  /* Tips Cards Mobile */
  .trade-range-tips-card, .candlestick-tips-card, .sentiment-tips-card,
  .volatility-tips-card, .standard-volatility-tips-card {
    padding: 12px;
    margin: 8px 0 !important;
    font-size: 12px;
    line-height: 1.3;
  }
  
  .trade-range-tips-card ul, .candlestick-tips-card ul, .sentiment-tips-card ul,
  .volatility-tips-card ul, .standard-volatility-tips-card ul {
    padding-left: 12px;
  }
  
  .trade-range-tips-card li, .candlestick-tips-card li, .sentiment-tips-card li,
  .volatility-tips-card li, .standard-volatility-tips-card li {
    margin-bottom: 3px;
  }
  
  /* Table Mobile */
  #stockTableWrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  #stockTable {
    font-size: 0.8rem;
    min-width: 600px;
  }
  
  /* Loading Screen Mobile */
  .loading-progress-container {
    max-width: 320px;
    padding: 20px 16px;
    margin: 15px;
  }
  
  .loading-steps {
    gap: 8px;
  }
  
  .step-label {
    font-size: 0.7rem;
  }
  
  .step-icon {
    font-size: 1rem;
  }
  
  /* Loading Screen Main Mobile */
  .loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    text-align: center;
    font-size: 1rem;
    color: var(--primary);
    padding: 20px;
    box-sizing: border-box;
  }
  
  .loading-screen img {
    width: 120px;
    height: auto;
    margin-bottom: 20px;
  }
  
  .loading-text {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--primary);
  }
  
  .loading-percentage {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--accent);
  }
  
  .loading-progress-container {
    width: 100%;
    max-width: 300px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }
  
  .loading-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
  }
  
  .loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 0.3s ease;
  }
  
  .loading-steps {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .loading-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 60px;
  }
  
  .step-icon {
    font-size: 1.2rem;
    margin-bottom: 5px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
  }
  
  .step-icon.active {
    opacity: 1;
    animation: pulse 1.5s infinite;
  }
  
  .step-label {
    font-size: 0.75rem;
    text-align: center;
    color: #666;
    line-height: 1.2;
  }
  
  @keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
  }
  
  /* Footer Mobile */
  footer {
    padding: 15px;
    font-size: 0.8rem;
    text-align: center;
  }
  
  /* Logout Button Mobile */
  #logoutButton {
    padding: 12px 20px;
    font-size: 0.9rem;
    margin: 20px 0;
  }
}

/* Extra small screens (phones in portrait) */
@media screen and (max-width: 480px) {
  /* Header Extra Small */
  header {
    padding: 15px 12px 10px;
  }
  
  .premium-title .title-main {
    font-size: 1.6rem;
  }
  
  .premium-tagline {
    font-size: 0.85rem;
  }
  
  .logo-circle {
    width: 60px;
    height: 60px;
  }
  
  .logo-text {
    font-size: 1.2rem;
  }
  
  /* User Profile Navigation Extra Small */
  .user-profile-nav {
    top: 12px;
    right: 12px;
    gap: 6px;
  }
  
  .alert-icon-badge, .profile-avatar {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  
  /* Main Container Extra Small */
  main, #app-container {
    padding: 6px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Input Group Extra Small */
  .input-group input, .input-group button,
  .asset-type-selector, .currency-pair-dropdown {
    padding: 12px 14px;
    font-size: 0.95rem;
    color: #333 !important;
    background-color: #fff !important;
    border: 2px solid #ddd !important;
  }
  
  /* Navigation Buttons Extra Small */
  .nav-btn {
    flex: 1 1 calc(50% - 3px);
    min-width: 0;
    max-width: calc(50% - 3px);
    margin-bottom: 4px;
    padding: 12px 8px;
    font-size: 0.85rem;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* Timeframe Tabs Extra Small */
  .timeframe-btn {
    flex: 1 1 calc(50% - 3px);
    padding: 8px 6px;
    font-size: 0.8rem;
  }
  
  /* Chart Containers Extra Small */
  .chart-container {
    height: 280px !important;
    margin: 6px 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }
  
  #chartWrapper, #candlestickWrapper {
    height: 300px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 6px 0 !important;
    padding: 0 !important;
  }
  
  #dailySentimentWrapper, #sentiment15DayWrapper {
    height: 260px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 6px 0 !important;
    padding: 0 !important;
  }
  
  #volumeWrapper, #volatilityWrapper, #customCorrelationWrapper, 
  #standardVolatilityWrapper {
    height: 220px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 6px 0 !important;
    padding: 0 !important;
  }
  
  #correlationWrapper {
    height: 180px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 6px 0 !important;
    padding: 0 !important;
  }
  
  /* Tips Cards Extra Small */
  .trade-range-tips-card, .candlestick-tips-card, .sentiment-tips-card,
  .volatility-tips-card, .standard-volatility-tips-card {
    padding: 10px;
    margin: 6px 0 !important;
    font-size: 11px;
  }
  
  .trade-range-tips-card div, .candlestick-tips-card div, .sentiment-tips-card div,
  .volatility-tips-card div, .standard-volatility-tips-card div {
    font-size: 12px;
    margin-bottom: 6px;
  }
  
  /* Loading Screen Extra Small */
  .loading-progress-container {
    max-width: 280px;
    padding: 16px 12px;
  }
  
  .loading-text {
    font-size: 0.9rem;
  }
  
  .loading-percentage {
    font-size: 1.1rem;
  }
  
  .loading-screen {
    padding: 16px;
  }
  
  .loading-screen img {
    width: 100px;
    margin-bottom: 16px;
  }
  
  .loading-steps {
    gap: 6px;
  }
  
  .loading-step {
    min-width: 50px;
  }
  
  .step-icon {
    font-size: 1rem;
  }
  
  .step-label {
    font-size: 0.7rem;
  }
  
  /* Table Extra Small */
  #stockTable {
    font-size: 0.75rem;
    min-width: 500px;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets */
  .nav-btn, .timeframe-btn, #fetchStockBtn, #refreshStockBtn, #star-btn {
    min-height: 44px;
    touch-action: manipulation;
  }
  
  /* Remove hover effects on touch devices */
  .nav-btn:hover, .timeframe-btn:hover {
    transform: none;
    background-color: var(--primary);
  }
  
  /* Improve button feedback */
  .nav-btn:active, .timeframe-btn:active, 
  .input-group button:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
}

/* Landscape orientation optimizations */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .chart-container {
    height: 250px !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
  }
  
  #chartWrapper, #candlestickWrapper {
    height: 270px !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }
  
  .nav-buttons {
    margin: 8px 0;
    padding: 0 4px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .nav-btn {
    flex: 1 1 calc(33.333% - 4px);
    min-width: 100px;
    max-width: calc(33.333% - 4px);
    font-size: 0.8rem;
    padding: 8px 4px;
    box-sizing: border-box;
  }
}

/* ===== MOBILE PERFORMANCE OPTIMIZATIONS ===== */

/* Prevent horizontal scroll on mobile */
html, body {
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Mobile full-width container fix */
@media screen and (max-width: 768px) {
  * {
    box-sizing: border-box;
  }
  
  body {
    margin: 0;
    padding: 0;
    width: 100vw;
    max-width: 100vw;
  }
  
  /* Ensure all chart containers use full width */
  .chart-container, 
  #chartWrapper, #candlestickWrapper,
  #dailySentimentWrapper, #sentiment15DayWrapper,
  #volumeWrapper, #volatilityWrapper, 
  #customCorrelationWrapper, #standardVolatilityWrapper,
  #correlationWrapper {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    margin-top: 8px !important;
    margin-bottom: 8px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    box-sizing: border-box !important;
  }
  
  /* Fix button container width */
  .nav-buttons {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 4px !important;
    box-sizing: border-box !important;
  }
}

/* Improve scrolling performance on mobile */
.chart-container, #stockTableWrapper, #portfolioTableWrapper, #macroTableWrapper, #countriesTableWrapper, #g20TableWrapper, #cryptoTableWrapper, #currenciesTableWrapper, #middayTableWrapper, #tradeTableWrapper {
  -webkit-overflow-scrolling: touch;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Prevent zoom on input focus (iOS Safari) */
input[type="text"], input[type="email"], input[type="password"], select {
  font-size: 16px !important;
  color: #333 !important;
  background-color: #fff !important;
  border: 2px solid #ddd !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Ensure input text is always visible */
input, select, textarea {
  color: #333 !important;
  background-color: #fff !important;
  border: 2px solid #ddd !important;
}

input:focus, select:focus, textarea:focus {
  color: #333 !important;
  background-color: #fff !important;
  border-color: var(--primary) !important;
  outline: none !important;
}

/* Override any dark mode input styling */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px white inset !important;
  -webkit-text-fill-color: #333 !important;
}

/* Optimize animations for mobile */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark mode mobile optimizations */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
  .trade-range-tips-card, .candlestick-tips-card, .sentiment-tips-card,
  .volatility-tips-card, .standard-volatility-tips-card {
    background-color: rgba(40, 40, 40, 0.95);
    border-color: #444;
  }
  
  input, select {
    background-color: #333;
    border-color: #555;
    color: #fff;
  }
  
  button {
    background: linear-gradient(135deg, #444, #666);
    color: #fff;
  }
}

/* Mobile modal optimizations */
@media screen and (max-width: 768px) {
  .premium-modal-content {
    width: 95%;
    max-width: none;
    margin: 20px;
    border-radius: 12px;
  }
  
  .premium-modal-header {
    padding: 16px;
    border-radius: 12px 12px 0 0;
  }
  
  .premium-modal-header h2 {
    font-size: 1.3rem;
  }
  
  .premium-modal-body {
    padding: 20px 16px;
  }
  
  .premium-modal-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .premium-upgrade-btn, .premium-cancel-btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
  }
}

/* Mobile toast optimizations */
@media screen and (max-width: 768px) {
  #toast-container {
    bottom: 10px !important;
    right: 10px !important;
    left: 10px !important;
    max-width: none !important;
  }
  
  .toast {
    min-width: auto !important;
    max-width: none !important;
    font-size: 14px !important;
    padding: 14px 18px !important;
  }
  
  .toast-message {
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
}

/* ===== PORTFOLIO PAGE MOBILE OPTIMIZATIONS ===== */

@media screen and (max-width: 768px) {
  /* Portfolio Header Mobile */
  .header-content h1 {
    font-size: 1.8rem;
    text-align: center;
  }
  
  .header-content p {
    font-size: 0.9rem;
    text-align: center;
  }
  
  /* Back to App Button Mobile */
  .back-to-app-btn {
    top: 12px;
    left: 12px;
    padding: 8px 12px;
    font-size: 0.9rem;
    z-index: 100;
  }
  
  /* Portfolio main container override */
  .portfolio-page main,
  .portfolio-page #app-container,
  .macro-page main,
  .macro-page #app-container,
  .countries-page main,
  .countries-page #app-container,
  .g20-page main,
  .g20-page #app-container,
  .crypto-page main,
  .crypto-page #app-container,
  .currencies-page main,
  .currencies-page #app-container,
  .midday-page main,
  .midday-page #app-container,
  .trade-page main,
  .trade-page #app-container,
  .popup-page main,
  .popup-page #app-container {
    padding: 8px 0 !important;
  }
  
  /* Portfolio Table Mobile Wrapper */
  #TableView {
    max-height: 70vh;
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid #ccc;
    margin-top: 20px;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Portfolio Table Mobile */
  #portfolio-table {
    width: 100%;
    font-size: 0.8rem;
    min-width: 600px;
    border-collapse: collapse;
    background: white;
    margin: 0;
    padding: 0;
  }
  
  #portfolio-table th,
  #portfolio-table td {
    padding: 8px 10px;
    border: 1px solid #ccc;
    text-align: center;
  }
  
  #portfolio-table thead {
    background-color: #f2f2f2;
    font-weight: bold;
  }
  
  #portfolio-table thead th {
    position: sticky;
    top: 0;
    background-color: #f9f9f9;
    z-index: 2;
    border-bottom: 2px solid #ccc;
  }
  
  #portfolio-table tr:nth-child(even) {
    background-color: #f9f9f9;
  }
  
  /* Ensure first column (Symbol) is visible */
  #portfolio-table th:first-child,
  #portfolio-table td:first-child,
  #macro-table th:first-child,
  #macro-table td:first-child,
  #countries-table th:first-child,
  #countries-table td:first-child,
  #g20-table th:first-child,
  #g20-table td:first-child,
  #crypto-table th:first-child,
  #crypto-table td:first-child,
  #currencies-table th:first-child,
  #currencies-table td:first-child,
  #midday-table th:first-child,
  #midday-table td:first-child,
  #trade-table th:first-child,
  #trade-table td:first-child {
    min-width: 80px;
    font-weight: bold;
    background-color: #f8f9fa;
    position: sticky;
    left: 0;
    z-index: 3;
    border-right: 2px solid #ddd;
  }
  
  /* Make sure Symbol header is above other sticky elements */
  #portfolio-table thead th:first-child,
  #macro-table thead th:first-child,
  #countries-table thead th:first-child,
  #g20-table thead th:first-child,
  #crypto-table thead th:first-child,
  #currencies-table thead th:first-child,
  #midday-table thead th:first-child,
  #trade-table thead th:first-child {
    z-index: 4;
  }
  
  /* Portfolio Commentary Mobile */
  .portfolio-commentary {
    margin: 20px 8px;
    padding: 16px;
  }
  
  /* Portfolio Table Mobile Wrapper - same as stockTableWrapper */
  #portfolioTableWrapper,
  #macroTableWrapper,
  #countriesTableWrapper,
  #g20TableWrapper,
  #cryptoTableWrapper,
  #currenciesTableWrapper,
  #middayTableWrapper,
  #tradeTableWrapper {
    max-height: 70vh;
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid #ccc;
    margin: 20px 0;
    -webkit-overflow-scrolling: touch;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    padding: 0;
    box-sizing: border-box;
  }
  
  /* Ensure all page table wrappers start from the very left */
  .portfolio-page #portfolioTableWrapper,
  .macro-page #macroTableWrapper,
  .countries-page #countriesTableWrapper,
  .g20-page #g20TableWrapper,
  .crypto-page #cryptoTableWrapper,
  .currencies-page #currenciesTableWrapper,
  .midday-page #middayTableWrapper,
  .trade-page #tradeTableWrapper {
    padding-left: 0 !important;
    border-left: none;
  }
  
  .commentary-header {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }
  
  .commentary-controls {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  
  .alerts-nav-btn,
  .refresh-btn {
    width: 100%;
    padding: 12px;
    font-size: 0.9rem;
    text-align: center;
  }
  
  #commentaryContent {
    padding: 16px;
    margin-top: 12px;
  }
  
  #commentaryText {
    font-size: 14px;
    line-height: 1.5;
  }
  
  /* Empty Portfolio Message Mobile */
  #empty-portfolio-msg {
    padding: 1.5em;
    margin: 20px 8px;
    text-align: center;
  }
  
  #empty-portfolio-msg p {
    font-size: 0.9rem;
    margin: 10px 0;
  }
}

/* Extra small screens (phones in portrait) */
@media screen and (max-width: 480px) {
  /* Header Extra Small */
  .header-content h1 {
    font-size: 1.6rem;
  }
  
  .header-content p {
    font-size: 0.85rem;
  }
  
  /* Back Button Extra Small */
  .back-to-app-btn {
    top: 10px;
    left: 10px;
    padding: 6px 10px;
    font-size: 0.85rem;
  }
  
  /* Table Extra Small */
  #portfolio-table {
    font-size: 0.75rem;
    min-width: 500px;
  }
  
  /* Commentary Extra Small */
  .portfolio-commentary {
    margin: 15px 6px;
    padding: 12px;
  }
  
  .commentary-header h3 {
    font-size: 1.1rem;
  }
  
  #commentaryContent {
    padding: 12px;
  }
  
  #commentaryText {
    font-size: 13px;
  }
}

/* Portfolio Alert Modal Mobile */
@media screen and (max-width: 768px) {
  .alert-modal-content {
    width: 95%;
    max-width: none;
    margin: 20px;
    border-radius: 12px;
  }
  
  .alert-modal-header {
    padding: 16px;
  }
  
  .alert-modal-header h3 {
    font-size: 1.2rem;
  }
  
  .alert-modal-body {
    padding: 16px;
  }
  
  .alert-form-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .alert-form-group {
    width: 100%;
  }
  
  .alert-modal-footer {
    padding: 16px;
    flex-direction: column;
    gap: 10px;
  }
  
  .alert-btn {
    width: 100%;
    padding: 12px;
    font-size: 0.9rem;
  }
}

/* Portfolio Table Action Buttons Mobile */
@media screen and (max-width: 768px) {
  /* Remove Button Mobile */
  .remove-btn {
    font-size: 14px;
    padding: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #dc3545;
  }
  
  /* Alert Button Mobile */
  .alert-btn {
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid rgba(230, 57, 70, 0.3);
    border-radius: 4px;
    background: transparent;
    color: #E63946;
    cursor: pointer;
    white-space: nowrap;
  }
  
  /* Action Buttons Container Mobile */
  .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    min-width: 70px;
  }
}

/* Touch-friendly improvements for portfolio */
@media (hover: none) and (pointer: coarse) {
  .remove-btn, .alert-btn {
    min-height: 32px;
    min-width: 32px;
    touch-action: manipulation;
  }
  
  /* Improve button feedback */
  .remove-btn:active, .alert-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
}

/* Portfolio Table Action Buttons Mobile */
@media screen and (max-width: 768px) {
  /* Remove Button Mobile */
  .remove-btn {
    font-size: 14px;
    padding: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #dc3545;
  }
  
  /* Alert Button Mobile */
  .alert-btn {
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid rgba(230, 57, 70, 0.3);
    border-radius: 4px;
    background: transparent;
    color: #E63946;
    cursor: pointer;
    white-space: nowrap;
  }
  
  /* Action Buttons Container Mobile */
  .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    min-width: 70px;
  }
}

/* Touch-friendly improvements for portfolio */
@media (hover: none) and (pointer: coarse) {
  .remove-btn, .alert-btn {
    min-height: 32px;
    min-width: 32px;
    touch-action: manipulation;
  }
  
  /* Improve button feedback */
  .remove-btn:active, .alert-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
}
