/* ================================================================
   GLOBAL COMMODITIES FUTURES TERMINAL - MAIN STYLESHEET
   Institutional Trading Terminal Aesthetic
   ================================================================ */

/* === RESET & ROOT === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #0B101B;
  --bg-secondary: #111827;
  --bg-card: #F8FAFC;
  --bg-card-dark: #1E293B;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-dark: #0F172A;
  --text-muted: #64748B;
  --green: #10B981;
  --green-bg: rgba(16, 185, 129, 0.12);
  --green-flash: rgba(16, 185, 129, 0.25);
  --red: #EF4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --red-flash: rgba(239, 68, 68, 0.25);
  --gold: #F59E0B;
  --gold-bg: rgba(245, 158, 11, 0.12);
  --border: #1E293B;
  --border-light: #334155;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-hover: 0 8px 25px rgba(0,0,0,0.4);
  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100dvh;
  padding-top: calc(64px + var(--safe-top));
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* === NAVIGATION === */
.nav-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(11, 16, 27, 0.95);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: var(--safe-top);
  height: calc(64px + var(--safe-top));
}
.nav-inner {
  max-width: 1440px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 64px;
}
.nav-brand { display: flex; align-items: center; gap: 12px; }
.nav-logo { flex-shrink: 0; }
.nav-title { display: flex; flex-direction: column; line-height: 1.2; }
.nav-title-main { font-weight: 700; font-size: 15px; color: var(--text-primary); letter-spacing: -0.02em; }
.nav-title-sub { font-size: 11px; color: var(--gold); font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; }

.nav-center { flex: 1; display: flex; justify-content: center; }
.market-clock {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 8px 20px;
}
.clock-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.clock-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; }
.clock-value { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.clock-divider { width: 1px; height: 28px; background: var(--border-light); }
.market-status { display: flex; align-items: center; gap: 6px; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); display: inline-block;
}
.status-dot.open { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.status-text { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

.nav-right { display: flex; align-items: center; }
.lang-selector { position: relative; }
.lang-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 8px 14px;
  color: var(--text-primary); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all var(--transition-fast);
  font-family: var(--font-sans);
}
.lang-btn:hover { border-color: var(--gold); color: var(--gold); }
.lang-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 6px;
  min-width: 160px; display: none; z-index: 1001;
  box-shadow: var(--shadow-hover);
}
.lang-dropdown.show { display: block; }
.lang-option {
  display: block; width: 100%; text-align: left;
  padding: 8px 14px; border: none; background: none;
  color: var(--text-secondary); font-size: 13px;
  cursor: pointer; border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}
.lang-option:hover { background: var(--bg-card-dark); color: var(--text-primary); }
.lang-option.active { color: var(--gold); font-weight: 600; }

