/* ========================================
   EODHD Glassmorphism Design System
   Dark/Light Theme Support
   ======================================== */

/* Глобально приклеиваем нативные form-control popups (dropdown <select>) к теме приложения,
   иначе на dark-теме приложения + light-теме ОС выпадающее меню рендерится белым и нечитаемым.
   Тема переключается классом body.light-theme (см. WebShell). */
:root, body { color-scheme: dark; }
body.light-theme { color-scheme: light; }
select, input, textarea { color-scheme: inherit; }
/* Прямая раскраска <option> — на случай если браузер игнорирует color-scheme. */
option { background-color: #1a1a2e; color: #ffffff; }
body.light-theme option { background-color: #ffffff; color: #0f172a; }

/* На больших экранах <select>-триггеры с flex:1 разрастаются, а нативный popup
   наследует ширину триггера и вылетает за viewport. */
select { max-width: 360px; }

/* CSS Variables - Dark Theme (Default) */
:root {
  /* Background Colors */
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #16213e;
  --bg-glass: rgba(26, 26, 46, 0.7);
  --bg-glass-hover: rgba(26, 26, 46, 0.85);

  /* Surface Colors */
  --surface-card: rgba(30, 30, 50, 0.6);
  --surface-card-hover: rgba(40, 40, 65, 0.7);
  --surface-elevated: rgba(45, 45, 70, 0.8);

  /* Border Colors */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(249, 115, 22, 0.4);

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
  --text-disabled: rgba(255, 255, 255, 0.3);

  /* Accent Colors */
  --accent-primary: #f97316;
  --accent-primary-rgb: 249, 115, 22;
  --accent-hover: #ea580c;
  --accent-glow: rgba(249, 115, 22, 0.3);

  /* Status Colors */
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.15);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.15);
  --warning: #eab308;
  --warning-bg: rgba(234, 179, 8, 0.15);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.15);

  /* Category Colors */
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.15);
  --purple: #a855f7;
  --purple-bg: rgba(168, 85, 247, 0.15);
  --cyan: #06b6d4;
  --cyan-bg: rgba(6, 182, 212, 0.15);
  --rose: #f43f5e;
  --rose-bg: rgba(244, 63, 94, 0.15);
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.15);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.2);

  /* Blur */
  --blur-sm: 8px;
  --blur-md: 12px;
  --blur-lg: 20px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Gradients */
  --gradient-bg: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
  --gradient-accent: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
}

/* Light Theme */
[data-theme="light"] {
  /* Background Colors */
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --bg-glass: rgba(255, 255, 255, 0.7);
  --bg-glass-hover: rgba(255, 255, 255, 0.85);

  /* Surface Colors */
  --surface-card: rgba(255, 255, 255, 0.6);
  --surface-card-hover: rgba(255, 255, 255, 0.8);
  --surface-elevated: rgba(255, 255, 255, 0.9);

  /* Border Colors */
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-medium: rgba(0, 0, 0, 0.1);
  --border-accent: rgba(249, 115, 22, 0.5);

  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: rgba(15, 23, 42, 0.7);
  --text-muted: rgba(15, 23, 42, 0.5);
  --text-disabled: rgba(15, 23, 42, 0.3);

  /* Shadows - lighter for light mode */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.15);

  /* Gradient */
  --gradient-bg: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
  --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.4) 100%);
}

/* ========================================
   Base Styles
   ======================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

#root {
  min-height: 100vh;
  width: 100%;
}

/* Main App Container */
.app-container {
  min-height: 100vh !important;
  width: 100% !important;
  background: var(--gradient-bg) !important;
  color: var(--text-primary) !important;
  padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
}

/* ========================================
   Glass Card Component
   ======================================== */

.glass-card {
  background: var(--surface-card);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
}

.glass-card:hover {
  background: var(--surface-card-hover);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-lg);
}

.glass-card-accent:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

/* ========================================
   Header Styles
   ======================================== */

.app-header {
  background: var(--bg-glass) !important;
  backdrop-filter: blur(var(--blur-lg)) !important;
  -webkit-backdrop-filter: blur(var(--blur-lg)) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: all var(--transition-normal);
}

