/*
 * CoastFIRE Calculator — Plugin Stylesheet
 * All rules scoped under .coastfire-plugin-wrap to avoid theme conflicts
 * Version: 1.0.0
 */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

.coastfire-plugin-wrap {
    all: initial;
    font-family: 'Inter', sans-serif;
    display: block;
    box-sizing: border-box;
}
.coastfire-plugin-wrap *,
.coastfire-plugin-wrap *::before,
.coastfire-plugin-wrap *::after {
    box-sizing: border-box;
}

/* ───────────────────────────── TOKENS ───────────────────────────── */
:root {
  --bg:           #f4f6f9;
  --bg2:          #eef0f5;
  --white:        #ffffff;
  --border:       #e3e7ef;
  --border-soft:  #edf0f5;
  --text:         #0d1117;
  --text-2:       #44515f;
  --text-3:       #8b95a6;
  --accent:       #1a6ef5;
  --accent-dark:  #1058d4;
  --accent-light: #e8f0ff;
  --accent-glow:  rgba(26,110,245,0.18);
  --green:        #0ab977;
  --green-light:  #e8fbf3;
  --green-border: rgba(10,185,119,0.3);
  --red:          #ef4444;
  --red-light:    #fff1f1;
  --red-border:   rgba(239,68,68,0.25);
  --amber:        #f59e0b;
  --amber-light:  #fffbeb;
  --amber-border: rgba(245,158,11,0.3);
  --purple:       #8b5cf6;
  --teal:         #0ea5e9;
  --shadow-xs:    0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:       0 4px 18px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg:    0 8px 36px rgba(0,0,0,0.09), 0 2px 8px rgba(0,0,0,0.05);
  --shadow-blue:  0 4px 18px rgba(26,110,245,0.3);
  --radius-lg:    16px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-xs:    6px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 40% at 15% -5%, rgba(26,110,245,0.055) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 85% 100%, rgba(14,165,233,0.045) 0%, transparent 55%);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  animation: fadeIn .4s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

