/* =============================================================
   myproperty.now — Tools / Calculators / Compare / Sub-pages
   Loaded after components-ext.css. All classes are .tc-*, .cmp-*, .sub-*
   ============================================================= */

/* ============ Tools page shell ============ */
.tool-page { padding: var(--s-7); max-width: 1440px; margin: 0 auto; }
.tool-header { margin-bottom: var(--s-6); }
.tool-eyebrow { color: var(--accent); font-size: 11px; margin-bottom: 12px; }
.tool-title {
  font-size: 40px; font-weight: 600; letter-spacing: var(--tr-tight);
  margin: 0 0 12px; color: var(--text-hi);
}
.tool-sub { color: var(--text-mid); max-width: 720px; line-height: 1.55; }

.tool-tabs {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3); margin-bottom: var(--s-6);
}
.tool-tab {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s-4) var(--s-5);
  text-align: left; cursor: pointer;
  transition: all var(--dur-2) var(--ease);
  display: flex; flex-direction: column; gap: 4px;
}
.tool-tab:hover { border-color: var(--line-strong); background: var(--bg-elev); }
.tool-tab.is-active {
  border-color: var(--accent); background: var(--accent-wash);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 32px var(--accent-glow);
}
.tool-tab .t {
  font-size: var(--fs-md); font-weight: 600; color: var(--text-hi);
}
.tool-tab.is-active .t { color: var(--accent-hi); }
.tool-tab .d {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: var(--tr-mono); text-transform: uppercase;
  color: var(--text-lo);
}

.tool-body {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: var(--s-6);
}

/* ============ Tools calculator shell ============ */
.tc-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: var(--s-6);
}
@media (max-width: 1024px) { .tc-shell { grid-template-columns: 1fr; } }

.tc-inputs {
  display: flex; flex-direction: column; gap: var(--s-4);
  padding: var(--s-5);
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  align-self: flex-start;
  position: sticky; top: 80px;
}
.tc-inputs h3 {
  font-size: var(--fs-md); font-weight: 600; margin: 0;
  letter-spacing: var(--tr-tight);
}
.tc-inputs-head {
  display: flex; justify-content: space-between; align-items: center;
}
.tc-cur-toggle { display: flex; gap: 2px; background: var(--bg-elev); padding: 3px; border-radius: var(--r-pill); border: 1px solid var(--line); }
.tc-cur {
  background: transparent; border: 0; padding: 4px 10px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: var(--tr-mono);
  color: var(--text-mid); cursor: pointer; border-radius: var(--r-pill);
}
.tc-cur.is-active { background: var(--accent); color: var(--text-on-accent); font-weight: 600; }

/* Slider */
.tc-slider { display: flex; flex-direction: column; gap: 6px; }
.tc-slider-row { display: flex; justify-content: space-between; align-items: baseline; }
.tc-slider label {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: var(--tr-mono); text-transform: uppercase;
  color: var(--text-mid);
}
.tc-slider-val {
  font-size: var(--fs-md); font-weight: 600; color: var(--text-hi);
  font-variant-numeric: tabular-nums;
}
.tc-slider input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; background: var(--bg-elev);
  border-radius: var(--r-pill); outline: none;
  border: 1px solid var(--line);
}
.tc-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg-base);
  box-shadow: 0 0 0 1px var(--accent), 0 0 12px var(--accent-glow);
  cursor: pointer;
}
.tc-slider input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg-base);
  box-shadow: 0 0 0 1px var(--accent); cursor: pointer;
}
.tc-slider-hint {
  font-size: 10px; color: var(--text-faint); letter-spacing: var(--tr-mono); text-transform: uppercase;
}

.tc-presets { display: flex; flex-wrap: wrap; gap: 4px; }
.tc-preset {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 4px 8px;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-mid); cursor: pointer;
  transition: all var(--dur-1) var(--ease);
}
.tc-preset:hover { border-color: var(--accent-line); color: var(--text-hi); }
.tc-preset.is-active { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-hi); }

