/**
 * HGEM ROI Calculators - Shared Styles
 * Common CSS for all calculator pages
 */

/* ============================================
   CSS Custom Properties (Theme Variables)
   ============================================ */
:root {
  /* Dark mode colors (default) */
  --bg: #4F575C;
  --panel: #556065;
  --stroke: #B6CE35;
  
  --text: #F4F6F7;
  --muted: rgba(244, 246, 247, 0.72);
  --muted2: rgba(244, 246, 247, 0.52);
  --ink: #4F575C;
  
  --radius-xl: 28px;
  --radius-lg: 20px;
}

/* Light mode colors */
body.light-mode {
  --bg: #F4F6F7;
  --panel: #FFFFFF;
  --text: #4F575C;
  --muted: rgba(79, 87, 92, 0.78);
  --muted2: rgba(79, 87, 92, 0.55);
  --ink: #4F575C;
  color: rgba(79, 87, 92, 0.95);
}

/* ============================================
   Base Styles
   ============================================ */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 88px 0 48px;
  font-family: "Open Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ============================================
   Page Wrapper & Layout
   ============================================ */
.page-wrapper {
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 42px 38px;
  background: linear-gradient(180deg, #5a656a 0%, var(--panel) 100%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.10);
  position: relative;
  overflow: hidden;
}

body.light-mode .page-wrapper {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.98) 100%);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Subtle diagonal sheen effect */
.page-wrapper::before {
  content: "";
  position: absolute;
  inset: -40% -30% auto auto;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.12), rgba(255,255,255,0));
  transform: rotate(12deg);
  pointer-events: none;
}

body.light-mode .page-wrapper::before {
  background: radial-gradient(circle at 30% 30%, rgba(0,0,0,0.04), rgba(0,0,0,0));
}

/* ============================================
   Typography
   ============================================ */
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted2);
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
  font-weight: 800;
}

h1 {
  margin: 0 0 10px;
  font-family: "Exo 2", "Open Sans", system-ui, sans-serif;
  font-size: 44px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
  color: var(--text);
  font-weight: 900;
  line-height: 1.05;
}

body.light-mode h1 {
  color: rgba(79, 87, 92, 0.98);
}

.title-rule {
  width: 120px;
  height: 4px;
  background: var(--stroke);
  border-radius: 999px;
  margin: 6px 0 16px;
  position: relative;
  z-index: 1;
}

.subtitle-strong {
  margin: 0 0 14px;
  font-size: 16px;
  color: rgba(182, 206, 53, 0.95);
  font-weight: 600;
  position: relative;
  z-index: 1;
}

body.light-mode .subtitle-strong {
  color: rgba(79, 87, 92, 0.92);
}

.subtitle {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 980px;
  position: relative;
  z-index: 1;
}

/* ============================================
   View Actions (Toggle Buttons)
   ============================================ */
.view-actions {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0;
}

.ghost-btn {
  border: 2px solid rgba(182, 206, 53, 0.65);
  background: rgba(79, 87, 92, 0.75);
  color: rgba(244, 246, 247, 0.92);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  font-family: inherit;
}

body.light-mode .ghost-btn {
  background: rgba(255,255,255,0.85);
  color: rgba(79, 87, 92, 0.92);
  border-color: rgba(182, 206, 53, 0.75);
}

.ghost-btn:hover {
  border-color: rgba(182, 206, 53, 0.95);
  background: rgba(79, 87, 92, 0.90);
  transform: translateY(-1px);
}

body.light-mode .ghost-btn:hover {
  background: rgba(255,255,255,0.98);
}

.ghost-btn.active {
  border-color: rgba(182, 206, 53, 0.95);
  background: rgba(182, 206, 53, 0.18);
}

/* ============================================
   Layout Grid
   ============================================ */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr);
  gap: 26px;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.divider {
  position: relative;
  padding: 22px 22px 20px;
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.10);
  border: 2px solid rgba(182, 206, 53, 0.65);
}

body.light-mode .divider {
  background: rgba(0,0,0,0.03);
  border-color: rgba(182, 206, 53, 0.55);
}

