/* ============================================
   style.css — Cross-Border Investment Analyzer
   Responsive: Mobile (<768) → iPad (<1050) → Desktop (1050+)
   ============================================ */

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

:root {
  --bg: #f6f8fb;
  --s: #ffffff;
  --p: #0f172a;
  --p2: #1e293b;
  --a: #f59e0b;
  --t: #0f172a;
  --ts: #64748b;
  --tt: #94a3b8;
  --b: #e2e8f0;
  --g: #059669;
  --r: #dc2626;
  --bl: #3b82f6;
  --rad: 12px;
}

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--t);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 1660px; margin: 0 auto; padding: 14px; }

/* ====== LANGUAGE BAR ====== */
.lang-bar { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 8px; }
.lang-btn {
  padding: 4px 10px; border: 1px solid var(--b); border-radius: 4px;
  background: var(--s); cursor: pointer; font-size: 10px; font-weight: 500;
  color: var(--ts); transition: all .15s;
}
.lang-btn:hover { color: var(--p); border-color: var(--p); }
.lang-btn.active { background: var(--p); color: #fff; border-color: var(--p); }

/* ====== HEADER ====== */
.header {
  background: linear-gradient(145deg, #0f172a, #1e293b 50%, #0f172a);
  color: #fff; padding: 22px 28px; border-radius: var(--rad);
  margin-bottom: 16px; position: relative; overflow: hidden;
}
.header::after {
  content: ''; position: absolute; top: -60%; right: -5%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(245,158,11,.06), transparent 70%);
}
.header .eyebrow { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--a); margin-bottom: 4px; font-weight: 700; }
.header h1 { font-size: 22px; font-weight: 900; letter-spacing: -.02em; margin-bottom: 3px; }
.header p { font-size: 11px; opacity: .5; }

/* ====== GRID ====== */
.grid { display: grid; grid-template-columns: 360px 1fr; gap: 14px; }