/* ───────────────────────────── NAV ───────────────────────────────── */
nav {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
  padding: 0 36px; height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0,0,0,0.04);
}
.logo { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(140deg, #2c7ff5 0%, #1a55cc 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(26,110,245,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
  flex-shrink: 0;
  transition: transform .2s, box-shadow .2s;
}
.logo:hover .logo-mark { transform: scale(1.05); box-shadow: 0 4px 16px rgba(26,110,245,0.45); }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-name { font-weight: 700; font-size: 15px; letter-spacing: -0.03em; color: var(--text); }
.logo-sub  { font-size: 10px; color: var(--text-3); letter-spacing: 0.04em; margin-top: 3px; text-transform: uppercase; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-pill {
  background: var(--accent-light); color: var(--accent);
  font-size: 11px; font-weight: 600; padding: 5px 12px;
  border-radius: 100px; letter-spacing: 0.02em;
  border: 1px solid rgba(26,110,245,0.15);
}

/* ───────────────────────────── HERO ───────────────────────────────── */
.hero {
  text-align: center;
  padding: 56px 24px 40px;
  position: relative;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 100px; padding: 5px 16px 5px 11px;
  font-size: 11.5px; font-weight: 500; color: var(--text-2);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.live-dot {
  width: 7px; height: 7px; background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(10,185,119,0.4);
  animation: livePulse 2.2s ease infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0   rgba(10,185,119,0.4); }
  60%  { box-shadow: 0 0 0 6px rgba(10,185,119,0); }
  100% { box-shadow: 0 0 0 0   rgba(10,185,119,0); }
}
h1 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(2.1rem, 4.5vw, 3.2rem);
  font-weight: 400; letter-spacing: -0.03em; line-height: 1.07;
  color: var(--text);
}
h1 em { font-style: italic; color: var(--accent); }
.hero-sub {
  margin-top: 14px; color: var(--text-2);
  font-size: 15px; font-weight: 400; line-height: 1.6;
  max-width: 460px; margin-left: auto; margin-right: auto;
}
.hero-stats {
  display: inline-flex; align-items: center; gap: 20px;
  margin-top: 28px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 100px; padding: 10px 24px;
  box-shadow: var(--shadow-sm);
}
.hero-stat { text-align: center; }
.hero-stat-val { font-family: 'Instrument Serif', serif; font-size: 18px; font-weight: 400; letter-spacing: -0.02em; color: var(--text); }
.hero-stat-lbl { font-size: 10px; color: var(--text-3); letter-spacing: 0.05em; text-transform: uppercase; margin-top: 1px; }
.hero-sep { width: 1px; height: 28px; background: var(--border); }

/* ───────────────────────────── LAYOUT ──────────────────────────────── */
.dashboard {
  max-width: 1200px; margin: 0 auto;
  padding: 0 28px 100px;
  display: grid; grid-template-columns: 400px 1fr;
  gap: 22px; align-items: start;
}
@media (max-width: 960px) { .dashboard { grid-template-columns: 1fr; } }

/* ───────────────────────────── CARDS ───────────────────────────────── */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}
.card-header {
  padding: 20px 24px 0;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.card-title {
  font-size: 13px; font-weight: 600;
  letter-spacing: -0.01em; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.card-title-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dot-blue   { background: var(--accent); }
.dot-green  { background: var(--green); }
.card-badge {
  font-size: 10.5px; font-weight: 600; padding: 3px 9px;
  border-radius: 100px; letter-spacing: 0.02em;
}
.badge-blue   { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(26,110,245,0.15); }
.badge-green  { background: var(--green-light);  color: #0a8055;       border: 1px solid var(--green-border); }
.card-body { padding: 0 24px 24px; }

/* ───────────────────────────── COUNTRY DROPDOWN ──────────────────── */
.country-wrap { position: relative; margin-bottom: 18px; }
.field-label {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 7px;
  display: flex; align-items: center; justify-content: space-between;
}
.field-label-note {
  font-size: 10px; color: var(--text-3); font-weight: 400;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 7px; text-transform: none; letter-spacing: 0;
}
.cs-trigger {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 13px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
  user-select: none;
}
.cs-trigger:hover { background: white; border-color: #c8cfe0; }
.cs-trigger.open  {
  border-color: var(--accent); background: white;
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.cs-trigger-flag { font-size: 19px; line-height: 1; flex-shrink: 0; }
.cs-trigger-name { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); text-align: left; }
.cs-trigger-code {
  font-size: 11px; color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 4px;
}
.cs-trigger-arrow {
  color: var(--text-3); flex-shrink: 0;
  transition: transform .2s;
}
.cs-trigger-arrow svg { display: block; }
.cs-trigger.open .cs-trigger-arrow { transform: rotate(180deg); }

/* Panel */
.cs-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 999;
  background: white; border: 1.5px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,0.13), 0 2px 8px rgba(0,0,0,0.06);
  display: none; flex-direction: column; overflow: hidden;
  transform-origin: top center;
  animation: dropIn .15s ease;
}
@keyframes dropIn { from { opacity:0; transform:scaleY(0.94) translateY(-4px); } to { opacity:1; transform:none; } }
.cs-dropdown.open { display: flex; }

.cs-search-wrap {
  padding: 10px 10px 9px; border-bottom: 1px solid var(--border-soft);
  position: relative; flex-shrink: 0; background: var(--bg);
}
.cs-search-icon {
  position: absolute; left: 19px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}
.cs-search-icon svg { display: block; }
.cs-search {
  width: 100%; background: white; border: 1.5px solid var(--border);
  border-radius: var(--radius-xs); padding: 8px 10px 8px 32px;
  font-family: 'Inter', sans-serif; font-size: 13px; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.cs-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.cs-search::placeholder { color: var(--text-3); }

.cs-list {
  overflow-y: auto; max-height: 248px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.cs-list::-webkit-scrollbar { width: 3px; }
.cs-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.cs-group-label {
  padding: 7px 13px 5px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-3);
  background: var(--bg); border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; z-index: 1;
}
.cs-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 13px; cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid transparent;
}
.cs-option:last-child { border-bottom: none; }
.cs-option:hover    { background: var(--accent-light); }
.cs-option.selected { background: var(--accent-light); }
.cs-option.focused  { background: var(--accent-light); outline: none; }
.cs-opt-flag { font-size: 16px; line-height: 1; flex-shrink: 0; }
.cs-opt-name { flex: 1; font-size: 13px; color: var(--text); }
.cs-opt-name mark { background: none; color: var(--accent); font-weight: 600; }
.cs-opt-code {
  font-size: 10.5px; color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 4px;
}
.cs-empty { padding: 26px 13px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.cs-empty strong { color: var(--text-2); }

/* ───────────────────────────── CHIPS ───────────────────────────────── */
.cost-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 400; color: var(--text-2);
  background: var(--bg); border: 1px solid var(--border);
  white-space: nowrap;
}
.chip strong { font-weight: 600; color: var(--text); }
.chip.chip-blue   { background: var(--accent-light); border-color: rgba(26,110,245,0.18); color: #1a55cc; }
.chip.chip-green  { background: var(--green-light);  border-color: var(--green-border);   color: #0a7a52; }
.chip.chip-amber  { background: var(--amber-light);  border-color: var(--amber-border);   color: #92400e; }
.chip.chip-info   { background: var(--bg); border-color: var(--border); color: var(--text-3); cursor: help; }

/* ───────────────────────────── FORM ───────────────────────────────── */
.form-section { margin-bottom: 4px; }
.form-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--text-3);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.form-section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border-soft);
}
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.f-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: 600; color: var(--text-3);
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: 6px;
}
.f-hint { font-weight: 400; color: var(--text-3); font-size: 10px; text-transform: none; letter-spacing: 0; }
.input-wrap { position: relative; display: flex; align-items: center; }
.prefix, .suffix {
  position: absolute;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--text-3); pointer-events: none; user-select: none; z-index: 1;
}
.prefix { left: 13px; }
.suffix { right: 13px; }
input[type="number"] {
  width: 100%;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 500;
  padding: 10px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type="number"]:focus {
  border-color: var(--accent); background: white;
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.has-prefix input { padding-left: 38px; }
.has-suffix input { padding-right: 32px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.divider {
  border: none; border-top: 1px solid var(--border-soft);
  margin: 18px 0;
}

/* Calculate button */
.btn-calc {
  width: 100%; padding: 13px 20px; margin-top: 20px;
  background: linear-gradient(135deg, #2178f7 0%, #1155d4 100%);
  color: white; border: none; border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
  letter-spacing: -0.01em; cursor: pointer;
  transition: all .2s;
  box-shadow: 0 3px 12px rgba(26,110,245,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center; gap: 9px;
  position: relative; overflow: hidden;
}
.btn-calc::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.08), transparent);
  pointer-events: none;
}
.btn-calc:hover {
  background: linear-gradient(135deg, #2c83ff 0%, #1a66e8 100%);
  box-shadow: 0 5px 20px rgba(26,110,245,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
  transform: translateY(-1px);
}
.btn-calc:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(26,110,245,0.3); }

/* ───────────────────────────── RIGHT COL ─────────────────────────── */
.right-col { display: flex; flex-direction: column; gap: 18px; }

/* Placeholder */
.placeholder-card {
  background: var(--white); border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 380px;
  text-align: center; gap: 16px; color: var(--text-3);
  padding: 40px;
}
.placeholder-icon {
  width: 64px; height: 64px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.placeholder-card h3 { font-size: 15px; font-weight: 600; color: var(--text-2); font-family: 'Instrument Serif', serif; }
.placeholder-card p { font-size: 13px; line-height: 1.7; max-width: 260px; color: var(--text-3); }

/* ───────────────────────────── STATUS CARD ─────────────────────────── */
.status-card {
  border-radius: var(--radius-lg); padding: 18px 22px;
  display: flex; align-items: flex-start; gap: 16px;
  opacity: 0; transform: translateY(8px);
  transition: opacity .35s, transform .35s;
  border: 1.5px solid transparent;
  position: relative; overflow: hidden;
}
.status-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; border-radius: 2px 0 0 2px;
}
.status-card.visible { opacity: 1; transform: translateY(0); }
.status-card.success { background: var(--green-light);  border-color: var(--green-border);  }
.status-card.ontrack { background: var(--amber-light);  border-color: var(--amber-border);  }
.status-card.danger  { background: var(--red-light);    border-color: var(--red-border);    }
.status-card.success::before { background: var(--green); }
.status-card.ontrack::before { background: var(--amber); }
.status-card.danger::before  { background: var(--red); }

.status-icon-wrap {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.success .status-icon-wrap { background: rgba(10,185,119,0.12); }
.ontrack .status-icon-wrap { background: rgba(245,158,11,0.12); }
.danger  .status-icon-wrap { background: rgba(239,68,68,0.1); }

.status-body { flex: 1; padding-top: 2px; }
.status-body strong {
  font-size: 14px; font-weight: 700; display: block; margin-bottom: 4px;
}
.success .status-body strong { color: #0a7a52; }
.ontrack .status-body strong { color: #92400e; }
.danger  .status-body strong { color: #be1e1e; }
.status-body span { font-size: 12px; color: var(--text-2); line-height: 1.6; display: block; }

/* ───────────────────────────── METRICS ─────────────────────────────── */
.metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
@media (max-width: 720px) { .metrics { grid-template-columns: repeat(2,1fr); } }

.metric {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  opacity: 0; transform: translateY(10px);
  transition: opacity .32s, transform .32s, box-shadow .18s, border-color .18s;
  cursor: default; position: relative; overflow: hidden;
}
.metric::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; border-radius: 2px 2px 0 0;
  opacity: 0; transition: opacity .2s;
}
.metric:hover { box-shadow: var(--shadow); border-color: #cdd4e4; }
.metric:hover::after { opacity: 1; }
.metric.visible { opacity: 1; transform: translateY(0); }
.metric.visible:hover { transform: translateY(-2px); }

.m-green::after  { background: var(--green); }
.m-amber::after  { background: var(--amber); }
.m-blue::after   { background: var(--accent); }
.m-purple::after { background: var(--purple); }
.m-teal::after   { background: var(--teal); }
.m-slate::after  { background: #94a3b8; }

.metric-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.metric-label {
  font-size: 10px; font-weight: 700; color: var(--text-3);
  letter-spacing: 0.07em; text-transform: uppercase;
}
.metric-icon {
  width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.icon-green  { background: var(--green-light); }
.icon-amber  { background: var(--amber-light); }
.icon-blue   { background: var(--accent-light); }
.icon-purple { background: #f3f0ff; }
.icon-teal   { background: #e0f6ff; }
.icon-slate  { background: #f1f4f8; }

.metric-value {
  font-family: 'Instrument Serif', serif;
  font-size: 22px; font-weight: 400;
  letter-spacing: -0.03em; color: var(--text); line-height: 1;
}
.metric-sub { font-size: 10.5px; color: var(--text-3); margin-top: 6px; font-weight: 400; }

/* ───────────────────────────── CHART ───────────────────────────────── */
.chart-area { position: relative; height: 250px; margin-top: 4px; }

.legend-row {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); }
.legend-line {
  width: 22px; height: 3px; border-radius: 2px; flex-shrink: 0;
}
.legend-dashed { background: repeating-linear-gradient(90deg, var(--amber) 0px, var(--amber) 5px, transparent 5px, transparent 9px); }

.source-note {
  font-size: 10.5px; color: var(--text-3); margin-top: 12px;
  text-align: right; font-style: italic;
}

/* ───────────────────────────── FOOTER ──────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 36px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.footer-logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.footer-logo-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(140deg, #2c7ff5, #1a55cc);
  display: flex; align-items: center; justify-content: center;
}
.footer-logo-name { font-size: 13px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.footer-note { font-size: 11.5px; color: var(--text-3); }