/*
Theme Name: InvestData
Theme URI: https://investor-data.virenial.com/
Author: InvestData Team
Author URI: https://investor-data.virenial.com/
Description: Dashboard investasi real-time Indonesia — saham, emas, kripto, SBN, reksa dana dalam satu tampilan.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: investdata
Tags: investment, finance, dashboard, real-time, indonesia
*/

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

/* =============================================
   CSS CUSTOM PROPERTIES
   ============================================= */
:root {
  --syne: 'Syne', sans-serif;
  --dm: 'DM Sans', sans-serif;

  /* Brand colors */
  --green: #1D9E75;
  --green-light: #E1F5EE;
  --green-mid: #0F6E56;
  --red: #E24B4A;
  --red-light: #FCEBEB;
  --amber: #BA7517;
  --amber-light: #FAEEDA;
  --blue: #185FA5;
  --blue-light: #E6F1FB;
  --purple-light: #EEEDFE;

  /* Semantic - Light Mode */
  --color-text-primary: #0F1523;
  --color-text-secondary: #6B7280;
  --color-background-primary: #FFFFFF;
  --color-background-secondary: #F8F9FA;
  --color-border-tertiary: #E5E7EB;
  --color-border-secondary: #D1D5DB;
  --border-radius-lg: 12px;

  /* Aliases */
  --text: var(--color-text-primary);
  --muted: var(--color-text-secondary);
  --surface: var(--color-background-secondary);
  --card: var(--color-background-primary);
  --border: var(--color-border-tertiary);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --color-text-primary: #F0F2F5;
    --color-text-secondary: #9CA3AF;
    --color-background-primary: #111827;
    --color-background-secondary: #1F2937;
    --color-border-tertiary: #374151;
    --color-border-secondary: #4B5563;
  }
}

/* Dark mode toggle class */
body.dark-mode {
  --color-text-primary: #F0F2F5;
  --color-text-secondary: #9CA3AF;
  --color-background-primary: #111827;
  --color-background-secondary: #1F2937;
  --color-border-tertiary: #374151;
  --color-border-secondary: #4B5563;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--dm);
  background: var(--color-background-secondary);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button { border: none; cursor: pointer; font-family: var(--dm); }
input { font-family: var(--dm); }

/* =============================================
   LAYOUT WRAPPER
   ============================================= */
.site-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  background: var(--card);
  min-height: 100vh;
  box-shadow: 0 0 60px rgba(0,0,0,0.06);
}

/* =============================================
   NAVIGATION
   ============================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 0.5px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  gap: 16px;
}

.logo {
  font-family: var(--syne);
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.logo span { color: var(--green); }
.logo a { color: inherit; }

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
  list-style: none;
}
.nav-links a {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover,
.nav-links .current-menu-item a {
  color: var(--text);
  background: var(--surface);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dark-toggle {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.dark-toggle:hover { background: var(--border); }

.nav-cta {
  font-family: var(--syne);
  font-size: 12px;
  font-weight: 700;
  color: var(--card);
  background: var(--text);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.nav-cta:hover { opacity: 0.85; }

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: 4px;
}
.nav-hamburger span {
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s;
}

/* Mobile menu */
.mobile-menu {
  display: none;
  flex-direction: column;
  border-top: 0.5px solid var(--border);
  padding: 12px 24px;
  gap: 4px;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  font-size: 14px;
  color: var(--muted);
  padding: 8px 0;
  border-bottom: 0.5px solid var(--border);
}
.mobile-menu a:last-child { border-bottom: none; }

/* =============================================
   TICKER TAPE
   ============================================= */
.ticker-wrap {
  overflow: hidden;
  border-top: 0.5px solid var(--border);
  border-bottom: 0.5px solid var(--border);
  padding: 10px 0;
  background: var(--surface);
}

.ticker {
  display: flex;
  gap: 0;
  animation: scroll-ticker 35s linear infinite;
  white-space: nowrap;
  width: max-content;
}
.ticker:hover { animation-play-state: paused; }

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  font-size: 12px;
  font-family: var(--syne);
  border-right: 0.5px solid var(--border);
}
.ticker-item .t-name { color: var(--muted); font-weight: 400; }
.ticker-item .t-val { color: var(--text); font-weight: 700; }
.ticker-item .t-chg { font-size: 11px; font-weight: 500; }
.t-up { color: var(--green); }
.t-down { color: var(--red); }
.t-flat { color: var(--muted); }

@keyframes scroll-ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* =============================================
   LIVE STATUS BADGES
   ============================================= */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-light);
  color: var(--green-mid);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--syne);
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-anim 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-anim {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

.update-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--green-mid);
  background: var(--green-light);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  font-family: var(--syne);
}

/* Data freshness indicator */
.data-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}
.data-status.stale { color: var(--amber); }
.data-status.error { color: var(--red); }

/* =============================================
   SECTION LAYOUT
   ============================================= */
.grid-section {
  padding: 0 24px 32px;
}