.tc-banks {
  margin-top: var(--s-3); padding-top: var(--s-4);
  border-top: 1px dashed var(--line);
}
.tc-banks-h { color: var(--text-faint); font-size: 10px; margin-bottom: 8px; }
.tc-banks-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
}
.tc-bank {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 11px; color: var(--text-mid);
  cursor: pointer; transition: all var(--dur-1) var(--ease);
}
.tc-bank:hover { border-color: var(--line-strong); }
.tc-bank.is-active { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-hi); }

/* Outputs */
.tc-outputs { display: flex; flex-direction: column; gap: var(--s-5); min-width: 0; }
.tc-results { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); }
.tc-results-3 { grid-template-columns: repeat(3, 1fr); }
.tc-result {
  background: var(--bg-base); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s-4);
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
}
.tc-result.is-accent { border-color: var(--accent-line); background: var(--accent-wash); }
.tc-result.is-accent::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 60px; height: 60px;
  background: radial-gradient(circle at top right, var(--accent-glow), transparent 70%);
  pointer-events: none;
}
.tc-result-k { font-size: 10px; color: var(--text-lo); letter-spacing: var(--tr-mono); }
.tc-result-v {
  font-size: 24px; font-weight: 600;
  font-family: var(--font-mono); color: var(--text-hi);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tr-tight);
}
.tc-result.is-accent .tc-result-v { color: var(--accent-hi); }
.tc-result-sub { font-size: 11px; color: var(--text-mid); }

/* Chart card */
.tc-chart-card {
  background: var(--bg-base); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s-4);
}
.tc-chart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; }
.tc-chart-legend { display: flex; gap: var(--s-3); font-size: 10px; color: var(--text-mid); }
.tc-chart-legend span { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); letter-spacing: var(--tr-mono); text-transform: uppercase; }
.tc-chart-legend i { width: 10px; height: 2px; border-radius: 1px; display: inline-block; }
.tc-chart-svg { width: 100%; height: 220px; color: var(--text-lo); }
.tc-chart-x {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-faint); letter-spacing: var(--tr-mono);
  margin-top: 4px;
}

/* Schedule */
.tc-schedule { background: var(--bg-base); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-4); overflow: auto; }
.im-table.is-compact td, .im-table.is-compact th { padding: 6px 10px; font-size: 12px; }

/* Affordability */
.tc-affd-headline {
  background: linear-gradient(180deg, var(--accent-wash), transparent);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-lg); padding: var(--s-5);
  text-align: center;
}
.tc-affd-price {
  font-size: 48px; font-weight: 600; color: var(--accent-hi);
  font-variant-numeric: tabular-nums; letter-spacing: var(--tr-tight);
  margin: 8px 0;
}
.tc-affd-note { color: var(--text-mid); font-size: var(--fs-sm); }

/* Closing */
.tc-country-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.tc-country {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 8px 10px;
  cursor: pointer; transition: all var(--dur-1) var(--ease);
}
.tc-country.is-active { background: var(--accent-wash); border-color: var(--accent); }
.tc-country-code { font-size: 14px; font-weight: 600; color: var(--text-hi); }
.tc-country-name { font-size: 11px; color: var(--text-mid); }

.tc-closing-grid { display: grid; grid-template-columns: 240px 1fr; gap: var(--s-5); align-items: start; }
@media (max-width: 900px) { .tc-closing-grid { grid-template-columns: 1fr; } }

.tc-explain {
  background: var(--bg-base); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md); padding: var(--s-4);
  font-size: var(--fs-sm); color: var(--text-mid); line-height: 1.6;
}
.tc-explain p { margin: 0; }

/* ============ Compare Tray (sticky bottom) ============ */
.cmp-tray {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 50;
  background: rgba(11,14,16,.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--accent-line);
  box-shadow: 0 -8px 32px rgba(0,0,0,.5), 0 -1px 0 var(--accent) inset;
  padding: 12px 24px;
  transform: translateY(100%);
  transition: transform var(--dur-3) var(--ease);
}
.cmp-tray.is-open { transform: translateY(0); }
.cmp-tray-inner {
  max-width: 1440px; margin: 0 auto;
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--s-5); align-items: center;
}
.cmp-tray-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: var(--tr-mono); text-transform: uppercase;
  color: var(--accent); display: flex; align-items: center; gap: 6px;
}
.cmp-tray-label::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: cmp-pulse 1.6s ease-in-out infinite; }
@keyframes cmp-pulse { 50% { opacity: .4; } }

