/* ============================================
   ATLASSYNC - Luxury Instrument Design System
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Mobile-only labels (paired with .hide-mobile in HTML for swapping text
   between long desktop and short mobile variants — e.g. "TOTAL LOT" / "LOT").
   Hidden by default on desktop; the @media (max-width: 768px) block
   overrides to display:inline. */
.show-mobile { display: none; }

:root {
  --bg-deep: #0A0A0A;
  --bg-primary: #0F1720;
  --bg-panel: #1C2430;
  --gold: #C9A46C;
  --gold-light: #E6C79C;
  --gold-dark: #8A6A3F;
  --gold-10: rgba(201, 164, 108, 0.1);
  --gold-20: rgba(201, 164, 108, 0.2);
  --gold-40: rgba(201, 164, 108, 0.4);
  --text-primary: #EAEAEA;
  --text-muted: #8A8A8A;
  --accent-blue: #4DA3FF;
  --accent-red: rgba(255, 80, 80, 0.8);
  --brushed-light: #f4f4f2;
  --brushed-dark: #e8e8e6;
  --sidebar-width: 240px;
  --header-height: 70px;
}

html {
  scroll-behavior: smooth;
}

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

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.3s;
}

a:hover {
  color: var(--gold-light);
}

/* --- Typography --- */
.font-display {
  font-family: 'Orbitron', sans-serif;
}

h1, h2, h3, h4 {
  font-family: 'Orbitron', sans-serif;
  color: var(--gold-light);
  font-weight: 600;
}

h1 { font-size: 2.2rem; letter-spacing: 3px; }
h2 { font-size: 1.5rem; letter-spacing: 2px; }
h3 { font-size: 1.1rem; letter-spacing: 1.5px; }
h4 { font-size: 0.9rem; letter-spacing: 1px; }

/* --- Layout: Landing (no sidebar) --- */
.layout-landing {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Layout: App (with sidebar) --- */
.layout-app {
  display: flex;
  min-height: 100vh;
}

/* --- Top Navigation (Landing Pages) --- */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gold-20);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 1000;
}

.top-nav .logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  color: var(--gold);
  letter-spacing: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-nav .logo .logo-dot {
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--gold-40);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--gold-40); }
  50% { opacity: 0.5; box-shadow: 0 0 16px var(--gold); }
}

.top-nav .nav-links {
  display: flex;
  gap: 30px;
  align-items: center;
}

.top-nav .nav-links a {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: color 0.3s;
  position: relative;
}

.top-nav .nav-links a:hover,
.top-nav .nav-links a.active {
  color: var(--gold);
}

.top-nav .nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gold);
}

.btn-nav {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 2px;
  padding: 10px 24px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  transition: all 0.3s;
}

.btn-nav:hover {
  background: var(--gold);
  color: var(--bg-deep);
}

/* --- Sidebar (App Pages) --- */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--bg-deep), var(--bg-panel));
  border-right: 1px solid var(--gold-20);
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar .logo-area {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--gold-20);
  margin-bottom: 8px;
}

.sidebar .logo-area h2 {
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 4px;
}

.sidebar .logo-area .logo-sub {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 3px;
  margin-top: 4px;
}

.sidebar nav {
  flex: 1;
  padding: 8px 0;
}

.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s;
  border-left: 2px solid transparent;
  text-decoration: none;
}

.sidebar .nav-item:hover {
  color: var(--gold-light);
  background: var(--gold-10);
}

.sidebar .nav-item.active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: var(--gold-10);
}

.sidebar .nav-item .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
}

.sidebar .sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gold-20);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* --- Main Content (App) --- */
.app-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 30px 40px;
  min-height: 100vh;
}

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

.page-header h1 {
  font-size: 1.4rem;
}

/* --- Cards --- */
.card {
  border: 1px solid var(--gold-20);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.4s;
}

.card:hover {
  border-color: var(--gold-40);
  box-shadow: 0 0 20px rgba(201, 164, 108, 0.15);
}

.card-dark {
  background: radial-gradient(circle at center, var(--bg-panel), var(--bg-deep));
}

.card-brushed {
  background: linear-gradient(180deg, var(--brushed-light), var(--brushed-dark));
  color: #111;
  position: relative;
  overflow: hidden;
}

.card-brushed::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.3), transparent);
  opacity: 0;
  transition: opacity 0.6s;
}

.card-brushed:hover::before {
  opacity: 0.6;
  animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.card-brushed::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(0,0,0,0.03) 0px,
    rgba(0,0,0,0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.4;
  pointer-events: none;
}

.card .card-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  color: var(--gold);
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.card-brushed .card-title {
  color: var(--gold-dark);
}

.card .card-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 2px;
}