.divider::after {
  content: "";
  position: absolute;
  top: 14px;
  right: -14px;
  width: 1px;
  height: calc(100% - 28px);
  background: rgba(255, 255, 255, 0.14);
}

body.light-mode .divider::after {
  background: rgba(0,0,0,0.10);
}

/* ============================================
   Form Fields
   ============================================ */
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 18px;
  margin-bottom: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field.span-2 {
  grid-column: 1 / -1;
}

.nowrap {
  white-space: nowrap;
}

.field-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: rgba(244, 246, 247, 0.92);
}

body.light-mode .field-label {
  color: rgba(79, 87, 92, 0.92);
}

.field-helper {
  font-size: 11px;
  color: var(--muted);
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  outline: none;
  font-size: 14px;
  color: var(--ink);
  background: rgba(182, 206, 53, 0.95);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  font-family: inherit;
}

body.light-mode .field input {
  background: rgba(255,255,255,0.98);
  border: 2px solid rgba(0, 0, 0, 0.10);
  color: rgba(79, 87, 92, 0.95);
}

.field input:focus {
  border-color: rgba(182, 206, 53, 0.95);
  box-shadow: 0 0 0 3px rgba(182, 206, 53, 0.20);
  background: rgba(182, 206, 53, 1);
}

body.light-mode .field input:focus {
  background: rgba(255,255,255,1);
}

/* ============================================
   Buttons
   ============================================ */
.button-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}

.primary-btn {
  border: none;
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(182, 206, 53, 0.95);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
}

.primary-btn::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(79, 87, 92, 0.92);
}

.error-text {
  font-size: 11px;
  color: rgba(255, 150, 140, 0.95);
  font-weight: 700;
}

body.light-mode .error-text {
  color: rgba(165, 30, 20, 0.95);
}

/* ============================================
   Assumptions & Presets
   ============================================ */
.assumption-section {
  margin-bottom: 16px;
}

.assumption-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  margin-bottom: 10px;
  color: rgba(244, 246, 247, 0.92);
}

body.light-mode .assumption-title {
  color: rgba(79, 87, 92, 0.92);
}

.assumption-helper {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
  max-width: 560px;
  line-height: 1.45;
}

.assumption-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.45;
}

.assumption-note strong {
  color: rgba(244, 246, 247, 0.95);
  font-weight: 800;
}

body.light-mode .assumption-note strong {
  color: rgba(79, 87, 92, 0.95);
}

/* Preset chips */
.preset-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 12px 0 10px;
}

.preset-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: center;
}

.preset-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244, 246, 247, 0.78);
  font-weight: 800;
}

body.light-mode .preset-label {
  color: rgba(79, 87, 92, 0.72);
}

.preset-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.preset-chip {
  border: 2px solid rgba(182, 206, 53, 0.55);
  background: rgba(0, 0, 0, 0.10);
  color: rgba(244, 246, 247, 0.90);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  user-select: none;
}

body.light-mode .preset-chip {
  background: rgba(255,255,255,0.78);
  color: rgba(79, 87, 92, 0.92);
  border-color: rgba(182, 206, 53, 0.55);
}

.preset-chip:hover {
  border-color: rgba(182, 206, 53, 0.95);
  transform: translateY(-1px);
}

.preset-chip.active {
  border-color: rgba(182, 206, 53, 0.95);
  background: rgba(182, 206, 53, 0.18);
}

body.light-mode .preset-chip.active {
  background: rgba(182, 206, 53, 0.16);
}

.preset-chip.custom {
  border-style: dashed;
}

/* ============================================
   Formula Line
   ============================================ */
