@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=Inter:wght@400;500;600&display=swap');

/* Serene Finance - ZenTrade Design Tokens */
:root {
  /* Colors */
  --surface: #f9f9f8;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f3f4f3;
  --surface-container: #edeeed;
  --surface-variant: #e1e3e2;
  
  --on-surface: #191c1c;
  --on-surface-variant: #434845;
  
  --primary: #53625a;
  --on-primary: #ffffff;
  --primary-container: #94a39a;
  --on-primary-container: #2c3933;
  --primary-fixed: #d7e6dc;
  
  --secondary: #4a635d;
  --on-secondary: #ffffff;
  --secondary-container: #cce8e0;
  --on-secondary-container: #05201a;
  
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --on-error-container: #93000a;
  
  --background: #f9f9f8;
  --on-background: #191c1c;

  /* Specific UI Colors from mocks */
  --sidebar-bg: #f9f9f8;
  --sidebar-active-bg: #e2e8e4; /* approximate soft sage */
  --text-muted: #737874;
  --border-color: #e1e3e2;

  --positive-bg: #d7e6dc;
  --positive-text: #2c3933;
  --negative-bg: #ffdad6;
  --negative-text: #93000a;

  /* Typography */
  --font-family: 'Space Grotesk', 'Inter', sans-serif;
  
  /* Radii */
  --radius-sm: 0.25rem;
  --radius-DEFAULT: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Spacing */
  --sidebar-width: 260px;
  --topbar-height: 72px;
  --margin-page: 2rem;
  --gutter: 1.5rem;

  /* Quintic Elements */
  --quintic-radiant: #FFD700;
  --quintic-metal: #A0A0A0;
  --quintic-water: #4FC3F7;
  --quintic-earth: #81C784;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--background);
  color: var(--on-background);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
}

/* Typography Classes */
.text-headline-lg { font-size: 32px; font-weight: 500; line-height: 1.2; letter-spacing: -0.02em; }
.text-headline-md { font-size: 20px; font-weight: 500; line-height: 1.4; }
.text-body-lg { font-size: 16px; font-weight: 400; line-height: 1.6; letter-spacing: 0.01em; }
.text-body-md { font-size: 14px; font-weight: 400; line-height: 1.6; }
.text-label-sm { font-size: 12px; font-weight: 500; line-height: 1.4; letter-spacing: 0.05em; text-transform: uppercase; color: var(--on-surface-variant); }
.text-data-display { font-size: 28px; font-weight: 400; line-height: 1.1; letter-spacing: -0.03em; font-feature-settings: "tnum"; }
.text-muted { color: var(--text-muted); }

/* Layout */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  z-index: 10;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  padding: 0 var(--margin-page);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--background);
  position: sticky;
  top: 0;
  z-index: 5;
}

.page-container {
  padding: var(--margin-page);
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* Sidebar Elements */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--on-surface);
  margin-bottom: 3rem;
}
.logo-icon {
  width: 32px;
  height: 32px;
  background-color: var(--surface-container);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-text {
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}
.logo-sub {
  font-size: 11px;
  color: var(--on-surface-variant);
  font-weight: 400;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.nav-item a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--on-surface-variant);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.nav-item a:hover {
  background-color: var(--surface-container-low);
}
.nav-item a.active {
  background-color: var(--sidebar-active-bg);
  color: var(--on-surface);
}

.sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
}
.btn-primary {
  background-color: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover {
  background-color: #45524b;
}
.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--on-surface);
}
.btn-outline:hover {
  background-color: var(--surface-container-lowest);
  border-color: var(--primary-container);
}
.btn-full {
  width: 100%;
}

/* Topbar Elements */
.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--surface-container-low);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  width: 400px;
  gap: 12px;
}
.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  color: var(--on-surface);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}
.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--on-surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cards */
.card {
  background-color: var(--surface-container-lowest);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 4px 40px rgba(83, 98, 90, 0.03); /* Ambient shadow */
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}
.badge-positive {
  background-color: var(--positive-bg);
  color: var(--positive-text);
}
.badge-negative {
  background-color: var(--negative-bg);
  color: var(--negative-text);
}

/* Utility Grids */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gutter);
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gutter);
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.flex-col {
  display: flex;
  flex-direction: column;
}

/* Page Headers */
.page-header {
  margin-bottom: 2rem;
}
.page-title {
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 4px;
}
.page-subtitle {
  color: var(--on-surface-variant);
  font-size: 14px;
}

/* Specific Components */
.chart-container {
  width: 100%;
  height: 250px;
  margin-top: 2rem;
  position: relative;
}
.chart-tabs {
  display: flex;
  gap: 16px;
  margin-bottom: 1rem;
}
.chart-tabs span {
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-variant);
  cursor: pointer;
}
.chart-tabs span.active {
  color: var(--on-surface);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 4px;
}

/* Sector List */
.sector-list {
  display: flex;
  flex-direction: column;
}
.sector-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--surface-container);
}
.sector-item:last-child {
  border-bottom: none;
}
.sector-name {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.sector-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary-container);
}