.card-brushed .card-value {
  color: #222;
}

/* --- Grid --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* --- Buttons --- */
.btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 2px;
  padding: 12px 28px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-deep);
  border: none;
}

.btn-primary:hover {
  box-shadow: 0 0 20px rgba(201, 164, 108, 0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--gold);
}

.btn-outline:hover {
  background: var(--gold-10);
}

.btn-ghost {
  border: none;
  background: transparent;
  color: var(--gold);
  padding: 8px 16px;
}

/* --- Status Indicators --- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.active {
  background: #4ADE80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.inactive {
  background: var(--accent-red);
}

.status-dot.blink-red {
  background: #ff0000;
  animation: blink-urgent 0.8s ease-in-out infinite;
}

.status-dot.orange {
  background: rgba(255, 180, 60, 0.9);
  box-shadow: 0 0 6px rgba(255, 180, 60, 0.3);
}

@keyframes blink-urgent {
  0%, 100% { opacity: 1; box-shadow: 0 0 12px #ff0000; }
  50% { opacity: 0.2; box-shadow: none; }
}

/* --- Wave Heartbeat Container --- */
.heartbeat-container {
  position: relative;
  height: 60px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.5);
  border: 1px solid var(--gold-20);
}

#heartbeatCanvas {
  width: 100%;
  height: 100%;
}

/* --- Radial Graph Container --- */
.radial-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* --- Hero Section (Landing) --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 40px 80px;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(201, 164, 108, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 50%, rgba(28, 36, 48, 0.8) 0%, transparent 60%),
    var(--bg-primary);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
}

.hero h1 {
  font-size: 3rem;
  letter-spacing: 6px;
  margin-bottom: 20px;
  line-height: 1.3;
}

.hero .hero-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 3px;
  margin-bottom: 40px;
  line-height: 1.8;
}

.hero .hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.hero-wave {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
}

#heroWaveCanvas {
  width: 100%;
  height: 100%;
}

/* --- Sections (Landing) --- */
.section {
  padding: 100px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-header h2 {
  margin-bottom: 16px;
}

.section-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 600px;
  margin: 0 auto;
  letter-spacing: 1px;
}

/* --- Feature Cards (Landing) --- */
.feature-card {
  text-align: center;
  padding: 40px 30px;
}

.feature-card .feature-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  border: 1px solid var(--gold-40);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--gold);
}

.feature-card h3 {
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.8;
}

/* --- Stats Row --- */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 60px;
  padding: 60px 0;
  border-top: 1px solid var(--gold-20);
  border-bottom: 1px solid var(--gold-20);
}

.stat-item {
  text-align: center;
}

.stat-item .stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 2rem;
  color: var(--gold-light);
  letter-spacing: 2px;
}

.stat-item .stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-top: 8px;
  text-transform: uppercase;
}

/* --- Pricing Cards --- */
.pricing-card {
  padding: 40px 30px;
  text-align: center;
  position: relative;
}

.pricing-card.featured {
  border-color: var(--gold);
}

.pricing-card.featured::before {
  content: 'RECOMMENDED';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-deep);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 2px;
  padding: 4px 16px;
  border-radius: 10px;
}

.pricing-card .price {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.4rem;
  color: var(--gold-light);
  margin: 20px 0;
}

.pricing-card .price span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pricing-card ul {
  list-style: none;
  margin: 24px 0;
  text-align: left;
}

.pricing-card ul li {
  padding: 8px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--gold-10);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pricing-card ul li::before {
  content: '\2713';
  color: var(--gold);
  font-weight: bold;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--gold-20);
  padding: 40px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.site-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
}

/* --- Table --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: var(--gold);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gold-40);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gold-10);
  color: var(--text-muted);
}

.data-table tr:hover td {
  color: var(--text-primary);
  background: var(--gold-10);
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: var(--gold);
  display: block;
  margin-bottom: 8px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-deep);
  border: 1px solid var(--gold-20);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: 'Roboto Mono', monospace;
  font-size: 0.85rem;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(201, 164, 108, 0.15);
}

/* --- Divider --- */
.divider {
  height: 1px;
  background: var(--gold-20);
  margin: 30px 0;
}

/* --- Badge --- */
.badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 1.5px;
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-block;
}

.badge-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-deep);
}

.badge-outline {
  border: 1px solid var(--gold-40);
  color: var(--gold);
}