.formula-line {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

body.light-mode .formula-line {
  border-top: 1px solid rgba(0,0,0,0.10);
  color: var(--muted);
}

.formula-line strong {
  font-weight: 800;
  color: rgba(244, 246, 247, 0.88);
}

body.light-mode .formula-line strong {
  color: rgba(79, 87, 92, 0.88);
}

/* ============================================
   Result Card
   ============================================ */
.result-card {
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  background: rgba(0, 0, 0, 0.10);
  border: 2px solid rgba(182, 206, 53, 0.65);
  color: rgba(244, 246, 247, 0.95);
}

body.light-mode .result-card {
  background: rgba(0,0,0,0.03);
  border-color: rgba(182, 206, 53, 0.55);
  color: rgba(79, 87, 92, 0.95);
}

.result-eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(244, 246, 247, 0.78);
  margin-bottom: 10px;
  font-weight: 800;
}

body.light-mode .result-eyebrow {
  color: rgba(79, 87, 92, 0.70);
}

.result-main {
  background: rgba(182, 206, 53, 0.95);
  border-radius: 14px;
  padding: 14px 16px 12px;
  color: var(--ink);
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  border: 2px solid rgba(255, 255, 255, 0.22);
}

body.light-mode .result-main {
  border: 2px solid rgba(0,0,0,0.08);
}

.result-amount {
  font-size: clamp(40px, 4.6vw, 58px);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1.0;
}

.result-per-year {
  font-size: clamp(13px, 1.5vw, 16px);
  color: rgba(79, 87, 92, 0.78);
  font-weight: 800;
}

.result-helper {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 14px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.result-box {
  border-radius: 14px;
  padding: 12px 12px 11px;
  background: rgba(0, 0, 0, 0.10);
  border: 2px solid rgba(182, 206, 53, 0.55);
}

body.light-mode .result-box {
  background: rgba(255,255,255,0.65);
  border-color: rgba(182, 206, 53, 0.45);
}

.result-box-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: rgba(244, 246, 247, 0.78);
  margin-bottom: 6px;
  font-weight: 800;
}

body.light-mode .result-box-label {
  color: rgba(79, 87, 92, 0.70);
}

.result-box-value {
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 900;
  margin-bottom: 2px;
  color: rgba(244, 246, 247, 0.98);
}

body.light-mode .result-box-value {
  color: rgba(79, 87, 92, 0.95);
}

.result-box-sub {
  font-size: 12px;
  color: rgba(244, 246, 247, 0.70);
  font-weight: 700;
  line-height: 1.35;
}

body.light-mode .result-box-sub {
  color: rgba(79, 87, 92, 0.72);
}

.result-footnote {
  font-size: 11px;
  color: rgba(244, 246, 247, 0.72);
  line-height: 1.55;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

body.light-mode .result-footnote {
  color: rgba(79, 87, 92, 0.75);
  border-top: 1px solid rgba(0,0,0,0.10);
}

.result-footnote strong {
  font-weight: 900;
}

.result-footnote em {
  font-style: normal;
  font-weight: 900;
  color: rgba(244, 246, 247, 0.92);
}

body.light-mode .result-footnote em {
  color: rgba(79, 87, 92, 0.92);
}

/* ============================================
   Client Mode
   ============================================ */
body.client-mode .subtitle,
body.client-mode .field-helper,
body.client-mode .assumption-helper,
body.client-mode .formula-line,
body.client-mode .button-row,
body.client-mode .result-helper,
body.client-mode .result-footnote {
  display: none !important;
}

body.client-mode .assumption-section {
  margin-bottom: 14px;
}

body.client-mode .page-wrapper {
  padding-bottom: 26px;
}

body.client-mode .preset-chip {
  display: none;
  pointer-events: none;
}

body.client-mode .preset-chip.active {
  display: inline-flex;
}

body.client-mode .preset-chip.custom {
  display: none !important;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1020px) {
  body {
    padding: 28px 0;
  }
  
  .page-wrapper {
    padding: 22px 18px 26px;
  }
  
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  
  .divider::after {
    display: none;
  }
  
  .view-actions {
    top: 14px;
    right: 14px;
  }
  
  .preset-item {
    grid-template-columns: 1fr;
  }
  
  .field-grid {
    grid-template-columns: 1fr;
  }
  
  .result-grid {
    grid-template-columns: 1fr;
  }
  
  h1 {
    font-size: 36px;
  }
}
