/* =====================================================
   Weather Radar Design Tools - Main Stylesheet
   ===================================================== */

:root {
  --primary:      #1a6fdb;
  --primary-dark: #1558b0;
  --primary-light:#e8f0fd;
  --accent:       #0ea5e9;
  --bg:           #f0f4f9;
  --surface:      #ffffff;
  --surface2:     #f7f9fc;
  --border:       #dde3ec;
  --text:         #1e2535;
  --text-sub:     #5a6478;
  --text-muted:   #8a93a6;
  --success:      #16a34a;
  --success-bg:   #f0fdf4;
  --warning:      #d97706;
  --warning-bg:   #fffbeb;
  --danger:       #dc2626;
  --danger-bg:    #fef2f2;
  --header-h:     60px;
  --sidebar-w:    240px;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 2px 10px rgba(0,0,0,0.07);
  --shadow-md:    0 4px 20px rgba(0,0,0,0.1);
  --font:         'Inter', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  --font-mono:    'JetBrains Mono', 'Consolas', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* =====================================================
   HEADER
   ===================================================== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: linear-gradient(135deg, #0f1f45 0%, #1a3a6e 60%, #1a6fdb 100%);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1.5rem;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
}

.header-logo .fa-satellite-dish {
  font-size: 1.5rem;
  color: var(--accent);
}

.header-logo div {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.header-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
}

.header-sub {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.5px;
}

.header-nav {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* =====================================================
   LAYOUT
   ===================================================== */
.main {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h) - 60px);
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem 0;
  z-index: 50;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-section { margin-bottom: 0.25rem; }

.sidebar-category {
  padding: 0.5rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sidebar-category i {
  color: var(--primary);
  font-size: 0.75rem;
}

.sidebar-list {
  list-style: none;
}

.sidebar-link {
  display: block;
  padding: 0.38rem 1rem 0.38rem 1.75rem;
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.82rem;
  border-left: 2px solid transparent;
  transition: all 0.18s;
}

.sidebar-link:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
}

.sidebar-link.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

/* =====================================================
   CONTENT
   ===================================================== */
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 1.5rem 2rem 3rem;
  max-width: 960px;
}

/* =====================================================
   SECTION HEADER
   ===================================================== */
.tool-section {
  margin-bottom: 1rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--primary);
}

.section-header i {
  font-size: 1.2rem;
  color: var(--primary);
}

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
}

/* =====================================================
   TOOL CARD
   ===================================================== */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.tool-card:hover {
  box-shadow: var(--shadow-md);
}

.tool-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.tool-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.tool-badge {
  font-size: 0.68rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  padding: 0.2rem 0.6rem;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 99px;
  white-space: nowrap;
}

.tool-desc {
  font-size: 0.82rem;
  color: var(--text-sub);
  margin-bottom: 1rem;
  line-height: 1.7;
}

/* =====================================================
   FORMULA
   ===================================================== */
code.formula {
  display: inline-block;
  font-family: var(--font-mono);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  color: var(--primary-dark);
  margin: 0.2rem 0;
}

/* =====================================================
   INPUT GRID
   ===================================================== */
.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.input-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
}

.input-group label sub {
  font-size: 0.68rem;
}

.input-group input[type="number"],
.input-group input[type="text"],
.input-group select {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: var(--font-mono);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  width: 100%;
}

.input-group input[type="number"]:focus,
.input-group input[type="text"]:focus,
.input-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 111, 219, 0.12);
}

.unit {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* =====================================================
   BUTTONS
   ===================================================== */
.calc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.4rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(26,111,219,0.3);
}

.calc-btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(26,111,219,0.35);
}

.calc-btn:active {
  transform: translateY(1px);
}

.add-btn, .remove-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.18s;
  margin-right: 0.5rem;
  margin-bottom: 0.75rem;
}

.add-btn {
  background: var(--success-bg);
  color: var(--success);
  border-color: #86efac;
}

.add-btn:hover { background: #dcfce7; }

.remove-btn {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fca5a5;
}

.remove-btn:hover { background: #fee2e2; }

/* =====================================================
   RESULT BOX
   ===================================================== */
.result-box {
  margin-top: 1rem;
  display: none;
}

.result-box.show { display: block; }

.result-inner {
  background: linear-gradient(135deg, #0f1f45 0%, #162f5c 100%);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  color: #fff;
}

.result-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-bottom: 0.75rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  font-size: 0.88rem;
  gap: 1rem;
}

.result-row:last-child { border-bottom: none; }

.result-label {
  color: rgba(255,255,255,0.65);
  font-size: 0.82rem;
}

.result-val {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: #7dd3fc;
  white-space: nowrap;
}

.result-val.highlight {
  font-size: 1.15rem;
  color: #fbbf24;
}

.result-val.good { color: #6ee7b7; }
.result-val.warn { color: #fcd34d; }
.result-val.danger { color: #fca5a5; }

.result-note {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  margin-top: 0.5rem;
  line-height: 1.5;
}

/* =====================================================
   NF STAGES
   ===================================================== */
.nf-stages {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.nf-stage-row {
  display: grid;
  grid-template-columns: 70px 150px 150px 1fr;
  gap: 0.75rem;
  align-items: end;
  padding: 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.stage-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-mono);
  align-self: flex-end;
  padding-bottom: 0.45rem;
}

.nf-actions {
  margin-top: 0.5rem;
}

/* =====================================================
   CHART
   ===================================================== */
.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  position: relative;
}

/* =====================================================
   DBZ TABLE
   ===================================================== */
.dbz-table-wrapper {
  overflow-x: auto;
}

.dbz-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.dbz-ref-table th {
  background: var(--surface2);
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 700;
  color: var(--text-sub);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.dbz-ref-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.dbz-ref-table tr:hover td { background: var(--surface2); }

.dbz-ref-table .dbz-cell {
  font-weight: 700;
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
  margin-left: var(--sidebar-w);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* =====================================================
   SCROLL ANIMATION
   ===================================================== */
.tool-card {
  animation: fadeUp 0.3s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .header-nav { display: none; }
  .input-grid { grid-template-columns: 1fr 1fr; }
  .nf-stage-row { grid-template-columns: 60px 1fr 1fr; }
  .nf-stage-row .input-group:last-child { grid-column: 2 / -1; }
}

@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 1rem; }
  .footer { margin-left: 0; flex-direction: column; gap: 0.25rem; text-align: center; }
  .input-grid { grid-template-columns: 1fr; }
  .nf-stage-row { grid-template-columns: 1fr 1fr; }
  .stage-label { grid-column: 1 / -1; }
}

/* =====================================================
   SCROLLBAR GLOBAL
   ===================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b0b8cc; }
