/* RF Power Converter — main.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: #EEF1F8;
  color: #0F172A;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: radial-gradient(circle, rgba(30,64,175,0.07) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* HEADER */
.hdr {
  position: sticky; top: 0; z-index: 100;
  background: #1e40af;
  box-shadow: 0 2px 12px rgba(30,64,175,0.35);
  padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.hdr-left { display: flex; align-items: center; gap: 12px; }
.hdr-icon {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hdr-title { font-size: 15px; font-weight: 600; color: #fff; letter-spacing: -0.02em; }
.hdr-sub   { font-size: 11px; color: rgba(255,255,255,0.6); font-family: 'JetBrains Mono', monospace; margin-top: 1px; }
.beta {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: #fff; background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 3px 10px; border-radius: 20px;
}
.version {
  font-size: 10px; font-weight: 600; letter-spacing: 0.05em;
  color: rgba(255,255,255,0.7); font-family: 'JetBrains Mono', monospace;
}

/* LAYOUT */
.app { display: flex; flex-direction: column; flex: 1; }
.wrap {
  flex: 1; position: relative; z-index: 1;
  max-width: 900px; width: 100%;
  margin: 0 auto; padding: 28px 24px 48px;
}

/* INTRO */
.intro {
  background: #fff;
  border: 1px solid #DDE2EF;
  border-left: 4px solid #1e40af;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px; margin-bottom: 20px;
  font-size: 13px; color: #475569; line-height: 1.6;
}

/* MAIN CARD */
.card {
  background: #fff;
  border: 1px solid #DDE2EF;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.07);
  overflow: hidden;
  margin-bottom: 24px;
}

.form-section {
  padding: 24px 28px;
  border-bottom: 1px solid #DDE2EF;
}
.form-section:last-child { border-bottom: none; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

/* FIELDS */
.field { display: flex; flex-direction: column; gap: 0; }

.flabel {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: #475569; margin-bottom: 9px;
}

.lnum {
  width: 18px; height: 18px;
  background: #1e40af; color: #fff;
  border-radius: 50%;
  font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

/* SELECTS */
select {
  width: 100%;
  padding: 9px 34px 9px 12px;
  border: 1.5px solid #DDE2EF;
  border-radius: 8px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px; color: #0F172A;
  background: #fff;
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 13 13'%3E%3Cpath d='M2.5 4.5l4 4 4-4' stroke='%2394A3B8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus { outline: none; border-color: #1e40af; box-shadow: 0 0 0 3px rgba(30,64,175,0.1); }
select:disabled { background-color: #F5F7FC; color: #94A3B8; cursor: not-allowed; }

/* VENDOR LOGO */
.logo-row {
  margin-top: 10px; height: 40px;
  display: flex; align-items: center;
}
.logo-row img { max-height: 36px; max-width: 150px; object-fit: contain; }
.logo-text {
  font-size: 13px; font-weight: 500; color: #1e40af;
  background: #EFF6FF; padding: 4px 12px;
  border-radius: 6px; border: 1px solid #BFDBFE;
}

/* AP BADGES */
.ap-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.badge {
  font-size: 11px; font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  padding: 3px 9px; border-radius: 20px;
}
.badge-blue { background: #EFF6FF; color: #1e40af; border: 1px solid #BFDBFE; }
.badge-green { background: #ECFDF5; color: #065f46; border: 1px solid #6EE7B7; }

/* SEGMENTED CONTROL */
.seg {
  display: flex; gap: 3px;
  background: #F5F7FC;
  border: 1px solid #DDE2EF;
  border-radius: 8px; padding: 3px;
  width: fit-content;
}
.seg-b {
  padding: 6px 14px; border: none; border-radius: 6px;
  background: transparent;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px; font-weight: 500;
  color: #475569; cursor: pointer;
  transition: all 0.15s;
}
.seg-b:hover { background: #fff; color: #0F172A; }
.seg-b.on { background: #1e40af; color: #fff; font-weight: 600; box-shadow: 0 1px 4px rgba(30,64,175,0.3); }

.cw-wrap { margin-top: 12px; }
.cw-label {
  display: block; margin-bottom: 7px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: #94A3B8;
}

/* DIRECTION BUTTONS */
.dir-wrap { display: flex; flex-direction: column; gap: 8px; }
.dir-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid #DDE2EF; border-radius: 10px;
  background: #fff; cursor: pointer; text-align: left;
  transition: all 0.15s;
}
.dir-btn:hover { border-color: #1e40af; background: #EFF6FF; }
.dir-btn.on    { border-color: #1e40af; background: #EFF6FF; box-shadow: 0 0 0 3px rgba(30,64,175,0.08); }
.dir-circle {
  width: 32px; height: 32px; flex-shrink: 0;
  background: #1e40af; color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600;
}
.dir-title { font-size: 13px; font-weight: 600; color: #0F172A; }
.dir-desc  { font-size: 11px; color: #94A3B8; margin-top: 2px; }

/* NUMBER INPUTS */
.input-row { display: flex; align-items: center; gap: 8px; }
.input-row input[type=number] {
  width: 150px; padding: 9px 12px;
  border: 1.5px solid #DDE2EF; border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px; font-weight: 500; color: #0F172A;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-row input[type=number]:focus {
  outline: none; border-color: #1e40af;
  box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
}
.unit {
  font-size: 11px; font-weight: 600;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.05em;
  color: #94A3B8; background: #F5F7FC;
  border: 1px solid #DDE2EF;
  padding: 5px 10px; border-radius: 6px; white-space: nowrap;
}

/* CALC BAR */
.calc-bar {
  padding: 18px 28px;
  background: #F5F7FC;
  border-top: 1px solid #DDE2EF;
  display: flex; align-items: center; gap: 10px;
}
.btn-calc {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 30px;
  background: #1e40af; color: #fff;
  border: none; border-radius: 8px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px; font-weight: 600;
  cursor: pointer; letter-spacing: -0.01em;
  transition: all 0.15s;
  box-shadow: 0 3px 10px rgba(30,64,175,0.35);
}
.btn-calc:hover { background: #1e3a8a; transform: translateY(-1px); box-shadow: 0 5px 16px rgba(30,64,175,0.4); }
.btn-calc:active { transform: translateY(0); }

.btn-reset {
  padding: 11px 20px;
  border: 1.5px solid #DDE2EF; border-radius: 8px;
  background: #fff; color: #94A3B8;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.btn-reset:hover { border-color: #EF4444; color: #EF4444; background: #FEF2F2; }

/* RESULTS */
.results {
  background: #fff;
  border: 1.5px solid #6EE7B7; border-radius: 14px;
  box-shadow: 0 4px 16px rgba(5,150,105,0.1);
  overflow: hidden;
  animation: slideUp 0.28s cubic-bezier(0.16,1,0.3,1);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.res-hdr {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px;
  background: #ECFDF5; border-bottom: 1px solid #6EE7B7;
}
.res-check {
  width: 30px; height: 30px;
  background: #059669; color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.res-title { font-size: 13px; font-weight: 600; color: #065f46; }
.res-meta  { font-size: 11px; color: #6EE7B7; font-family: 'JetBrains Mono', monospace; margin-top: 2px; }

.res-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #DDE2EF; gap: 1px;
  border-bottom: 1px solid #DDE2EF;
}
.res-cell { background: #fff; padding: 18px 22px; }
.res-cell.primary { background: #ECFDF5; }
.res-cell-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: #94A3B8; margin-bottom: 8px;
}
.res-cell.primary .res-cell-label { color: #059669; opacity: 0.8; }
.res-val {
  font-size: 26px; font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: #0F172A; letter-spacing: -0.04em; line-height: 1;
}
.res-cell.primary .res-val { color: #059669; }
.res-unit { font-size: 11px; font-weight: 400; color: #94A3B8; margin-left: 3px; font-family: 'JetBrains Mono', monospace; }

.trace { padding: 18px 24px; border-bottom: 1px solid #DDE2EF; }
.trace-title {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: #94A3B8; margin-bottom: 10px;
}
.trace-row {
  display: flex; gap: 16px;
  padding: 4px 0;
  border-bottom: 1px dashed #DDE2EF;
  font-size: 12px; font-family: 'JetBrains Mono', monospace;
}
.trace-row:last-child { border-bottom: none; }
.t-key { color: #94A3B8; min-width: 200px; }
.t-val { color: #1e40af; font-weight: 600; }

.psd-section { padding: 18px 24px; }
.psd-table { width: 100%; border-collapse: collapse; font-size: 12px; font-family: 'JetBrains Mono', monospace; }
.psd-table th {
  background: #F5F7FC; color: #475569;
  padding: 8px 14px; text-align: left;
  border-bottom: 2px solid #DDE2EF;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600;
}
.psd-table td { padding: 8px 14px; border-bottom: 1px solid #DDE2EF; color: #0F172A; }
.psd-table tr:last-child td { border-bottom: none; }
.psd-table tr.cur td { background: #ECFDF5; color: #059669; font-weight: 600; }

.err {
  padding: 12px 18px; margin-bottom: 20px;
  background: #FEF2F2; border: 1px solid #FECACA;
  border-radius: 8px; color: #DC2626; font-size: 13px;
}

/* FOOTER */
.site-footer {
  position: relative; z-index: 1;
  background: #fff; border-top: 1px solid #DDE2EF;
  text-align: center; padding: 16px 24px;
}
.site-footer p { font-size: 11px; color: #94A3B8; font-family: 'JetBrains Mono', monospace; }

/* UTILS */
.hidden { display: none !important; }

/* RESPONSIVE */
@media (max-width: 660px) {
  .wrap { padding: 20px 16px 40px; }
  .two-col { grid-template-columns: 1fr; gap: 20px; }
  .form-section { padding: 20px 18px; }
  .calc-bar { padding: 16px 18px; }
  .res-grid { grid-template-columns: 1fr 1fr; }
  .trace-row { flex-direction: column; gap: 2px; }
  .t-key { min-width: unset; }
}
@media (max-width: 420px) {
  .seg-b { padding: 6px 10px; font-size: 11px; }
}