.app-header-content {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-logo {
  width: 44px;
  height: 44px;
  background: var(--gradient-accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.header-btn {
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background: var(--surface-card);
  color: var(--text-primary);
}

.header-btn-accent {
  background: rgba(var(--accent-primary-rgb), 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.3);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
}

.header-btn-accent:hover {
  background: rgba(var(--accent-primary-rgb), 0.25);
}

/* ========================================
   Bottom Navigation
   ======================================== */

.bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  background: var(--bg-glass) !important;
  backdrop-filter: blur(var(--blur-lg)) !important;
  -webkit-backdrop-filter: blur(var(--blur-lg)) !important;
  border-top: 1px solid var(--border-subtle) !important;
  padding: 8px 0 !important;
  padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
  z-index: 50 !important;
}

.bottom-nav-content {
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  color: var(--text-secondary);
}

.nav-item.active {
  color: var(--accent-primary);
}

.nav-item span {
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

/* ========================================
   Dashboard Tabs
   ======================================== */

.tabs-container {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs-container::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  background: var(--surface-card-hover);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--gradient-accent);
  border-color: transparent;
  color: white;
  box-shadow: var(--shadow-glow);
}

.tab-btn-add {
  border-style: dashed;
  color: var(--text-muted);
}

.tab-btn-add:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ========================================
   Asset Cards Grid
   ======================================== */

.assets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 16px;
  margin-bottom: 20px;
}

.asset-card {
  background: var(--surface-card) !important;
  backdrop-filter: blur(var(--blur-sm)) !important;
  -webkit-backdrop-filter: blur(var(--blur-sm)) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-lg) !important;
  padding: 16px !important;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.asset-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-accent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.asset-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.asset-card:hover::before {
  opacity: 1;
}

.asset-symbol {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.asset-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 8px 0 4px;
}

.asset-change {
  font-size: 14px;
  font-weight: 600;
}

.asset-change.positive {
  color: var(--success);
}

.asset-change.negative {
  color: var(--error);
}

.asset-info-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  opacity: 0.5;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.asset-info-btn:hover {
  opacity: 1;
  background: var(--surface-card);
}

/* ========================================
   Quick Actions Grid
   ======================================== */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 16px;
  margin-bottom: 20px;
}

.action-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.action-card.blue {
  background: var(--blue-bg);
  border-color: rgba(59, 130, 246, 0.3);
}

.action-card.blue:hover {
  border-color: var(--blue);
}

.action-card.orange {
  background: rgba(var(--accent-primary-rgb), 0.15);
  border-color: rgba(var(--accent-primary-rgb), 0.3);
}

.action-card.orange:hover {
  border-color: var(--accent-primary);
}

.action-card.purple {
  background: var(--purple-bg);
  border-color: rgba(168, 85, 247, 0.3);
}

.action-card.purple:hover {
  border-color: var(--purple);
}

.action-card.cyan {
  background: var(--cyan-bg);
  border-color: rgba(6, 182, 212, 0.3);
}

.action-card.cyan:hover {
  border-color: var(--cyan);
}

.action-card.green {
  background: var(--green-bg);
  border-color: rgba(34, 197, 94, 0.3);
}

.action-card.green:hover {
  border-color: var(--green);
}

.action-card.rose {
  background: var(--rose-bg);
  border-color: rgba(244, 63, 94, 0.3);
}

.action-card.rose:hover {
  border-color: var(--rose);
}

.action-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
}

.action-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.action-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--gradient-accent);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-secondary {
  background: var(--surface-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--surface-card-hover);
  border-color: var(--border-medium);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--surface-card);
  color: var(--text-primary);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ========================================
   Form Elements
   ======================================== */

.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.15);
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 52px;
  height: 28px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.toggle.active::after {
  transform: translateX(24px);
}

/* ========================================
   Modal / Dialog
   ======================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: fadeIn var(--transition-fast) ease;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp var(--transition-normal) ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  padding: 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--surface-card);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Settings Page
   ======================================== */

.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 16px;
  margin-bottom: 8px;
}