.cmp-tray-slots { display: flex; gap: 8px; flex: 1; min-width: 0; }
.cmp-slot {
  flex: 1; min-width: 0;
  height: 56px;
  background: var(--bg-base); border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px; overflow: hidden;
}
.cmp-slot.is-empty { color: var(--text-faint); justify-content: center; font-size: 11px; font-family: var(--font-mono); letter-spacing: var(--tr-mono); text-transform: uppercase; }
.cmp-slot.is-filled { border-style: solid; border-color: var(--accent-line); background: var(--accent-wash); }
.cmp-slot-img {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  background: var(--bg-elev) center/cover;
  flex-shrink: 0;
}
.cmp-slot-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cmp-slot-meta .t { font-size: 12px; font-weight: 600; color: var(--text-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-slot-meta .p { font-family: var(--font-mono); font-size: 10px; color: var(--text-mid); letter-spacing: var(--tr-mono); }
.cmp-slot-x {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--text-mid); display: grid; place-items: center;
  cursor: pointer; flex-shrink: 0;
}
.cmp-slot-x:hover { color: var(--bad); border-color: var(--bad); }

.cmp-tray-actions { display: flex; gap: 8px; align-items: center; }

/* Compare/heart buttons on cards */
.im-card-actions {
  position: absolute; top: 12px; right: 12px;
  display: flex; gap: 4px; z-index: 3;
}
.im-act-btn {
  width: 32px; height: 32px; border-radius: var(--r-pill);
  background: rgba(7,8,10,.7); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text-hi);
  display: grid; place-items: center; cursor: pointer;
  transition: all var(--dur-1) var(--ease);
}
.im-act-btn:hover { background: rgba(7,8,10,.9); }
.im-act-btn.is-on { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }
.im-act-btn svg { width: 14px; height: 14px; }

/* ============ Compare Page ============ */
.cmp-page { padding: var(--s-7); max-width: 1600px; margin: 0 auto; }
.cmp-grid {
  display: grid; gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-xl); overflow: hidden;
}
.cmp-grid > * { background: var(--bg-raised); }
.cmp-row { display: grid; align-items: center; }
.cmp-row.is-header { background: var(--bg-base); }
.cmp-cell { padding: var(--s-4); min-width: 0; }
.cmp-rowlabel {
  background: var(--bg-base);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: var(--tr-mono); text-transform: uppercase;
  color: var(--text-mid);
}
.cmp-card-img {
  aspect-ratio: 16/10; background: var(--bg-elev) center/cover;
  border-radius: var(--r-md); margin-bottom: 12px;
}
.cmp-card-title { font-size: var(--fs-md); font-weight: 600; margin-bottom: 4px; }
.cmp-card-sub { font-size: 11px; color: var(--text-lo); font-family: var(--font-mono); letter-spacing: var(--tr-mono); text-transform: uppercase; }
.cmp-val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-hi); font-weight: 500; }
.cmp-val.is-best { color: var(--ok); position: relative; padding-left: 14px; }
.cmp-val.is-best::before { content: '▲'; position: absolute; left: 0; font-size: 10px; }
.cmp-val.is-worst { color: var(--bad); }

.cmp-empty {
  text-align: center; padding: 80px 20px;
  background: var(--bg-raised); border: 1px dashed var(--line-strong);
  border-radius: var(--r-xl);
}
.cmp-empty-icon { width: 64px; height: 64px; margin: 0 auto 20px; color: var(--text-faint); }

