:root {
  --bg-dark: #0a0d14;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 36, 56, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.12);
  --accent-red: #ef4444;
  --accent-red-bg: rgba(239, 68, 68, 0.12);

  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;

  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
}

.app-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header */
.main-header {
  position: relative;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
}

.logo-text h1 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-live {
  font-size: 10px;
  background: var(--accent-red);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  animation: pulse 2s infinite;
}

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

.logo-sub {
  font-size: 11px;
  color: var(--accent-green);
  font-weight: 500;
}

/* Search Bar */
.search-container {
  flex: 1;
  max-width: 540px;
  position: relative;
  z-index: 600;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 14px;
  opacity: 0.6;
}

.search-container input {
  width: 100%;
  padding: 10px 36px 10px 40px;
  background: rgba(10, 13, 20, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  transition: all 0.2s ease;
}

.search-container input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--border-focus);
}

.btn-clear {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: #141c2e;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  max-height: 320px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--shadow-card);
}

.search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.search-item:hover {
  background: rgba(99, 102, 241, 0.15);
}

.search-item .sym {
  font-weight: 700;
  color: var(--text-main);
}

.search-item .name {
  font-size: 12px;
  color: var(--text-muted);
}

/* Header Actions */
.header-actions {
  display: flex;
  gap: 8px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

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

.btn-primary:hover {
  background: var(--accent-primary-hover);
}

.btn-primary-sm {
  background: var(--accent-primary);
  border: none;
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Ticker Bar */
.ticker-bar-container {
  background: rgba(14, 19, 31, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  overflow: hidden;
  white-space: nowrap;
}

.ticker-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ticker-bar::-webkit-scrollbar {
  display: none;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.2s;
}

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

.ticker-item .sym {
  font-weight: 700;
}

.ticker-item .val {
  font-weight: 600;
}

.ticker-item .chg {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
}

.chg-up {
  color: var(--accent-green);
  background: var(--accent-green-bg);
}

.chg-down {
  color: var(--accent-red);
  background: var(--accent-red-bg);
}

/* Main Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1280px) {
  .dashboard-grid {
    grid-template-columns: 260px 1fr;
  }
  .right-sidebar {
    grid-column: span 2;
  }
}

@media (max-width: 860px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 100%;
  }
}

/* Sidebar & Panels */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-header h2 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

.watchlist-sidebar {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  min-height: 520px;
}

.watchlist-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.watchlist-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(10, 13, 20, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.watchlist-card:hover, .watchlist-card.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
}

.wl-info .wl-sym {
  font-weight: 700;
  font-size: 14px;
}

.wl-info .wl-name {
  font-size: 11px;
  color: var(--text-muted);
}

.wl-prices {
  text-align: right;
}

.wl-prices .wl-price {
  font-weight: 600;
  font-size: 13px;
}

/* Central Section & Stock Banner */
.main-chart-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stock-header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.stock-title-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.symbol-badge {
  background: var(--accent-primary);
  color: white;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 22px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.stock-info h2 {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-heading);
}

.stock-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stock-price-area {
  text-align: right;
}

.price-display {
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.price-change-badge {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  margin-top: 4px;
}

/* Chart Controls & Container */
.chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeframe-selector, .chart-type-selector {
  display: flex;
  background: rgba(14, 19, 31, 0.8);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.tf-btn, .type-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tf-btn.active, .type-btn.active {
  background: var(--accent-primary);
  color: white;
}

.chart-container-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  height: 400px;
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 350px;
  display: block;
}

.chart-hover-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(10, 13, 20, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

.chart-hover-bar strong {
  color: var(--text-main);
}

.hidden {
  display: none !important;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.metric-value {
  font-size: 14px;
  font-weight: 700;
  margin-top: 3px;
}

/* Right Panels & Portfolio */
.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.portfolio-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: rgba(10, 13, 20, 0.5);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.port-stat .stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

.port-stat .stat-val {
  font-size: 14px;
  font-weight: 700;
}

.portfolio-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.portfolio-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  font-size: 12px;
}

.api-status-badge {
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  color: var(--accent-green);
}

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #121827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 440px;
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.form-group input {
  width: 100%;
  padding: 10px;
  background: rgba(10, 13, 20, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: white;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Responzivní úpravy pro menší obrazovky a mobilní zařízení */
@media (max-width: 768px) {
  .app-container {
    padding: 10px 12px;
    gap: 12px;
  }

  .main-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }

  .search-container {
    max-width: 100%;
  }

  .header-actions {
    justify-content: flex-end;
  }

  .stock-header-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
  }

  .stock-price-area {
    text-align: left;
  }

  .chart-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .timeframe-selector, .chart-type-selector {
    justify-content: center;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

