/* ==========================================================================
   XTracker Dashboard - XElite Markets Theme
   Color palette extracted from https://xelitefx.com/
   ========================================================================== */

:root {
  /* Brand */
  --gold: #C9A264;
  --gold-dim: rgba(201, 162, 100, 0.25);
  --gold-hover: #D4B27A;
  --gold-dark: #A8843F;

  /* Backgrounds */
  --bg-body: #131313;
  --bg-section: #0C0C0C;
  --bg-card: #1A1A1A;
  --bg-card-hover: #222222;
  --bg-surface: #161616;
  --bg-input: #1E1E1E;

  /* Text */
  --text-primary: #FFFFFF;
  --text-secondary: #B0B0B0;
  --text-muted: #6C757D;
  --text-gold: #C9A264;

  /* Status */
  --color-critical: #ED0000;
  --color-critical-bg: rgba(237, 0, 0, 0.1);
  --color-warning: #C9A264;
  --color-warning-bg: rgba(201, 162, 100, 0.1);
  --color-info: #00BCFF;
  --color-info-bg: rgba(0, 188, 255, 0.08);
  --color-success: #A2ED00;
  --color-success-bg: rgba(162, 237, 0, 0.1);

  /* Borders */
  --border: #2A2A2A;
  --border-gold: rgba(201, 162, 100, 0.3);

  /* Misc */
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- Reset & Base ---- */

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Scrollbar ---- */

::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dark);
}

/* ==========================================================================
   Header
   ========================================================================== */

.header {
  position: relative;
  background: var(--bg-section);
  border-bottom: 1px solid var(--border);
  padding: 0;
  overflow: hidden;
}

.header-glow {
  position: absolute;
  top: -60%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 200px;
  background: radial-gradient(ellipse, var(--gold-dim), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.header-content {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: var(--bg-body);
  letter-spacing: 1px;
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.meta-value {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition);
}

.status-dot.online {
  background: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.3px;
}

.btn-refresh:hover {
  background: var(--gold);
  color: var(--bg-body);
}

.btn-refresh:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-refresh.spinning svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Main Layout
   ========================================================================== */

.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .two-col {
    grid-template-columns: 1fr;
  }
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   Section Card
   ========================================================================== */

.section {
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.section-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-gold);
  letter-spacing: 0.3px;
}

.section-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.badge {
  background: var(--gold);
  color: var(--bg-body);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  min-width: 28px;
  text-align: center;
}

.empty-state {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.alerts-grid {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 440px;
  overflow-y: auto;
}

.alert-card {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border-left: 3px solid var(--border);
  transition: all var(--transition);
}

.alert-card:hover {
  background: var(--bg-card-hover);
}

.alert-card.critical {
  border-left-color: var(--color-critical);
  background: var(--color-critical-bg);
}

.alert-card.warning {
  border-left-color: var(--color-warning);
  background: var(--color-warning-bg);
}

.alert-card.info {
  border-left-color: var(--color-info);
  background: var(--color-info-bg);
}

.alert-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.alert-card.critical .alert-icon {
  background: rgba(237, 0, 0, 0.2);
  color: var(--color-critical);
}

.alert-card.warning .alert-icon {
  background: rgba(201, 162, 100, 0.2);
  color: var(--color-warning);
}

.alert-card.info .alert-icon {
  background: rgba(0, 188, 255, 0.15);
  color: var(--color-info);
}

.alert-body {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.alert-message {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.5;
}

.alert-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.alert-meta-item {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.alert-days {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.alert-card.critical .alert-days {
  background: rgba(237, 0, 0, 0.2);
  color: var(--color-critical);
}

.alert-card.warning .alert-days {
  background: rgba(201, 162, 100, 0.2);
  color: var(--color-warning);
}

.alert-card.info .alert-days {
  background: rgba(0, 188, 255, 0.15);
  color: var(--color-info);
}

.alert-symbols {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.alert-symbol-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Futures Table
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover td {
  background: var(--bg-card);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.status-badge.active {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.status-badge.close-only-soon {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.status-badge.close-only {
  background: var(--color-critical-bg);
  color: var(--color-critical);
}

.status-badge.expiring-soon {
  background: rgba(237, 150, 0, 0.15);
  color: #ED9600;
}

.status-badge.expired {
  background: rgba(108, 117, 125, 0.2);
  color: var(--text-muted);
}

.futures-symbol {
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Holiday List
   ========================================================================== */

.holiday-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 500px;
  overflow-y: auto;
}

.holiday-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.holiday-item:hover {
  background: var(--bg-card-hover);
}

.holiday-date-badge {
  flex-shrink: 0;
  width: 48px;
  text-align: center;
  padding: 6px 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.holiday-date-day {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.holiday-date-month {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.holiday-info {
  flex: 1;
  min-width: 0;
}

.holiday-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.holiday-country {
  font-size: 11px;
  color: var(--text-muted);
}

.holiday-symbols-count {
  font-size: 11px;
  color: var(--text-gold);
  margin-top: 3px;
}

.holiday-days {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.holiday-days.soon {
  background: var(--color-critical-bg);
  color: var(--color-critical);
}

.holiday-days.upcoming {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.holiday-days.later {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.holiday-expanded-symbols {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.holiday-item.expanded .holiday-expanded-symbols {
  display: flex;
}

/* ==========================================================================
   Symbol Grid
   ========================================================================== */

.symbol-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.filter-btn.active {
  background: var(--gold);
  color: var(--bg-body);
  border-color: var(--gold);
}

.symbol-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 16px 20px;
}

.symbol-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: default;
}

.symbol-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold-dark);
}

.symbol-chip.has-holiday {
  border-color: var(--color-warning);
}

.symbol-chip.has-holiday::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-warning);
  flex-shrink: 0;
}

.symbol-chip.cat-forex { color: var(--text-primary); }
.symbol-chip.cat-exotic { color: #9B8EC4; }
.symbol-chip.cat-metal { color: #E8D44D; }
.symbol-chip.cat-energy { color: #FF8C42; }
.symbol-chip.cat-index { color: #4FC3F7; }
.symbol-chip.cat-futures { color: var(--color-success); }

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 32px 32px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
  html { font-size: 13px; }
  .main { padding: 16px; }
  .header-content { padding: 16px; }
  .symbol-grid { padding: 12px; }
  .alerts-grid { padding: 12px; }
  .footer { padding: 12px 16px 24px; flex-direction: column; gap: 4px; }
}