/* ============ Modal / Drawer ============ */
.fd-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(7,8,10,.7); backdrop-filter: blur(4px);
  display: grid; place-items: center;
  animation: fade-in var(--dur-2) var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.fd-modal {
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  width: min(560px, 90vw);
  max-height: 80vh; overflow: auto;
  animation: fd-in .25s var(--ease);
}
@keyframes fd-in { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.fd-modal-head {
  padding: var(--s-5);
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.fd-modal-title { font-size: var(--fs-md); font-weight: 600; }
.fd-modal-body { padding: var(--s-5); }
.fd-modal-foot { padding: var(--s-4) var(--s-5); border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

.fd-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(480px, 92vw);
  background: var(--bg-raised);
  border-left: 1px solid var(--line-strong);
  box-shadow: -16px 0 60px rgba(0,0,0,.5);
  z-index: 91; overflow: auto;
  animation: fd-slide .3s var(--ease);
}
@keyframes fd-slide { from { transform: translateX(100%); } to { transform: none; } }

/* ============ Empty / Loading states ============ */
.fd-empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 80px 20px; text-align: center;
  background: var(--bg-raised); border: 1px dashed var(--line);
  border-radius: var(--r-xl);
}
.fd-empty-icon {
  width: 56px; height: 56px; border-radius: var(--r-lg);
  background: var(--bg-elev); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--text-faint);
}
.fd-empty-icon svg { width: 24px; height: 24px; }
.fd-empty-title { font-size: var(--fs-lg); font-weight: 600; }
.fd-empty-sub { color: var(--text-mid); max-width: 360px; line-height: 1.5; }

.fd-skeleton {
  background: linear-gradient(90deg, var(--bg-elev), var(--bg-raised), var(--bg-elev));
  background-size: 200% 100%;
  animation: fd-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--r-md);
}
@keyframes fd-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.fd-skel-card { display: flex; flex-direction: column; gap: 8px; }
.fd-skel-card .img { height: 200px; }
.fd-skel-card .l1 { height: 16px; width: 70%; }
.fd-skel-card .l2 { height: 12px; width: 40%; }

/* ============ Sub-pages (Saved / Watchlist / Documents / Settings / Notifications) ============ */
.sub-page { padding: var(--s-7); max-width: 1280px; margin: 0 auto; }
.sub-head { margin-bottom: var(--s-6); }
.sub-tabs {
  display: flex; gap: 4px;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 4px; width: fit-content;
  margin-bottom: var(--s-5);
}
.sub-tab {
  background: transparent; border: 0;
  padding: 6px 16px; font-size: var(--fs-sm); color: var(--text-mid);
  border-radius: var(--r-pill); cursor: pointer; font-weight: 500;
}
.sub-tab.is-active { background: var(--accent); color: var(--text-on-accent); font-weight: 600; }

.sub-list {
  display: flex; flex-direction: column;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden;
}
.sub-row {
  display: grid; grid-template-columns: auto 1fr auto auto;
  align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--dur-1) var(--ease);
}
.sub-row:last-child { border-bottom: 0; }
.sub-row:hover { background: var(--bg-elev); }
.sub-row .icn {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--bg-elev); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--accent);
}
.sub-row .icn svg { width: 16px; height: 16px; }
.sub-row .t { font-weight: 600; color: var(--text-hi); }
.sub-row .s { font-size: 12px; color: var(--text-mid); margin-top: 2px; }
.sub-row.is-unread { background: var(--accent-wash); }
.sub-row.is-unread::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 8px var(--accent); flex-shrink: 0;
}

/* Settings */
.set-section {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s-5);
  margin-bottom: var(--s-4);
}
.set-section-h {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.set-row {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line-soft);
}
.set-row:last-child { border-bottom: 0; }
.set-row .label { font-weight: 500; color: var(--text-hi); }
.set-row .hint { font-size: 12px; color: var(--text-mid); margin-top: 2px; }

/* Property-detail tabs */
.dtl-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-5); overflow-x: auto;
}
.dtl-tab {
  padding: 12px 20px;
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-mid); cursor: pointer; font-size: var(--fs-sm);
  font-weight: 500; white-space: nowrap;
  transition: all var(--dur-1) var(--ease);
}
.dtl-tab:hover { color: var(--text-hi); }
.dtl-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.dtl-tab .count {
  margin-left: 6px; background: var(--bg-elev); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 6px; border-radius: var(--r-pill); color: var(--text-mid);
}
.dtl-tab.is-active .count { background: var(--accent-wash); border-color: var(--accent-line); color: var(--accent-hi); }
