/* ==========================================================================
   vitti — calculator.css
   Shared styles for every calculator page (home-loan, and future tools).
   Load after base.css, which provides tokens, nav, buttons and footer.
   ========================================================================== */

/* ---------- PAGE HEAD ---------- */
.page-head{ padding:60px 0 32px; }
.page-eyebrow{
  font-family:var(--font-mono);
  font-size:12px;
  letter-spacing:0.14em;
  text-transform:uppercase;
  color:var(--accent);
  display:flex;
  align-items:center;
  gap:9px;
  margin-bottom:16px;
}
.page-eyebrow::before{ content:""; width:14px; height:1px; background:var(--accent); }
.page-head h1{
  font-family:var(--font-display);
  font-weight:600;
  font-size:clamp(30px,3.6vw,44px);
  letter-spacing:-0.02em;
  line-height:1.05;
}
.page-sub{
  margin-top:12px;
  font-size:15.5px;
  line-height:1.6;
  color:var(--text-muted);
  max-width:58ch;
}

/* ---------- LAYOUT ---------- */
.app{ display:flex; flex-direction:column; gap:24px; padding-bottom:24px; }

/* cards */
.form-card, .schedule-section{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  padding:32px 40px;
  box-shadow:var(--shadow);
}
.schedule-section{ display:none; }
.schedule-section.show{ display:block; }

/* ---------- FORM HEAD / ACTIONS ---------- */
.form-top{ display:flex; justify-content:flex-end; align-items:flex-start; margin-bottom:24px; }
.form-actions{ display:flex; align-items:center; gap:12px; position:relative; flex-wrap:wrap; }

.currency-select{
  width:auto;
  padding:9px 14px;
  font-size:14px;
  border:1px solid var(--border-strong);
  border-radius:var(--radius-sm);
  background:var(--bg);
  color:var(--text);
  cursor:pointer;
  outline:none;
  font-family:var(--font-body);
  transition:border-color 0.15s ease, box-shadow 0.15s ease;
}
.currency-select:focus{ border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }

.save-btn{
  display:inline-flex;
  align-items:center;
  font-size:13px;
  font-weight:600;
  padding:9px 18px;
  border-radius:var(--radius-sm);
  background:var(--panel-hover);
  border:1px solid var(--border-strong);
  color:var(--text);
  cursor:pointer;
  transition:border-color 0.15s ease, color 0.15s ease;
}
.save-btn:hover{ border-color:var(--accent); color:var(--accent); }

.save-msg{
  font-size:12px;
  color:var(--live-dot);
  position:absolute;
  right:0;
  top:100%;
  white-space:nowrap;
  opacity:0;
  transition:opacity 0.3s ease;
  pointer-events:none;
}
.save-msg.show{ opacity:1; }

/* ---------- FORM FIELDS ---------- */
.form-fields{ display:grid; gap:16px; grid-template-columns:repeat(5,1fr); margin-bottom:24px; }
@media (max-width:1000px){ .form-fields{ grid-template-columns:1fr 1fr 1fr; } }
@media (max-width:768px){ .form-fields{ grid-template-columns:1fr 1fr; } }
@media (max-width:480px){ .form-fields{ grid-template-columns:1fr; } }

label{ display:block; font-size:13px; font-weight:600; color:var(--text-muted); margin-bottom:8px; }
.opt-label{ font-weight:400; color:var(--text-faint); }