/* === HERO SECTION === */
.hero-section {
  padding: 64px 24px 48px;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  max-width: 1440px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 48px;
}
.hero-content { flex: 1; max-width: 680px; }
.hero-title {
  font-size: clamp(28px, 4vw, 44px); font-weight: 800;
  line-height: 1.15; letter-spacing: -0.03em;
  color: var(--text-primary); margin-bottom: 16px;
}
.hero-desc { font-size: 16px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 32px; max-width: 560px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.cta-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 28px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; text-decoration: none;
  transition: all var(--transition-fast); cursor: pointer;
  font-family: var(--font-sans);
}
.cta-btn {
  background: var(--gold); color: var(--bg-primary);
  border: 1px solid var(--gold);
}
.cta-btn:hover { background: #D97706; box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3); }
.cta-btn-secondary {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.cta-btn-secondary:hover { border-color: var(--gold); color: var(--gold); }

.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; flex-shrink: 0; }
.hero-stat-card {
  background: var(--bg-card-dark); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px;
  display: flex; flex-direction: column; gap: 6px;
  transition: all var(--transition-fast);
}
.hero-stat-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.hero-stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.hero-stat-value { font-size: 28px; font-weight: 700; color: var(--gold); }

/* === GALLERY === */
.gallery-section { padding: 48px 24px; max-width: 1440px; margin: 0 auto; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto auto;
  gap: 16px;
}
.gallery-item {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  aspect-ratio: 16/10; background: var(--bg-card-dark);
}
.gallery-wide { grid-column: span 2; }
.gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s ease;
}
.gallery-item:hover img { transform: scale(1.05); }
.gallery-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(11,16,27,0.85));
  padding: 24px 16px 12px; display: flex; align-items: flex-end;
}
.gallery-overlay span {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* === FILTER SECTION === */
.filter-section {
  padding: 48px 24px 0; max-width: 1440px; margin: 0 auto;
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.section-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.sync-info { display: flex; align-items: center; gap: 8px; }
.sync-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.sync-time { font-size: 13px; color: var(--gold); font-weight: 600; }

.category-tabs {
  display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap;
}
.cat-tab {
  padding: 8px 20px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all var(--transition-fast);
  font-family: var(--font-sans);
}
.cat-tab:hover { border-color: var(--text-muted); color: var(--text-primary); }
.cat-tab.active { background: var(--gold); color: var(--bg-primary); border-color: var(--gold); font-weight: 600; }

/* === MATRIX TABLE === */
.matrix-section { padding: 0 24px 48px; max-width: 1440px; margin: 0 auto; }
.matrix-wrapper {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.matrix-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px; min-width: 800px;
}
.matrix-table thead { background: var(--bg-card-dark); }
.matrix-table th {
  padding: 14px 16px; text-align: left;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.matrix-table td {
  padding: 12px 16px; border-bottom: 1px solid rgba(30,41,59,0.5);
  vertical-align: middle; white-space: nowrap;
}
.matrix-table tbody tr {
  cursor: pointer; transition: background var(--transition-fast);
}
.matrix-table tbody tr:hover { background: rgba(245, 158, 11, 0.04); }
.matrix-table tbody tr.selected { background: rgba(245, 158, 11, 0.08); border-left: 3px solid var(--gold); }

.commodity-cell { display: flex; align-items: center; gap: 10px; }
.commodity-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.commodity-icon.precious { background: var(--gold-bg); }
.commodity-icon.energy { background: var(--red-bg); }
.commodity-icon.industrial { background: rgba(59,130,246,0.12); }
.commodity-icon.agriculture { background: var(--green-bg); }
.commodity-name { font-weight: 600; color: var(--text-primary); font-size: 13px; }
.commodity-exchange { font-size: 11px; color: var(--text-muted); }

.price-cell { font-weight: 600; font-size: 14px; transition: background var(--transition-normal); border-radius: var(--radius-sm); padding: 6px 10px; }
.price-flash-up { background: var(--green-flash); }
.price-flash-down { background: var(--red-flash); }
.change-positive { color: var(--green); font-weight: 600; }
.change-negative { color: var(--red); font-weight: 600; }

/* Signal badges */
.signal-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 10px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; min-width: 80px;
}
.signal-strong-buy { background: rgba(16,185,129,0.15); color: #059669; }
.signal-buy { background: rgba(16,185,129,0.08); color: var(--green); }
.signal-neutral { background: rgba(245,158,11,0.1); color: var(--gold); }
.signal-sell { background: rgba(239,68,68,0.08); color: var(--red); }
.signal-strong-sell { background: rgba(239,68,68,0.15); color: #DC2626; }

/* === ANALYSIS SECTION === */
.analysis-section {
  padding: 48px 24px 64px; max-width: 1440px; margin: 0 auto;
}
.analysis-commodity-name {
  font-size: 16px; font-weight: 600; color: var(--gold);
  background: var(--gold-bg); padding: 6px 16px;
  border-radius: var(--radius-md);
}
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.analysis-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
}
.analysis-card-wide { grid-column: 1 / -1; }
.card-title {
  font-size: 15px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Pivot Points */
.pivot-grid { display: flex; flex-direction: column; gap: 6px; }
.pivot-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-radius: var(--radius-md);
}
.pivot-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; width: 50px; }
.pivot-value { font-size: 15px; font-weight: 600; }
.pivot-resistance { background: var(--red-bg); }
.pivot-resistance .pivot-label { color: var(--red); }
.pivot-resistance .pivot-value { color: var(--red); }
.pivot-support { background: var(--green-bg); }
.pivot-support .pivot-label { color: var(--green); }
.pivot-support .pivot-value { color: var(--green); }
.pivot-center { background: var(--gold-bg); }
.pivot-center .pivot-label { color: var(--gold); }
.pivot-center .pivot-value { color: var(--gold); }

/* Moving Averages */
.ma-grid { display: flex; flex-direction: column; gap: 8px; }
.ma-row {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: var(--bg-card-dark);
  border-radius: var(--radius-md);
}
.ma-label { font-size: 12px; font-weight: 600; color: var(--text-muted); width: 70px; text-transform: uppercase; letter-spacing: 0.04em; }
.ma-value { font-size: 14px; font-weight: 600; color: var(--text-primary); flex: 1; }
.ma-signal {
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: var(--radius-sm); text-transform: uppercase;
}
.ma-signal.buy { background: var(--green-bg); color: var(--green); }
.ma-signal.sell { background: var(--red-bg); color: var(--red); }
.ma-signal.neutral { background: var(--gold-bg); color: var(--gold); }

/* Forecast */
.forecast-content { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.forecast-block h4 {
  font-size: 13px; font-weight: 700; color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.forecast-block p { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }
.forecast-block ul { list-style: none; padding: 0; }
.forecast-block li {
  font-size: 13px; color: var(--text-secondary); line-height: 1.7;
  padding: 4px 0 4px 16px; position: relative;
}
.forecast-block li::before {
  content: ''; position: absolute; left: 0; top: 12px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--gold);
}

/* === FOOTER === */
.site-footer {
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  padding: 48px 24px 32px;
}
.footer-inner { max-width: 1440px; margin: 0 auto; text-align: center; }
.footer-brand { margin-bottom: 24px; }
.footer-logo-text { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.footer-tagline { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.footer-link {
  background: none; border: none; color: var(--text-secondary);
  font-size: 13px; cursor: pointer; transition: color var(--transition-fast);
  text-decoration: underline; text-underline-offset: 3px;
  font-family: var(--font-sans);
}
.footer-link:hover { color: var(--gold); }
.footer-copy { font-size: 12px; color: var(--text-muted); }

/* === MODAL === */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
  padding: 24px; padding-bottom: calc(24px + var(--safe-bottom));
}
.modal-overlay.show { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-container {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-width: 640px; width: 100%; max-height: 80dvh;
  overflow-y: auto; padding: 32px; position: relative;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-card-dark); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 20px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.modal-body h2 { font-size: 20px; font-weight: 700; margin-bottom: 16px; color: var(--text-primary); }
.modal-body h3 { font-size: 16px; font-weight: 600; margin: 20px 0 8px; color: var(--gold); }
.modal-body p, .modal-body li { font-size: 14px; color: var(--text-secondary); line-height: 1.8; }
.modal-body ul { padding-left: 20px; margin: 8px 0; }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .hero-inner { flex-direction: column; text-align: center; }
  .hero-content { max-width: 100%; }
  .hero-desc { max-width: 100%; }
  .hero-actions { justify-content: center; }
  .hero-stats { grid-template-columns: repeat(4, 1fr); width: 100%; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-wide { grid-column: span 1; }
  .analysis-grid { grid-template-columns: 1fr; }
  .forecast-content { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .nav-center { display: none; }
  .nav-inner { padding: 0 16px; }
  .hero-section { padding: 32px 16px; }
  .hero-title { font-size: 24px; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .gallery-section { padding: 24px 16px; }
  .gallery-grid { grid-template-columns: 1fr; }
  .filter-section { padding: 24px 16px 0; }
  .category-tabs { gap: 6px; }
  .cat-tab { padding: 6px 14px; font-size: 12px; }
  .matrix-section { padding: 0 16px 32px; }
  .analysis-section { padding: 32px 16px 48px; }
  .section-title { font-size: 18px; }
}
@media (max-width: 480px) {
  .hero-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hero-stat-card { padding: 14px 16px; }
  .hero-stat-value { font-size: 22px; }
  .matrix-table { font-size: 12px; }
  .matrix-table th, .matrix-table td { padding: 10px 10px; }
  .signal-badge { min-width: 60px; font-size: 10px; padding: 3px 6px; }
}