/* --- Utility --- */
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mt-40 { margin-top: 40px; }
.mb-20 { margin-bottom: 20px; }
.mb-40 { margin-bottom: 40px; }
.gap-20 { gap: 20px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .stats-row { flex-direction: column; gap: 20px; padding: 30px 0; }
  html, body { overflow-x: hidden; max-width: 100vw; }

  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    transform: none;
    flex-direction: row;
    padding: 0;
    border-right: none;
    border-top: 1px solid var(--gold-20);
    background: var(--bg-deep);
    z-index: 1000;
  }

  .sidebar .logo-area { display: none; }
  .sidebar .sidebar-footer { display: none; }

  /* Notifications bell + region switcher are injected into the sidebar by
     js/notifications.js and js/region.js. On desktop they sit at the bottom
     of the vertical sidebar; on mobile the sidebar becomes a horizontal
     bottom bar and these block-styled wrappers cover the nav row. Region
     already auto-detects from the logged-in user's account (region.js
     step 3), so the manual dropdown is admin/testing-only and not needed
     on phones. Notifications still poll in the background — the user just
     can't expand the inbox panel on mobile (acceptable v1 trade-off). */
  .sidebar .notif-bell-wrap,
  .sidebar .sidebar-region-switcher,
  .sidebar > .sidebar-region-switcher,
  body > .sidebar-region-switcher,
  body > .notif-bell-wrap { display: none !important; }
  .notif-panel { display: none !important; }

  .sidebar nav {
    display: flex;
    flex-direction: row;
    width: 100%;
    padding: 0;
    justify-content: space-around;
    overflow-x: auto;
  }

  .sidebar .nav-item {
    flex-direction: column;
    gap: 2px;
    padding: 8px 2px 6px;
    /* Hide the inline label text node; ::after below provides a short label.
       Long labels like "Refer a Friend" / "Setup Guide" wrap on phones; we
       replace per-link via attribute selectors so the desktop nav stays
       readable while the phone gets compact one-word equivalents. */
    font-size: 0;
    border-left: none;
    border-top: 2px solid transparent;
    text-align: center;
    min-width: 0;
    flex: 1;
    line-height: 1;
  }

  .sidebar .nav-item.active {
    border-left-color: transparent;
    border-top-color: var(--gold);
  }

  .sidebar .nav-item .nav-icon {
    font-size: 1.05rem;
    width: auto;
    line-height: 1;
  }

  .sidebar .nav-item::after {
    font-family: 'Orbitron', sans-serif;
    /* Sized to fit "Subscription" + "Performance" at 5 items on a 360px
       viewport. If we ever add a 6th visible item, drop to 0.42rem. */
    font-size: 0.46rem;
    letter-spacing: 0.3px;
    line-height: 1;
    margin-top: 4px;
    display: block;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .sidebar .nav-item[href="account.html"]::after      { content: "Dashboard"; }
  .sidebar .nav-item[href="subscription.html"]::after { content: "Subscription"; }
  .sidebar .nav-item[href="performance.html"]::after  { content: "Performance"; }
  .sidebar .nav-item[href="referral.html"]::after     { content: "Refer"; }
  .sidebar .nav-item[href="forum.html"]::after        { content: "Forum"; }

  /* Hide non-essential nav items on mobile (desktop-only flows + History
     which is reachable from the dashboard's CSV export when needed). */
  .sidebar .nav-item[href="about.html"],
  .sidebar .nav-item[href="history.html"],
  .sidebar .nav-item[href="setup.html"] {
    display: none;
  }

  /* iOS safe-area inset so the bottom nav doesn't sit under the home bar. */
  .sidebar { padding-bottom: env(safe-area-inset-bottom); }

  .app-content {
    margin-left: 0;
    padding: 6px 10px;
    padding-bottom: 70px; /* space for bottom nav */
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 16px; padding-bottom: 12px; }
  .page-header h1 { font-size: 1rem; letter-spacing: 2px; }

  .card { padding: 8px; border-radius: 8px; }
  .card .card-value { font-size: 1.3rem; }
  .card .card-title { font-size: 0.6rem; }

  .data-table { font-size: 0.65rem; }
  .data-table th { font-size: 0.5rem; padding: 8px 6px; }
  .data-table td { padding: 8px 6px; }

  .section { padding: 40px 16px; }
  .section-header h2 { font-size: 1.1rem; }

  h1 { font-size: 1.2rem; }
  h2 { font-size: 1rem; }
  h3 { font-size: 0.85rem; }

  .btn { font-size: 0.6rem; padding: 10px 18px; }

  .flex-between { flex-wrap: wrap; gap: 8px; }

  .top-nav .nav-links { gap: 12px; }

  .site-footer { padding: 24px 16px; }
  .site-footer .footer-links { flex-wrap: wrap; gap: 16px; }

  .feature-card { padding: 24px 20px; }

  /* Tables scroll horizontally on small screens */
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }
}