/* ====== CARDS ====== */
.card {
  background: var(--s); border-radius: var(--rad);
  box-shadow: 0 1px 3px rgba(0,0,0,.04); border: 1px solid var(--b);
  margin-bottom: 12px;
}
.card-h {
  padding: 10px 14px; border-bottom: 1px solid var(--b);
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; flex-wrap: wrap;
}
.card-h h2 { font-size: 12px; font-weight: 700; color: var(--p); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.card-h h2 .n {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: 4px; background: var(--p);
  color: #fff; font-size: 9px; padding: 0 4px;
}
.card-b { padding: 10px 14px; }
.card-h .subtitle { font-weight: 400; font-size: 10px; color: var(--ts); }

/* ====== BUTTONS ====== */
.bg { display: flex; gap: 3px; flex-wrap: wrap; }
.bt {
  padding: 6px 9px; border: 1.5px solid var(--b); border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 11px; font-weight: 500;
  transition: all .15s; text-align: center; flex: 1; min-width: 45px; color: var(--t);
}
.bt:hover { border-color: var(--p); }
.bt.active { border-color: var(--p); background: var(--p); color: #fff; }
.bt .sub { display: block; font-size: 9px; opacity: .5; }
.currency-card { border: 2px solid var(--bl); background: linear-gradient(135deg, #eff6ff, #dbeafe); }

.pl { display: flex; flex-direction: column; gap: 3px; }
.pb {
  padding: 6px 9px; border: 1.5px solid var(--b); border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 11px; transition: all .15s;
  display: flex; justify-content: space-between; align-items: center;
}
.pb:hover { border-color: var(--p); }
.pb.active { border-color: var(--p); background: var(--p); color: #fff; }
.pb .pd { font-size: 9px; color: var(--tt); }
.pb.active .pd { color: rgba(255,255,255,.5); }

/* ====== POINT-TO-POINT ====== */
.ptp { margin-bottom: 8px; padding: 3px 0; }
.ptp-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.ptp-l { font-size: 11px; font-weight: 700; color: var(--p); }
.ptp-rw { display: flex; align-items: center; gap: 4px; }
.cval { font-size: 14px; font-weight: 900; color: var(--ts); min-width: 40px; text-align: center; }
.arrow { font-size: 12px; color: var(--tt); }
.tval { font-size: 16px; font-weight: 900; color: var(--p); min-width: 48px; text-align: center; }
.ptp-res { text-align: right; font-size: 9px; color: var(--ts); margin-top: 1px; }

/* ====== SLIDERS ====== */
input[type=range] {
  width: 100%; height: 3.5px; border-radius: 2px; background: #cbd5e1;
  outline: none; -webkit-appearance: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px;
  border-radius: 50%; background: var(--p); cursor: pointer;
}

/* ====== YEAR SLIDER ====== */
.yr-wrap { text-align: center; }
.yr-val { font-size: 26px; font-weight: 900; color: var(--p); margin-bottom: 2px; }
.yr-sub { font-size: 9px; color: var(--ts); margin-bottom: 5px; }

/* ====== USD HERO ====== */
.usd-hero {
  background: linear-gradient(165deg, #0f172a, #1e293b 60%, #312e81);
  border-radius: var(--rad); padding: 16px 20px; color: #fff;
  margin-bottom: 12px; text-align: center; position: relative; overflow: hidden;
}
.usd-hero::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L60 30L30 60L0 30Z' fill='none' stroke='rgba(255,255,255,.02)' stroke-width='1'/%3E%3C/svg%3E") repeat;
  opacity: .5;
}
.usd-hero .hl { font-size: 11px; opacity: .5; margin-bottom: 3px; }
.usd-hero .hv { font-size: 28px; font-weight: 900; letter-spacing: -.03em; margin: 3px 0; }
.usd-hero .hs { font-size: 10px; opacity: .3; margin-bottom: 8px; }
.usd-hero input { width: 75%; max-width: 480px; margin: 0 auto; display: block; }

/* ====== METRICS ====== */
.mr { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 6px; }
.mc {
  background: #f8fafc; border-radius: 7px; padding: 8px 10px;
  text-align: center; border: 1px solid var(--b);
}
.mc .ml { font-size: 9px; color: var(--ts); margin-bottom: 2px; font-weight: 600; text-transform: uppercase; }
.mc .mv { font-size: 16px; font-weight: 900; letter-spacing: -.03em; }
.mc .ms { font-size: 8px; color: var(--tt); margin-top: 1px; }
.up { color: var(--r); } .down { color: var(--g); }

/* ====== TAGS ====== */
.ccy-tag { display: inline-block; background: var(--bl); color: #fff; padding: 1px 5px; border-radius: 3px; font-size: 8px; font-weight: 700; margin-left: 3px; }
.ccy-indicator { font-size: 10px; color: var(--bl); font-weight: 700; background: #eff6ff; padding: 2px 6px; border-radius: 4px; }
.badge { display: inline-block; padding: 1px 4px; border-radius: 3px; font-size: 8px; font-weight: 600; }
.b-blue { background: #dbeafe; color: #1d4ed8; }
.b-green { background: #d1fae5; color: #065f46; }
.b-amber { background: #fef3c7; color: #92400e; }
.b-purple { background: #ede9fe; color: #6d28d9; }

/* ====== BUTTONS ====== */
.bp {
  width: 100%; padding: 8px 0; background: var(--p); color: #fff;
  border: none; border-radius: 6px; font-size: 12px; font-weight: 600;
  cursor: pointer; margin-top: 3px;
}
.bp:hover { background: var(--p2); }

/* ====== CHARTS ====== */
.cb { position: relative; height: 280px; }

/* ====== TABLES ====== */
.dt { width: 100%; border-collapse: collapse; font-size: 10px; }
.dt th, .dt td { padding: 5px 6px; border-bottom: 1px solid var(--b); text-align: center; }
.dt th { background: #f8fafc; font-weight: 600; color: var(--p); font-size: 8px; text-transform: uppercase; }
.dt th:first-child, .dt td:first-child { text-align: left; font-weight: 600; }
.dt .best { background: linear-gradient(135deg, #ecfdf5, #d1fae5); font-weight: 700; }
.dt .ins-row { background: #fffbeb70; }

.mt { width: 100%; border-collapse: collapse; font-size: 9px; }
.mt th, .mt td { padding: 4px 5px; border: 1px solid #f1f5f9; text-align: center; }
.mt th { background: #f8fafc; font-weight: 600; color: var(--p); font-size: 8px; }
.mt th.corner { background: var(--p); color: #fff; }
.mt .hot { font-weight: 700; }

/* ====== MATRIX TABS ====== */
.mx-tab {
  padding: 2px 6px; border: 1px solid var(--b); border-radius: 3px;
  background: #fff; cursor: pointer; font-size: 9px; font-weight: 600;
  color: var(--ts); transition: all .12s;
}
.mx-tab:hover { border-color: var(--p); color: var(--p); }
.mx-tab.active { background: var(--p); color: #fff; border-color: var(--p); }

/* ====== INSIGHT ====== */
.ins {
  background: linear-gradient(135deg, #fef9e7, #fffbeb);
  border-left: 4px solid var(--a); padding: 10px 14px;
  border-radius: 0 7px 7px 0; font-size: 11px; line-height: 1.5; margin-bottom: 6px;
}

/* ====== RESULTS GRID ====== */
.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 0; }

/* ====== FOOTER ====== */
.footer {
  font-size: 9px; color: var(--tt); line-height: 1.5;
  padding: 8px 12px; background: #f8fafc; border-radius: 7px; margin-top: 8px;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* iPad & small desktop */
@media (max-width: 1050px) {
  .grid { grid-template-columns: 1fr; }
  .grid > *:first-child { max-width: 720px; margin: 0 auto 16px auto; width: 100%; }
  .results-grid { grid-template-columns: 1fr; }
  .header h1 { font-size: 20px; }
  .header { padding: 18px 22px; }
  .usd-hero .hv { font-size: 24px; }
  .cb { height: 260px; }
}

/* iPhone & mobile */
@media (max-width: 768px) {
  .app { padding: 8px; }
  .header { padding: 16px 18px; border-radius: 10px; }
  .header h1 { font-size: 18px; }
  .header .eyebrow { font-size: 9px; }
  .header p { font-size: 10px; }

  .card { border-radius: 10px; margin-bottom: 8px; }
  .card-h { padding: 8px 12px; }
  .card-b { padding: 8px 12px; }

  .mr { grid-template-columns: repeat(2, 1fr); }
  .mc { padding: 6px 8px; }
  .mc .mv { font-size: 14px; }

  .bt { font-size: 10px; padding: 5px 7px; min-width: 40px; }
  .pb { font-size: 10px; padding: 5px 7px; }

  .usd-hero { padding: 12px 14px; }
  .usd-hero .hv { font-size: 22px; }
  .usd-hero input { width: 90%; }

  .ptp-l { font-size: 10px; }
  .cval { font-size: 12px; }
  .tval { font-size: 14px; }

  .cb { height: 230px; }
  .dt { font-size: 9px; }
  .mt { font-size: 8px; }

  .lang-btn { font-size: 9px; padding: 3px 7px; }

  /* Sidebar becomes accordion-like on mobile */
  .grid { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr; }
}

/* Very small phones */
@media (max-width: 390px) {
  .header h1 { font-size: 16px; }
  .header { padding: 12px 14px; }
  .usd-hero .hv { font-size: 18px; }
  .yr-val { font-size: 22px; }
  .bg { gap: 2px; }
  .bt { font-size: 9px; padding: 4px 5px; min-width: 35px; }
  .cb { height: 200px; }
}
