/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-dark:  #1a4f8a;
  --blue-mid:   #2563a8;
  --blue-light: #e8f0fb;
  --green:      #2e7d32;
  --green-bg:   #e8f5e9;
  --yellow:     #f57f17;
  --yellow-bg:  #fff9c4;
  --orange:     #e65100;
  --orange-bg:  #fff3e0;
  --red:        #c62828;
  --red-bg:     #ffebee;
  --gray:       #546e7a;
  --gray-bg:    #eceff1;
  --white:      #ffffff;
  --radius:     10px;
  --shadow:     0 2px 8px rgba(0,0,0,.12);
}

body {
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: #f0f4fa;
  color: #1a1a2e;
  font-size: 15px;
  line-height: 1.6;
}

/* ===== Header ===== */
header {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
  color: var(--white);
  padding: 16px 20px 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

header img#doctor-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--white);
  padding: 3px;
  flex-shrink: 0;
}

.header-text h1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.3;
}

.header-text p {
  font-size: .75rem;
  opacity: .85;
  margin-top: 2px;
}

/* ===== Main ===== */
main {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 14px 60px;
}

/* ===== Input Card ===== */
.input-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.input-card h2 {
  font-size: .95rem;
  color: var(--blue-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.input-row label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--blue-dark);
  white-space: nowrap;
}

.input-row input[type="number"] {
  width: 120px;
  padding: 10px 12px;
  border: 2px solid #b0c4de;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue-dark);
  text-align: center;
  outline: none;
  transition: border-color .2s;
}

.input-row input[type="number"]:focus {
  border-color: var(--blue-mid);
}

.input-row span.unit {
  font-size: .8rem;
  color: var(--gray);
}

button#calc-btn {
  background: var(--blue-mid);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 11px 24px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .1s;
  margin-top: 4px;
}

button#calc-btn:hover { background: var(--blue-dark); }
button#calc-btn:active { transform: scale(.97); }

/* Dialysis toggle */
.dialysis-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialysis-row label {
  font-size: .88rem;
  color: var(--gray);
  cursor: pointer;
}

.dialysis-row input[type="checkbox"] {
  width: 18px; height: 18px;
  cursor: pointer;
  accent-color: var(--blue-mid);
}

/* ===== Legend ===== */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 600;
}

.legend-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green  { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-orange { background: var(--orange); }
.dot-red    { background: var(--red); }

/* ===== Results ===== */
#results { display: none; }

.section-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--blue-dark);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 22px 0 8px;
  padding-left: 6px;
  border-left: 4px solid var(--blue-mid);
}

/* Drug card */
.drug-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}

.drug-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drug-name {
  font-size: .95rem;
  font-weight: 700;
}

.drug-sub {
  font-size: .75rem;
  opacity: .75;
  margin-top: 1px;
}

.status-badge {
  font-size: .78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Color themes */
.theme-green  { background: var(--green-bg);  border-left: 5px solid var(--green); }
.theme-yellow { background: var(--yellow-bg); border-left: 5px solid var(--yellow); }
.theme-orange { background: var(--orange-bg); border-left: 5px solid var(--orange); }
.theme-red    { background: var(--red-bg);    border-left: 5px solid var(--red); }
.theme-gray   { background: var(--gray-bg);   border-left: 5px solid var(--gray); }

.badge-green  { background: var(--green);  color: #fff; }
.badge-yellow { background: var(--yellow); color: #fff; }
.badge-orange { background: var(--orange); color: #fff; }
.badge-red    { background: var(--red);    color: #fff; }
.badge-gray   { background: var(--gray);   color: #fff; }

.drug-detail {
  padding: 0 16px 12px;
  font-size: .83rem;
  color: #333;
}

.drug-detail p { margin-top: 4px; }
.drug-detail strong { color: var(--blue-dark); }

/* ===== Info Blocks ===== */
.info-block {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}

.info-block-header {
  padding: 12px 16px;
  background: var(--blue-light);
  font-size: .88rem;
  font-weight: 700;
  color: var(--blue-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-block-body {
  padding: 12px 16px;
  font-size: .83rem;
  color: #333;
}

.info-block-body ul {
  padding-left: 18px;
  margin-top: 4px;
}

.info-block-body li { margin-top: 3px; }

/* ===== Collapsible ===== */
details {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}

summary {
  padding: 13px 16px;
  font-size: .88rem;
  font-weight: 700;
  color: var(--blue-dark);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--blue-light);
  user-select: none;
}

summary::after {
  content: "▼";
  font-size: .7rem;
  transition: transform .2s;
}

details[open] summary::after { transform: rotate(180deg); }

.details-body {
  padding: 14px 16px;
  font-size: .83rem;
  color: #333;
  line-height: 1.7;
}

.details-body h4 {
  font-size: .85rem;
  color: var(--blue-dark);
  margin: 10px 0 4px;
}

.details-body h4:first-child { margin-top: 0; }

.details-body ul {
  padding-left: 18px;
}

.details-body li { margin-top: 3px; }

/* ===== Disclaimer ===== */
.disclaimer {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: .78rem;
  color: #5d4037;
  margin-top: 20px;
  line-height: 1.7;
}

.disclaimer strong { color: #bf360c; }

/* ===== SGLT2 note ===== */
.sglt2-note {
  font-size: .75rem;
  color: var(--orange);
  font-weight: 600;
  margin-top: 6px;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  font-size: .72rem;
  color: var(--gray);
  padding: 20px 14px;
}

/* ===== Responsive ===== */
@media (max-width: 400px) {
  header img#doctor-img { width: 52px; height: 52px; }
  .header-text h1 { font-size: .95rem; }
  button#calc-btn { width: 100%; }
}