.section-label {
  font-family: var(--syne);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: var(--border);
}

/* =============================================
   STAT CARDS ROW (4-col market snapshot)
   ============================================= */
.cards-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: 14px;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  border-color: var(--color-border-secondary);
  transform: translateY(-1px);
}
.stat-card .label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 400;
}
.stat-card .value {
  font-family: var(--syne);
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
  transition: color 0.3s;
}
.stat-card .sub {
  font-size: 11px;
  font-weight: 500;
}
.stat-card.loading .value::after {
  content: '';
  display: inline-block;
  width: 60px;
  height: 16px;
  background: var(--border);
  border-radius: 4px;
  animation: shimmer 1.5s infinite;
  vertical-align: middle;
}

/* Flash animation when data updates */
@keyframes flash-up { 0% { background: rgba(29,158,117,0.15); } 100% { background: transparent; } }
@keyframes flash-down { 0% { background: rgba(226,75,74,0.15); } 100% { background: transparent; } }
.stat-card.flash-up { animation: flash-up 0.8s ease-out; }
.stat-card.flash-down { animation: flash-down 0.8s ease-out; }

@keyframes shimmer {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

/* =============================================
   INSTRUMENT GRID
   ============================================= */
.instr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.instr-card {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.instr-card:hover {
  border-color: var(--color-border-secondary);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.instr-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.instr-info { flex: 1; min-width: 0; }
.instr-name {
  font-family: var(--syne);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.instr-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.risk-bar {
  margin-top: 8px;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
}
.risk-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}
.risk-label {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.instr-return { text-align: right; flex-shrink: 0; }
.instr-return .ret-val {
  font-family: var(--syne);
  font-size: 14px;
  font-weight: 700;
}
.instr-return .ret-label {
  font-size: 10px;
  color: var(--muted);
}

/* =============================================
   MARKET INDEX CARDS (sparkline row)
   ============================================= */
.market-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.market-card {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: 14px;
  transition: border-color 0.15s;
}
.market-card:hover { border-color: var(--color-border-secondary); }
.market-card .m-name { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.market-card .m-val {
  font-family: var(--syne);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.market-card .m-chg { font-size: 12px; font-weight: 500; }
.sparkline { margin-top: 8px; overflow: hidden; }
.sparkline svg { display: block; }

/* =============================================
   CRYPTO MINI TABLE
   ============================================= */
.crypto-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  margin-bottom: 24px;
}
.crypto-table thead th {
  text-align: left;
  padding: 8px 12px;
  font-family: var(--syne);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border-bottom: 0.5px solid var(--border);
}
.crypto-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}
.crypto-table tbody tr:hover { background: var(--surface); }
.crypto-table tbody td {
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text);
}
.crypto-table tbody tr:last-child td { border-bottom: none; }
.crypto-name {
  display: flex;
  align-items: center;
  gap: 8px;
}
.crypto-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* =============================================
   CTA SECTION
   ============================================= */
.cta-section {
  margin: 0 24px 32px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: 28px 24px;
  text-align: center;
}
.cta-section h2 {
  font-family: var(--syne);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.cta-section p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

.email-row {
  display: flex;
  gap: 8px;
  max-width: 320px;
  margin: 0 auto;
}
.email-row input {
  flex: 1;
  font-size: 13px;
  padding: 10px 14px;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.email-row input:focus { border-color: var(--green); }
.email-row input::placeholder { color: var(--muted); }

.btn-primary {
  font-family: var(--syne);
  font-size: 12px;
  font-weight: 700;
  color: var(--card);
  background: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
  border: none;
}
.btn-primary:hover { opacity: 0.85; }

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  padding: 16px 24px;
  border-top: 0.5px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-logo {
  font-family: var(--syne);
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}
.footer-logo span { color: var(--green); }
.footer-note { font-size: 11px; color: var(--muted); }
.footer-links { display: flex; gap: 16px; }
.footer-links a {
  font-size: 11px;
  color: var(--muted);
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--text); }

/* =============================================
   UTILITY
   ============================================= */
.up { color: var(--green) !important; }
.down { color: var(--red) !important; }
.neutral { color: var(--muted) !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border-width: 0;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .nav-cta { display: none; }

  .cards-row { grid-template-columns: repeat(2, 1fr); }
  .instr-grid { grid-template-columns: 1fr; }
  .market-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .cards-row { grid-template-columns: repeat(2, 1fr); }
  .grid-section { padding: 0 16px 24px; }
  .cta-section { margin: 0 16px 24px; }
  .email-row { flex-direction: column; }
  .email-row input, .btn-primary { width: 100%; }
}

/* =============================================
   WIDGET AREA STYLES
   ============================================= */
.widget-area { padding: 0 24px 32px; }
.widget { margin-bottom: 24px; }
.widget-title {
  font-family: var(--syne);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* =============================================
   LOADING SKELETON
   ============================================= */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-load 1.5s infinite;
  border-radius: 4px;
}
@keyframes skeleton-load {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