.settings-group {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin: 0 16px;
  overflow: hidden;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item:hover {
  background: var(--surface-card-hover);
}

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-item-icon {
  width: 36px;
  height: 36px;
  background: var(--surface-elevated);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.settings-item-text h4 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-item-text p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========================================
   Status Badges
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-error {
  background: var(--error-bg);
  color: var(--error);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

/* ========================================
   Loading Spinner
   ======================================== */

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ========================================
   Custom Scrollbar
   ======================================== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   Utility Classes
   ======================================== */

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

.bg-glass { background: var(--bg-glass); }
.bg-card { background: var(--surface-card); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Content padding for bottom nav */
.pb-nav {
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* ========================================
   Utility Classes (Tailwind replacements)
   ======================================== */

.flex { display: flex !important; }
.grid { display: grid !important; }
.hidden { display: none !important; }
.block { display: block !important; }
.inline-flex { display: inline-flex !important; }

.flex-col { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.flex-1 { flex: 1 1 0% !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }

.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.items-end { align-items: flex-end !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-around { justify-content: space-around !important; }
.justify-end { justify-content: flex-end !important; }

.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 4px !important; }
.p-2 { padding: 8px !important; }
.p-3 { padding: 12px !important; }
.p-4 { padding: 16px !important; }
.p-6 { padding: 24px !important; }
.px-2 { padding-left: 8px !important; padding-right: 8px !important; }
.px-3 { padding-left: 12px !important; padding-right: 12px !important; }
.px-4 { padding-left: 16px !important; padding-right: 16px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
.py-3 { padding-top: 12px !important; padding-bottom: 12px !important; }
.py-8 { padding-top: 32px !important; padding-bottom: 32px !important; }

.m-0 { margin: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 16px !important; }
.mb-6 { margin-bottom: 24px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 12px !important; }

.w-full { width: 100% !important; }
.w-4 { width: 16px !important; }
.w-5 { width: 20px !important; }
.w-6 { width: 24px !important; }
.w-10 { width: 40px !important; }
.w-12 { width: 48px !important; }
.h-4 { height: 16px !important; }
.h-5 { height: 20px !important; }
.h-6 { height: 24px !important; }
.h-8 { height: 32px !important; }
.h-10 { height: 40px !important; }
.h-12 { height: 48px !important; }

.min-h-screen { min-height: 100vh !important; }
.max-w-md { max-width: 28rem !important; }

.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }

.text-xs { font-size: 12px !important; }
.text-sm { font-size: 14px !important; }
.text-lg { font-size: 18px !important; }
.text-xl { font-size: 20px !important; }
.text-2xl { font-size: 24px !important; }
.text-3xl { font-size: 30px !important; }

.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }

.whitespace-nowrap { white-space: nowrap !important; }
.overflow-auto { overflow: auto !important; }
.overflow-hidden { overflow: hidden !important; }
.overflow-x-auto { overflow-x: auto !important; }

.relative { position: relative !important; }
.absolute { position: absolute !important; }
.fixed { position: fixed !important; }
.sticky { position: sticky !important; }
.inset-0 { top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; }
.top-0 { top: 0 !important; }
.top-1 { top: 4px !important; }
.top-2 { top: 8px !important; }
.right-0 { right: 0 !important; }
.right-1 { right: 4px !important; }
.right-2 { right: 8px !important; }
.bottom-0 { bottom: 0 !important; }
.left-0 { left: 0 !important; }

.z-50 { z-index: 50 !important; }
.z-100 { z-index: 100 !important; }

.cursor-pointer { cursor: pointer !important; }
.select-none { user-select: none !important; }

.opacity-50 { opacity: 0.5 !important; }
.opacity-100 { opacity: 1 !important; }

.transition { transition: all 150ms ease !important; }
.transition-all { transition: all 250ms ease !important; }

.animate-spin {
  animation: spin 1s linear infinite !important;
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr) !important; }

.capitalize { text-transform: capitalize !important; }

/* Section title */
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 16px;
  margin-bottom: 12px;
}

/* ========================================
   Banner Components
   ======================================== */

.banner {
  margin: 0 16px 16px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid;
}

.banner-warning {
  background: var(--warning-bg);
  border-color: rgba(234, 179, 8, 0.3);
}

.banner-info {
  background: var(--info-bg);
  border-color: rgba(59, 130, 246, 0.3);
}

.banner-gradient {
  background: linear-gradient(135deg, var(--purple-bg) 0%, rgba(var(--accent-primary-rgb), 0.15) 100%);
  border-color: rgba(168, 85, 247, 0.3);
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 380px) {
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .assets-grid {
    gap: 8px;
  }

  .asset-card {
    padding: 12px;
  }

  .asset-price {
    font-size: 18px;
  }
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
  .app-header-content {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .bottom-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* Hidden scrollbar utility — scrollable but no visible scrollbar */
.no-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}


/* ========================================
   EODHD Web Terminal Design System
   Bloomberg/Refinitiv-grade theme
   Desktop-first, data-dense layouts
   Supports dark (default) and light themes
   ======================================== */

/* Нативные dropdowns должны соответствовать теме приложения, иначе на dark-теме приложения +
   light-теме ОС выпадающие меню рендерятся белыми/нечитаемыми.
   Тема переключается классом body.light-theme (см. WebShell). */
:root, body { color-scheme: dark; }
body.light-theme { color-scheme: light; }
select, input, textarea { color-scheme: inherit; }
option { background-color: #1E222D; color: #E0E3EB; }
body.light-theme option { background-color: #ffffff; color: #0f172a; }

/* На 4K-разрешениях <select>-триггеры с flex:1 разрастаются на сотни px, а нативный popup
   наследует ширину триггера и вылетает за экран. Глобально режем максимум — отдельные места
   могут переопределять inline-стилем при необходимости. */
select { max-width: 360px; }

/* ═══ Dark Theme (default) ═══ */
:root {
  --bg-primary: #131722;
  --bg-secondary: #1E222D;
  --bg-tertiary: #262B36;
  --bg-glass: #1E222D;
  --bg-glass-hover: #262B36;

  --surface-card: #1E222D;
  --surface-card-hover: #262B36;
  --surface-elevated: #2A2E39;

  --border-subtle: #303640;
  --border-medium: #3A3F4B;
  --border-accent: rgba(0, 123, 255, 0.4);

  --text-primary: #E0E3EB;
  --text-secondary: #9BA2AE;
  --text-muted: #878B93;
  --text-disabled: #555963;

  --accent-primary: #007BFF;
  --accent-primary-rgb: 0, 123, 255;
  --accent-hover: #0069D9;
  --accent-glow: rgba(0, 123, 255, 0.2);

  --success: #21CE99;
  --success-bg: rgba(33, 206, 153, 0.12);
  --error: #F23645;
  --error-bg: rgba(242, 54, 69, 0.12);
  --warning: #F0B90B;
  --warning-bg: rgba(240, 185, 11, 0.12);
  --info: #6A5ACD;
  --info-bg: rgba(106, 90, 205, 0.12);

  --blue: #007BFF;
  --blue-bg: rgba(0, 123, 255, 0.12);
  --purple: #6A5ACD;
  --purple-bg: rgba(106, 90, 205, 0.12);

  --scrollbar-thumb: #303640;
  --scrollbar-hover: #3A3F4B;
  --table-header-bg: #1A1E28;
  --table-row-hover: rgba(38, 43, 54, 0.5);
  --table-border: rgba(48, 54, 64, 0.5);
  --input-bg: #1E222D;
}

/* ═══ Light Theme ═══ */
body.light-theme {
  --bg-primary: #f5f5f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eef0f4;
  --bg-glass: #ffffff;
  --bg-glass-hover: #f0f1f5;

  --surface-card: #ffffff;
  --surface-card-hover: #f7f8fa;
  --surface-elevated: #ffffff;

  --border-subtle: #e2e4e9;
  --border-medium: #d1d5db;
  --border-accent: rgba(0, 123, 255, 0.3);

  --text-primary: #1e1b4b;
  --text-secondary: #374151;
  --text-muted: #4b5563;
  --text-disabled: #6b7280;

  --accent-primary: #007BFF;
  --accent-primary-rgb: 0, 123, 255;
  --accent-hover: #0069D9;
  --accent-glow: rgba(0, 123, 255, 0.1);

  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.08);
  --error: #dc2626;
  --error-bg: rgba(220, 38, 38, 0.08);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.08);
  --info: #6A5ACD;
  --info-bg: rgba(106, 90, 205, 0.08);

  --scrollbar-thumb: #c4c8cf;
  --scrollbar-hover: #a8adb5;
  --table-header-bg: #f0f1f5;
  --table-row-hover: rgba(0, 0, 0, 0.03);
  --table-border: rgba(0, 0, 0, 0.06);
  --input-bg: #ffffff;
}

/* ═══ Web Typography ═══ */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.mono,
[data-type="number"],
td[data-col="price"],
td[data-col="change"],
td[data-col="volume"] {
  font-family: 'Roboto Mono', 'SF Mono', 'Fira Code', monospace;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.02em;
}

/* ═══ Web Layout — No glassmorphism ═══ */
* {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

body, #root {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* Override light theme inline gradients (from Telegram build) */
div[style*="linear-gradient(135deg, #e0e7ff"],
div[style*="linear-gradient(135deg, #f0f0ff"] {
  background: var(--bg-primary) !important;
}

/* Sharp border-radius globally */
div[style*="borderRadius: 16"],
div[style*="borderRadius: 20"],
div[style*="borderRadius: 28"],
div[style*="border-radius: 16px"],
div[style*="border-radius: 20px"],
div[style*="border-radius: 28px"] {
  border-radius: 4px !important;
}

button[style*="borderRadius: 12"],
button[style*="border-radius: 12px"] {
  border-radius: 4px !important;
}

/* ═══ Web Cards ═══ */
.card, [class*="glass"] {
  background: var(--surface-card) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 4px !important;
  box-shadow: none !important;
}

/* ═══ Web Tables ═══ */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table th {
  background: var(--table-header-bg);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  white-space: nowrap;
}

table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--table-border);
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
}

table tr:hover td {
  background: var(--table-row-hover);
}

/* ═══ Web Sidebar ═══ */
.web-sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 220px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
  padding: 16px 0;
  overflow-y: auto;
  z-index: 100;
}

.web-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.web-sidebar-item:hover {
  color: var(--text-primary);
  background: var(--table-row-hover);
}

.web-sidebar-item.active {
  color: var(--text-primary);
  background: var(--accent-glow);
  border-left-color: var(--accent-primary);
}

.web-sidebar-section {
  padding: 16px 20px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-disabled);
}

/* ═══ Web Top Bar ═══ */
.web-topbar {
  position: fixed;
  top: 0; left: 220px; right: 0;
  height: 48px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 99;
}

.web-topbar-search {
  flex: 1;
  max-width: 400px;
  height: 32px;
  background: var(--input-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
}

.web-topbar-search::placeholder {
  color: var(--text-disabled);
}

.web-topbar-search:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* ═══ Web Content Area ═══ */
.web-content {
  margin-left: 220px;
  margin-top: 48px;
  padding: 20px 24px;
  min-height: calc(100vh - 48px);
  position: relative !important;
}

/* ═══ Web Buttons ═══ */
.btn-primary {
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
}

/* ═══ Status Colors ═══ */
.positive { color: var(--success); }
.negative { color: var(--error); }
.neutral { color: var(--text-muted); }

/* ═══ Override mobile fullscreen views ═══ */
.web-content div[style*="inset: 0"]:not(.modal-overlay),
.web-content div[style*="inset:0"]:not(.modal-overlay) {
  position: absolute !important;
}
/* Keep modals fixed and on top */
.modal-overlay {
  position: fixed !important;
}

.web-content > div > div[style*="min-height: 100vh"],
.web-content > div > div[style*="minHeight:"] {
  min-height: auto !important;
  padding-bottom: 0 !important;
}

.web-content div[style*="paddingBottom: 80"],
.web-content div[style*="padding-bottom: 80px"],
.web-content div[style*="paddingBottom: 90"],
.web-content div[style*="padding-bottom: 90px"] {
  padding-bottom: 20px !important;
}

.web-content > div {
  width: 100% !important;
  max-width: 100% !important;
}

.web-content > div > div > div {
  max-width: 100% !important;
}

/* ═══ Hide Telegram-specific elements ═══ */
.telegram-only {
  display: none !important;
}

/* ═══ Utilities ═══ */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ═══ Mobile Responsive (< 768px) ═══ */
@media (max-width: 767px) {
  /* Override sidebar CSS classes */
  .web-sidebar { width: 220px !important; }

  /* Content full width */
  .web-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 12px !important;
  }

  /* Topbar full width */
  .web-topbar {
    left: 0 !important;
    padding: 0 12px !important;
  }

  /* Grids → single column on mobile */
  .web-content div[style*="gridTemplateColumns: repeat(2"],
  .web-content div[style*="grid-template-columns: repeat(2"] {
    grid-template-columns: 1fr !important;
  }

  .web-content div[style*="gridTemplateColumns: repeat(auto-fill"],
  .web-content div[style*="grid-template-columns: repeat(auto-fill"] {
    grid-template-columns: 1fr !important;
  }

  .web-content div[style*="gridTemplateColumns: repeat(3"],
  .web-content div[style*="grid-template-columns: repeat(3"],
  .web-content div[style*="gridTemplateColumns: repeat(4"],
  .web-content div[style*="grid-template-columns: repeat(4"],
  .web-content div[style*="gridTemplateColumns: repeat(5"],
  .web-content div[style*="grid-template-columns: repeat(5"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Flex rows → wrap */
  .web-content div[style*="display: flex"][style*="gap"] {
    flex-wrap: wrap !important;
  }

  /* Tables scroll horizontally */
  .web-content table {
    font-size: 11px !important;
  }

  /* Smaller headings */
  .web-content h1 { font-size: 18px !important; }
  .web-content h2 { font-size: 16px !important; }
  .web-content h3 { font-size: 14px !important; }

  /* Search bar compact */
  .web-topbar-search {
    max-width: none !important;
    font-size: 12px !important;
  }

  /* Hide desktop-only elements */
  .web-content div[style*="paddingBottom: 80"],
  .web-content div[style*="padding-bottom: 80px"] {
    padding-bottom: 12px !important;
  }
}

/* Tablet (768px - 1024px) — iPad portrait/landscape window */
/* Sidebar collapse on tablet is now driven by JS (WebShell isTablet flag), so no CSS
   width override here — the inline style sets the correct 56-px rail. We only force
   layout-grid changes that JS doesn't handle. */
@media (min-width: 768px) and (max-width: 1024px) {
  /* Tighten grids so columns don't overlap */
  .web-content div[style*="gridTemplateColumns: repeat(auto-fill, minmax(280"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .web-content div[style*="gridTemplateColumns: repeat(5"],
  .web-content div[style*="grid-template-columns: repeat(5"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .web-content div[style*="gridTemplateColumns: repeat(4"],
  .web-content div[style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Tables — let the user scroll horizontally instead of squeezing columns */
  .web-content table { font-size: 12px !important; }
  .web-content > div { overflow-x: auto; }

  /* Multi-chart grid: stack charts in 1 column at portrait, 2 at landscape */
  .web-content [class*="multichart"],
  .web-content div[style*="gridTemplateColumns: repeat(2, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
}

/* iPad portrait specifically (768px width) — even tighter */
@media (min-width: 768px) and (max-width: 820px) {
  .web-content { padding: 12px !important; }
}

.text-mono {
  font-family: 'Roboto Mono', monospace;
  font-feature-settings: 'tnum' 1;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══ Light theme overrides for inline dark styles ═══ */
body.light-theme div[style*="linear-gradient(135deg, #0f0f23"],
body.light-theme div[style*="linear-gradient(135deg, #1a1a2e"] {
  background: var(--bg-primary) !important;
}

/* Light theme: fix dark inline backgrounds */
body.light-theme div[style*="background: rgb(26"],
body.light-theme div[style*="background: #1a1a2e"],
body.light-theme div[style*="background: #131722"],
body.light-theme div[style*="background: #1E222D"],
body.light-theme div[style*="background:#1a1a2e"],
body.light-theme div[style*="background:#131722"] {
  background: var(--bg-secondary) !important;
}

/* Light theme: fix rgba(255,255,255,x) inline backgrounds */
body.light-theme div[style*="rgba(255, 255, 255, 0.03)"],
body.light-theme div[style*="rgba(255,255,255,0.03)"] {
  background: rgba(0,0,0,0.015) !important;
}
body.light-theme div[style*="rgba(255, 255, 255, 0.04)"],
body.light-theme div[style*="rgba(255,255,255,0.04)"] {
  background: #fff !important;
}
body.light-theme div[style*="rgba(255, 255, 255, 0.05)"],
body.light-theme div[style*="rgba(255,255,255,0.05)"] {
  background: rgba(0,0,0,0.02) !important;
}
body.light-theme div[style*="rgba(255, 255, 255, 0.06)"],
body.light-theme div[style*="rgba(255,255,255,0.06)"] {
  background: rgba(0,0,0,0.025) !important;
}
body.light-theme div[style*="rgba(255, 255, 255, 0.08)"],
body.light-theme div[style*="rgba(255,255,255,0.08)"] {
  background: rgba(0,0,0,0.035) !important;
}

/* Light theme: fix rgba borders */
body.light-theme div[style*="border-color: rgba(255, 255, 255"],
body.light-theme div[style*="border-color: rgba(255,255,255"] {
  border-color: rgba(0,0,0,0.08) !important;
}

/* Light theme: fix inline white text to dark — catch all formats */
body.light-theme [style*="color: rgb(255, 255, 255)"],
body.light-theme [style*="color: rgb(255,255,255)"],
body.light-theme [style*="color:#fff"],
body.light-theme [style*="color: #fff"],
body.light-theme [style*="color:#ffffff"],
body.light-theme [style*="color: #ffffff"],
body.light-theme [style*="color: white"],
body.light-theme [style*="color:white"] {
  color: var(--text-primary) !important;
}
/* Force all text inside web-content to be dark in light theme (catch inherited white) */
body.light-theme .web-content {
  color: var(--text-primary);
}
body.light-theme .web-content h1,
body.light-theme .web-content h2,
body.light-theme .web-content h3,
body.light-theme .web-content h4,
body.light-theme .web-content p,
body.light-theme .web-content span,
body.light-theme .web-content div,
body.light-theme .web-content label {
  color: inherit;
}
/* Fix SVG icons in light theme — inherit text color */
body.light-theme .web-content svg[stroke="currentColor"] {
  stroke: var(--text-primary);
}

/* Keep white text inside gradient BUTTONS only */
body.light-theme button[style*="gradient"],
body.light-theme a[style*="gradient"] {
  color: white !important;
}

/* Heatmap cells have colored backgrounds regardless of theme — keep text white.
   Higher specificity (with .web-content) so this wins against the blanket
   'color: white' → dark override defined earlier in this file. */
body.light-theme .web-content .heatmap-cell,
body.light-theme .web-content .heatmap-cell *,
body.light-theme .heatmap-cell,
body.light-theme .heatmap-cell * {
  color: #ffffff !important;
}

/* Light theme: fix rgba white text — make all readable */
body.light-theme [style*="color: rgba(255, 255, 255, 0.3)"],
body.light-theme [style*="color: rgba(255,255,255,0.3)"] {
  color: rgba(0,0,0,0.5) !important;
}
body.light-theme [style*="color: rgba(255, 255, 255, 0.4)"],
body.light-theme [style*="color: rgba(255,255,255,0.4)"],
body.light-theme [style*="color: rgba(255, 255, 255, 0.45)"],
body.light-theme [style*="color: rgba(255,255,255,0.45)"] {
  color: rgba(0,0,0,0.65) !important;
}
body.light-theme [style*="color: rgba(255, 255, 255, 0.5)"],
body.light-theme [style*="color: rgba(255,255,255,0.5)"] {
  color: rgba(0,0,0,0.7) !important;
}
body.light-theme [style*="color: rgba(255, 255, 255, 0.6)"],
body.light-theme [style*="color: rgba(255,255,255,0.6)"],
body.light-theme [style*="color: rgba(255, 255, 255, 0.7)"],
body.light-theme [style*="color: rgba(255,255,255,0.7)"] {
  color: rgba(0,0,0,0.75) !important;
}

/* Light theme: fix hardcoded dark text colors */
body.light-theme [style*="color: #E0E3EB"],
body.light-theme [style*="color: #e0e3eb"],
body.light-theme [style*="color: rgb(224, 227, 235)"] {
  color: var(--text-primary) !important;
}
body.light-theme [style*="color: #878B93"],
body.light-theme [style*="color: #878b93"] {
  color: var(--text-muted) !important;
}
body.light-theme [style*="color: #555963"] {
  color: var(--text-disabled) !important;
}

/* Light theme: select/option elements */
body.light-theme select {
  background: #fff !important;
  color: var(--text-primary) !important;
  border-color: var(--border-subtle) !important;
}
body.light-theme select option {
  background: #fff !important;
  color: var(--text-primary) !important;
}

/* Light theme: input elements */
body.light-theme input[style*="background: rgba(255"],
body.light-theme input[style*="background:#1"] {
  background: #fff !important;
  color: var(--text-primary) !important;
  border-color: var(--border-subtle) !important;
}

/* Light theme: table fixes */
body.light-theme table th {
  background: var(--table-header-bg) !important;
  color: var(--text-muted) !important;
  border-bottom-color: var(--border-subtle) !important;
}
body.light-theme table td {
  border-bottom-color: var(--table-border) !important;
}
body.light-theme table tr:hover td {
  background: var(--table-row-hover) !important;
}
