/* PH Consult PWA Stylesheet */
:root {
  --primary: #135b77;
  --primary-dark: #0e465c;
  --primary-light: #e1eef6;
  --hero-bg-start: #123b58;
  --hero-bg-end: #0d2b42;
  --bg-page: #f3f7fa;
  --text-main: #18334a;
  --text-muted: #52697b;
  --border-color: #dce5eb;
  --card-bg: #ffffff;
  --alert-bg: #fff4df;
  --alert-border: #b97816;
  --danger-bg: #fdecec;
  --danger-border: #c93b3b;
  --ok-bg: #e8f4f0;
  --ok-border: #17765d;
  --step-bg: #e9f0f6;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Thai', 'Sarabun', sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px;
  padding-top: calc(12px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--hero-bg-start) 0%, var(--hero-bg-end) 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(18, 59, 88, 0.16);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-brand svg {
  flex-shrink: 0;
  border-radius: 13px;
}

.hero h1 {
  margin: 0 0 3px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.hero-subtitle {
  margin: 0 0 4px;
  font-size: 14px;
  opacity: 0.95;
}

.hero-evidence {
  font-size: 11.5px;
  opacity: 0.8;
  display: block;
}

.btn-lock {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background 0.15s ease;
}

.btn-lock:hover, .btn-lock:active {
  background: rgba(255, 255, 255, 0.28);
}

/* Authentication Gate */
.login-wrap {
  max-width: 420px;
  margin: 48px auto;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 30px 24px;
  box-shadow: 0 8px 24px rgba(18, 59, 88, 0.08);
  text-align: center;
}

.login-logo-box {
  display: inline-flex;
  margin-bottom: 12px;
}

.login-wrap h2 {
  margin: 4px 0 6px;
  font-size: 23px;
  font-weight: 800;
  color: var(--hero-bg-start);
}

.login-desc {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-bottom: 18px;
}

.login-form {
  text-align: left;
}

.form-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid #c9d6df;
  border-radius: 9px;
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 91, 119, 0.15);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
  touch-action: manipulation;
}

.remember-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Nav Pills (Radio + Label for 0ms Touch Latency) */
.nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.nav-pills input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.nav-pill-label {
  display: inline-block;
  padding: 9px 15px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
  user-select: none;
}

.nav-pill-label:hover {
  background: #f0f5f8;
}

.nav-pills input[type="radio"]:checked + .nav-pill-label {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(19, 91, 119, 0.25);
}

/* Tab Content Panels */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Card & Notes */
.panel-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 13px;
  padding: 18px;
  margin: 10px 0;
  box-shadow: 0 2px 8px rgba(18, 44, 60, 0.04);
}

.panel-card h2, .panel-card h3 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 18px;
  font-weight: 750;
  color: var(--hero-bg-start);
}

.alert-note {
  background: var(--alert-bg);
  border-left: 4px solid var(--alert-border);
  padding: 12px 14px;
  border-radius: 8px;
  margin: 12px 0;
  font-size: 14px;
}

.danger-note {
  background: var(--danger-bg);
  border-left: 4px solid var(--danger-border);
  padding: 12px 14px;
  border-radius: 8px;
  margin: 12px 0;
  font-size: 14px;
}

.ok-note {
  background: var(--ok-bg);
  border-left: 4px solid var(--ok-border);
  padding: 12px 14px;
  border-radius: 8px;
  margin: 12px 0;
  font-size: 14px;
}

.step {
  background: var(--step-bg);
  padding: 13px 15px;
  border-radius: 9px;
  margin: 10px 0;
  font-size: 14px;
}

.step strong {
  display: block;
  font-size: 14.5px;
  color: var(--hero-bg-start);
  margin-bottom: 3px;
}

.step p {
  margin: 0;
}

/* Details Box */
details.ref-box {
  background: #f8fbfd;
  border: 1px solid var(--border-color);
  border-radius: 9px;
  padding: 11px 14px;
  margin: 12px 0;
}

details.ref-box summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--primary);
  font-size: 13.5px;
  touch-action: manipulation;
  user-select: none;
}

.ref-box-content {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.6;
}

.ref-box-content p {
  margin: 0 0 6px;
}

.ref-box-content p:last-child {
  margin-bottom: 0;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 14px;
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 14.5px;
  border: 1px solid #c9d6df;
  border-radius: 9px;
  background: #ffffff;
  color: var(--text-main);
  outline: none;
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 91, 119, 0.15);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0;
  font-size: 14px;
  cursor: pointer;
  touch-action: manipulation;
}

.checkbox-row input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  flex-shrink: 0;
  cursor: pointer;
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid #c9d6df;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease;
}

.btn-secondary:hover {
  background: #eef3f7;
}

/* Drug Card */
.drug-card {
  background: #f8fbfd;
  border: 1px solid #d5e2ec;
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0;
}

.drug-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.drug-name {
  font-size: 16px;
  font-weight: 750;
  color: var(--hero-bg-start);
}

.drug-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.th-avail {
  background: #eef7f3;
  color: #145e49;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 8px;
  font-weight: 500;
}

.drug-field {
  font-size: 13.5px;
  margin-bottom: 5px;
  line-height: 1.5;
}

.drug-field-caution {
  font-size: 13.5px;
  color: #8a2a2a;
  line-height: 1.5;
}

/* Footer */
.footer-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 18px;
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 8px;
  }
  .hero {
    padding: 14px 16px;
  }
  .hero h1 {
    font-size: 21px;
  }
  .hero-subtitle {
    font-size: 13px;
  }
  .nav-pill-label {
    padding: 8px 11px;
    font-size: 12.5px;
  }
  .panel-card {
    padding: 14px;
  }
  .login-wrap {
    margin: 24px 8px;
    padding: 24px 18px;
  }
}