input, select{
  width:100%;
  padding:12px 16px;
  border:1px solid var(--border-strong);
  border-radius:var(--radius-sm);
  font-size:15px;
  font-variant-numeric:tabular-nums;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  transition:border-color 0.15s ease, box-shadow 0.15s ease;
  outline:none;
}
input::placeholder{ color:var(--text-faint); }
input:focus, select:focus{ border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
select{ cursor:pointer; }

.input-suffix{ position:relative; }
.input-suffix input{ padding-right:52px; }
.input-suffix::after{
  content:attr(data-suffix);
  position:absolute;
  right:16px;
  top:50%;
  transform:translateY(-50%);
  color:var(--text-faint);
  font-size:15px;
  font-family:var(--font-mono);
}

/* ---------- EVENTS LAYOUT ---------- */
.events-layout{ display:flex; gap:24px; align-items:flex-start; }
.events-layout .events-col{ flex:1; min-width:0; }
.events-layout .calc-col{ width:300px; flex-shrink:0; }

.section-label{
  font-family:var(--font-mono);
  font-size:11px;
  font-weight:500;
  letter-spacing:0.1em;
  text-transform:uppercase;
  color:var(--text-faint);
  margin-bottom:12px;
}

.event-entry{ display:flex; gap:8px; align-items:center; margin-bottom:8px; flex-wrap:wrap; }
.event-entry select.event-type{ width:140px; padding:8px 10px; font-size:13px; flex-shrink:0; cursor:pointer; }
.event-entry input[type="date"]{ width:150px; padding:8px 10px; font-size:13px; flex-shrink:0; }
.event-entry input[type="number"]{ flex:1; padding:8px 10px; font-size:13px; }
.event-entry .danger{ flex-shrink:0; align-self:flex-start; }

/* ---------- BUTTONS ---------- */
.outline{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:13px;
  font-weight:600;
  padding:9px 16px;
  border-radius:var(--radius-sm);
  background:transparent;
  border:1px dashed var(--border-strong);
  color:var(--text-muted);
  cursor:pointer;
  transition:border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.outline:hover{ border-color:var(--accent); color:var(--accent); background:var(--accent-soft); }

.calc-btn{
  width:100%;
  min-width:200px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:15px;
  font-weight:600;
  padding:14px 22px;
  border-radius:var(--radius-sm);
  background:var(--accent);
  color:#0A0B0D;
  border:none;
  cursor:pointer;
  transition:transform 0.15s ease, filter 0.15s ease;
}
.calc-btn:hover{ transform:translateY(-1px); filter:brightness(1.08); }

.danger{
  background:transparent;
  color:#E0655A;
  padding:6px 12px;
  font-size:17px;
  border:none;
  cursor:pointer;
  border-radius:var(--radius-sm);
  transition:background 0.15s ease;
}
.danger:hover{ background:color-mix(in srgb, #E0655A 12%, transparent); }

#downloadPdf{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  font-weight:600;
  padding:9px 18px;
  border-radius:var(--radius-sm);
  background:var(--panel-hover);
  border:1px solid var(--border-strong);
  color:var(--text);
  cursor:pointer;
  transition:border-color 0.15s ease, color 0.15s ease;
}
#downloadPdf:hover{ border-color:var(--accent); color:var(--accent); }

/* ---------- RESULTS ---------- */
.results{
  padding:18px 20px;
  background:var(--bg);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  opacity:0;
  transition:opacity 0.3s ease;
  margin-top:14px;
}
.results.show{ opacity:1; }
.result-row{ display:flex; justify-content:space-between; align-items:baseline; padding:7px 0; }
.result-label{ color:var(--text-muted); font-size:13px; }
.result-value{ font-weight:700; color:var(--text); font-size:15px; font-variant-numeric:tabular-nums; font-family:var(--font-mono); }
.result-value.highlight{ color:var(--accent); font-size:19px; }
.result-value.result-date{ font-weight:600; color:var(--text-muted); font-size:14px; }

/* ---------- STATUS ---------- */
.error{ color:#E0655A; font-size:13px; margin-top:10px; }
.saved{ color:var(--live-dot); }
.cost{ color:#E0655A; }

/* ---------- SUMMARY BOXES ---------- */
.summary-new{ display:flex; gap:16px; margin-bottom:26px; }
.summary-box{
  flex:1;
  background:var(--bg);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px 22px;
}
.summary-box-title{
  font-family:var(--font-mono);
  font-size:11px;
  font-weight:500;
  letter-spacing:0.1em;
  text-transform:uppercase;
  color:var(--text-muted);
  margin-bottom:12px;
  display:flex;
  align-items:center;
  gap:6px;
}
.summary-box-title .info-icon{
  cursor:help;
  font-size:12px;
  color:var(--text-faint);
  border:1px solid var(--border-strong);
  border-radius:50%;
  width:15px; height:15px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-style:normal;
}
.summary-row{ display:flex; justify-content:space-between; align-items:center; padding:4px 0; }
.summary-label{ font-size:13px; color:var(--text-muted); }
.summary-value{ font-size:14px; font-weight:700; color:var(--text); font-variant-numeric:tabular-nums; }
.summary-total{ border-top:1px solid var(--border); padding-top:10px; margin-top:6px; }
.summary-total .summary-label{ font-weight:600; color:var(--text); }

/* ---------- EVENTS SUMMARY ---------- */
.events-summary{ margin-bottom:22px; }
.events-summary h3{ font-size:16px; font-weight:600; color:var(--text); margin-bottom:10px; }
.events-summary-wrap{ border:1px solid var(--border); border-radius:var(--radius-sm); overflow-x:auto; }
.events-summary-wrap table{ width:100%; border-collapse:collapse; font-size:13px; min-width:720px; }
.events-summary-wrap th{
  background:var(--panel-hover);
  padding:10px 12px;
  text-align:left;
  font-weight:600;
  color:var(--text-muted);
  white-space:nowrap;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:0.06em;
}
.events-summary-wrap td{ padding:9px 12px; border-top:1px solid var(--border); font-variant-numeric:tabular-nums; }
.events-summary-wrap tr:nth-child(even) td{ background:var(--panel-hover); }

/* ---------- SCHEDULE ---------- */
.schedule-header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; gap:12px; flex-wrap:wrap; }
.schedule-header h2{ font-size:20px; font-weight:600; color:var(--text); letter-spacing:-0.01em; }
.schedule-header-actions{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.schedule-header span{ font-size:13px; color:var(--text-muted); }

.schedule-wrap{
  max-height:calc(100vh - 220px);
  overflow-y:auto;
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
}
.schedule-wrap table{ width:100%; border-collapse:collapse; font-size:13px; }
.schedule-wrap th{
  background:var(--panel-hover);
  padding:11px 14px;
  text-align:right;
  font-weight:600;
  color:var(--text-muted);
  position:sticky;
  top:0;
  z-index:1;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:0.06em;
}
.schedule-wrap th:first-child{ text-align:center; }
.schedule-wrap td{
  padding:9px 14px;
  text-align:right;
  border-top:1px solid var(--border);
  font-variant-numeric:tabular-nums;
  color:var(--text);
}
.schedule-wrap td:first-child{ text-align:center; color:var(--text-faint); }
.schedule-wrap td:nth-child(2){ text-align:center; color:var(--text-muted); font-size:12px; }
.schedule-wrap tr.paid td{ background:color-mix(in srgb, var(--live-dot) 8%, transparent) !important; }
.schedule-wrap tr.paid td:nth-child(2){ font-weight:600; color:var(--live-dot); }
.schedule-wrap tr.active td{ background:var(--accent-soft) !important; }
.schedule-wrap tr.active td:nth-child(2){ font-weight:700; color:var(--accent); }
.schedule-wrap tr.prepay td{ background:color-mix(in srgb, var(--accent) 14%, transparent) !important; }
.schedule-wrap tr.prepay td:nth-child(2){ font-weight:600; color:var(--accent); }
.schedule-wrap tr.rate-change td{ background:color-mix(in srgb, #D98B4A 12%, transparent) !important; }
.schedule-wrap tr.rate-change td:nth-child(2){ font-weight:600; color:#D98B4A; }

/* ---------- RESPONSIVE ---------- */
@media (max-width:1000px){
  .events-layout{ flex-direction:column; }
  .events-layout .calc-col{ width:100%; }
}
@media (max-width:768px){
  .page-head{ padding:44px 0 24px; }
  .form-card, .schedule-section{ padding:24px 20px; }
  .form-top{ justify-content:flex-start; }
  .schedule-wrap{ overflow-x:auto; }
  .schedule-wrap table{ min-width:700px; }
  .event-entry input[type="date"]{ width:130px; }
}
@media (max-width:560px){
  .app{ gap:16px; }
  .form-card, .schedule-section{ padding:18px 14px; border-radius:var(--radius); }
  .form-top h1{ font-size:18px; }
  .summary-new{ flex-direction:column; gap:12px; }
  .summary-box{ padding:16px; }
  .schedule-header-actions{ align-items:flex-start; }
  .schedule-header span{ font-size:12px; }
  .calc-btn{ width:100% !important; max-width:none; }
  .event-entry{ gap:6px; }
  .event-entry input[type="date"], .event-entry select.event-type{ width:100%; }
  .events-col .section-label{ margin-bottom:8px; }
  input, select{ font-size:16px; }
}

/* ---------- PRINT ---------- */
@media print{
  :root{
    --bg:#FFFFFF;
    --panel:#FFFFFF;
    --panel-hover:#F6F6F4;
    --border:#E5E5E2;
    --border-strong:#D6D6D2;
    --text:#1A1A1A;
    --text-muted:#555;
    --text-faint:#999;
    --accent:#9C7A3C;
    --accent-soft:rgba(156,122,60,0.10);
    --live-dot:#2C9760;
    --shadow:none;
  }
  body > *:not(.print-only){ display:none !important; }
  .print-only{ display:block !important; position:static !important; padding:20px !important; background:white !important; box-shadow:none !important; border:none !important; }
  .print-only .schedule-wrap{ max-height:none !important; overflow:visible !important; border:none !important; }
  .print-only table{ font-size:10px !important; }
  .print-only .summary-box, .print-only .schedule-wrap table, .print-only .schedule-wrap th{ background:#fff !important; border-color:#ddd !important; }
}