/* ═══════════════════════════════════════════
   MEDICHECK — styles.css
═══════════════════════════════════════════ */

/* ─────────────────────────────────────────
   CSS VARIABLES
───────────────────────────────────────── */
:root {
  --navy:       #0B1F3A;
  --navy-2:     #132845;
  --blue:       #1565C0;
  --blue-2:     #1976D2;
  --teal:       #00ACC1;
  --teal-soft:  #E0F7FA;
  --mint:       #00BFA5;
  --white:      #FFFFFF;
  --off-white:  #F4F8FD;
  --gray-1:     #E8EDF5;
  --gray-2:     #B0BEC5;
  --gray-3:     #607D8B;
  --text:       #1A2B3C;
  --text-soft:  #546E7A;
  --red:        #E53935;
  --amber:      #FFB300;
  --green:      #00897B;
  --shadow-sm:  0 2px 8px rgba(11,31,58,.08);
  --shadow-md:  0 8px 32px rgba(11,31,58,.12);
  --shadow-lg:  0 20px 60px rgba(11,31,58,.18);
  --radius:     14px;
  --radius-sm:  8px;
  --transition: .25s cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--off-white);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─────────────────────────────────────────
   HEADER
───────────────────────────────────────── */
header {
  background: var(--navy);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--teal), var(--mint));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  color: var(--white);
  letter-spacing: -.02em;
}

.logo-text span { color: var(--teal); }

nav { display: flex; gap: .5rem; }

.nav-btn {
  background: transparent;
  border: none;
  color: var(--gray-2);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: .875rem;
  font-weight: 500;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: .01em;
}

.nav-btn:hover {
  background: rgba(255,255,255,.08);
  color: var(--white);
}

.nav-btn.active {
  background: rgba(0,172,193,.15);
  color: var(--teal);
}

/* ─────────────────────────────────────────
   PAGE SWITCHING
───────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ─────────────────────────────────────────
   HERO
───────────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 55%, #1a3a6b 100%);
  padding: 5rem 2rem 6rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 80% 50%, rgba(0,172,193,.12), transparent);
  pointer-events: none;
}

.hero-dots {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

.hero-inner {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: rgba(0,172,193,.15);
  border: 1px solid rgba(0,172,193,.3);
  border-radius: 100px;
  padding: .35rem 1rem;
  font-size: .8rem;
  font-weight: 500;
  color: var(--teal);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: var(--white);
  line-height: 1.2;
  letter-spacing: -.03em;
  margin-bottom: 1.25rem;
}

.hero h1 em { color: var(--teal); font-style: normal; }

.hero p {
  color: var(--gray-2);
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto;
}

/* ─────────────────────────────────────────
   DISCLAIMER BANNER
───────────────────────────────────────── */
.disclaimer {
  background: #FFF8E1;
  border-left: 4px solid var(--amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .9rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  font-size: .875rem;
  color: #5D4037;
  line-height: 1.5;
  margin-bottom: 2rem;
}

.disc-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: .05rem;
}

.disclaimer strong {
  display: block;
  font-weight: 600;
  margin-bottom: .15rem;
}

/* ─────────────────────────────────────────
   MAIN CONTAINER
───────────────────────────────────────── */
.container {
  max-width: 720px;
  margin: -3rem auto 4rem;
  padding: 0 1.5rem;
  position: relative;
}

/* ─────────────────────────────────────────
   CARD
───────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.card-header {
  background: linear-gradient(135deg, var(--blue) 0%, #0D47A1 100%);
  padding: 1.75rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.results-card-header {
  background: linear-gradient(135deg, #00695C 0%, #00897B 100%) !important;
}

.card-header-icon {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  backdrop-filter: blur(4px);
}

.card-header-text h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  color: var(--white);
  letter-spacing: -.02em;
}

.card-header-text p {
  color: rgba(255,255,255,.7);
  font-size: .875rem;
  margin-top: .2rem;
}

.card-body { padding: 2rem; }

/* ─────────────────────────────────────────
   FORM ELEMENTS
───────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.field label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.label-hint {
  font-weight: 400;
  color: var(--gray-3);
  font-size: .75rem;
  text-transform: none;
  letter-spacing: 0;
}

.req { color: var(--red); margin-left: .2rem; }

.field input,
.field select,
.field textarea {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: .95rem;
  color: var(--text);
  background: var(--off-white);
  border: 1.5px solid var(--gray-1);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  outline: none;
  transition: var(--transition);
  resize: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(21,101,192,.1);
}

.field input::placeholder,
.field textarea::placeholder { color: var(--gray-2); }

/* ─────────────────────────────────────────
   SYMPTOMS TAG INPUT
───────────────────────────────────────── */
.symptoms-wrap { position: relative; }

.symptoms-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  min-height: 52px;
  background: var(--off-white);
  border: 1.5px solid var(--gray-1);
  border-radius: var(--radius-sm);
  padding: .6rem .75rem;
  cursor: text;
  transition: var(--transition);
  align-items: center;
}

.symptoms-tags:focus-within {
  border-color: var(--blue);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(21,101,192,.1);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--teal-soft);
  color: var(--blue);
  font-size: .8rem;
  font-weight: 500;
  padding: .25rem .65rem;
  border-radius: 100px;
  border: 1px solid rgba(0,172,193,.25);
  animation: tagIn .2s ease;
}

@keyframes tagIn {
  from { opacity: 0; transform: scale(.8); }
  to   { opacity: 1; transform: scale(1); }
}

.tag-remove {
  cursor: pointer;
  opacity: .6;
  font-size: .85rem;
  line-height: 1;
  transition: var(--transition);
}

.tag-remove:hover { opacity: 1; color: var(--red); }

.tag-input {
  border: none;
  background: transparent;
  outline: none;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: .9rem;
  color: var(--text);
  min-width: 120px;
  flex: 1;
  padding: .2rem 0;
}

.tag-input::placeholder { color: var(--gray-2); }

/* ─────────────────────────────────────────
   AUTOCOMPLETE
───────────────────────────────────────── */
.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-1);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.autocomplete-list.open { display: block; }

.auto-item {
  padding: .65rem 1rem;
  font-size: .9rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.auto-item:hover { background: var(--teal-soft); color: var(--blue); }

.auto-icon { color: var(--teal); font-size: .85rem; }

/* ─────────────────────────────────────────
   QUICK ADD
───────────────────────────────────────── */
.quick-add-wrap { margin-top: .75rem; margin-bottom: 1rem; }

#quick-symptoms {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

/* ─────────────────────────────────────────
   BUTTONS
───────────────────────────────────────── */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%);
  color: var(--white);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  padding: .95rem 2rem;
  cursor: pointer;
  letter-spacing: .02em;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  margin-top: 1.75rem;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(21,101,192,.35);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--blue);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: .9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: .65rem 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.btn-outline:hover { background: var(--blue); color: var(--white); }

/* ─────────────────────────────────────────
   LOADING
───────────────────────────────────────── */
.loading-overlay {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  gap: 1.5rem;
}

.loading-overlay.visible { display: flex; }

.pulse-ring {
  width: 64px;
  height: 64px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-ring::before,
.pulse-ring::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--teal);
  animation: pulse-expand 1.8s ease-in-out infinite;
}

.pulse-ring::after { animation-delay: .9s; }

@keyframes pulse-expand {
  0%   { width: 20px; height: 20px; opacity: 1; }
  100% { width: 64px; height: 64px; opacity: 0; }
}

.pulse-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--mint));
  z-index: 1;
}

.loading-text {
  font-size: .95rem;
  color: var(--text-soft);
  text-align: center;
}

.loading-step {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .8rem;
  color: var(--teal);
  margin-top: .3rem;
}

/* ─────────────────────────────────────────
   RESULTS
───────────────────────────────────────── */
#results-section { display: none; }
#results-section.visible { display: block; }

.results-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--gray-1);
}

.rh-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--teal), var(--mint));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.results-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--text);
}

.results-header p {
  font-size: .85rem;
  color: var(--text-soft);
  margin-top: .15rem;
}

.patient-summary {
  background: var(--off-white);
  border-radius: var(--radius-sm);
  padding: .9rem 1.1rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  font-size: .875rem;
}

.ps-item { display: flex; flex-direction: column; gap: .15rem; }

.ps-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-3);
}

.ps-value { font-weight: 500; color: var(--text); }

/* ─────────────────────────────────────────
   DISEASE CARDS
───────────────────────────────────────── */
.disease-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.disease-card {
  border: 1.5px solid var(--gray-1);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: var(--transition);
  animation: slideUp .4s ease both;
}

.disease-card:nth-child(2) { animation-delay: .1s; }
.disease-card:nth-child(3) { animation-delay: .2s; }

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

.disease-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--teal);
}

.dc-head {
  padding: .9rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--off-white);
  border-bottom: 1px solid var(--gray-1);
}

.dc-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.dc-rank.rank-1 { background: var(--teal);   color: white; }
.dc-rank.rank-2 { background: var(--blue-2); color: white; }
.dc-rank.rank-3 { background: var(--gray-3); color: white; }

.dc-name { font-weight: 600; font-size: 1rem; color: var(--text); }

.dc-confidence {
  margin-left: auto;
  font-size: .78rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border-radius: 100px;
}

.dc-confidence.high   { background: #E8F5E9; color: var(--green); }
.dc-confidence.medium { background: #FFF8E1; color: #F57F17; }
.dc-confidence.low    { background: var(--gray-1); color: var(--gray-3); }

.dc-body {
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.dc-section-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--gray-3);
  margin-bottom: .25rem;
}

.dc-desc {
  font-size: .9rem;
  color: var(--text-soft);
  line-height: 1.65;
}

.dc-advice {
  font-size: .88rem;
  color: #1B5E20;
  background: #F1F8E9;
  border-left: 3px solid var(--green);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .7rem .9rem;
  line-height: 1.6;
}

/* ─────────────────────────────────────────
   RESULTS DISCLAIMER + ACTIONS
───────────────────────────────────────── */
.results-disclaimer {
  background: #FFF8E1;
  border: 1px solid #FFE082;
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  font-size: .82rem;
  color: #5D4037;
  text-align: center;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.results-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

/* ─────────────────────────────────────────
   HISTORY PAGE
───────────────────────────────────────── */
.page-container {
  max-width: 900px;
  margin: 2.5rem auto 4rem;
  padding: 0 1.5rem;
}

.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  color: var(--text);
  letter-spacing: -.03em;
  margin-bottom: .4rem;
}

.page-subtitle {
  color: var(--text-soft);
  font-size: .95rem;
  margin-bottom: 2rem;
}

/* ─────────────────────────────────────────
   HISTORY LIST ITEMS
───────────────────────────────────────── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-item {
  background: var(--white);
  border: 1px solid var(--gray-1);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem;
  align-items: start;
  animation: slideUp .35s ease both;
  transition: var(--transition);
}

.history-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--teal);
}

.hi-name { font-weight: 600; font-size: 1rem; color: var(--text); margin-bottom: .25rem; }
.hi-meta { font-size: .82rem; color: var(--text-soft); margin-bottom: .6rem; }

.hi-symptoms {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .75rem;
}

.hi-tag {
  background: var(--teal-soft);
  color: var(--blue);
  font-size: .75rem;
  padding: .2rem .55rem;
  border-radius: 100px;
  font-weight: 500;
}

.hi-diagnosis {
  font-size: .85rem;
  font-weight: 600;
  color: var(--blue);
  background: #EBF5FF;
  padding: .4rem .75rem;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.hi-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .75rem;
  color: var(--gray-3);
  text-align: right;
  white-space: nowrap;
}

/* ─────────────────────────────────────────
   EMPTY STATE
───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-soft);
}

.empty-icon  { font-size: 3rem; margin-bottom: 1rem; opacity: .5; }
.empty-title { font-weight: 600; font-size: 1.1rem; color: var(--text); margin-bottom: .5rem; }
.empty-desc  { font-size: .9rem; line-height: 1.6; }

/* ─────────────────────────────────────────
   UTILITIES
───────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--gray-1);
  margin: 1.75rem 0;
}

.section-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-3);
  margin-bottom: 1rem;
}

.skeleton {
  background: linear-gradient(90deg, var(--gray-1) 25%, #e0e7ef 50%, var(--gray-1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  height: 80px;
  margin-bottom: .75rem;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ─────────────────────────────────────────
   TOAST NOTIFICATIONS
───────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.toast {
  background: var(--navy);
  color: var(--white);
  padding: .85rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: .65rem;
  animation: toastIn .3s ease;
  max-width: 320px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--teal); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 600px) {
  .card-body { padding: 1.25rem; }
  .hero { padding: 3.5rem 1.5rem 4.5rem; }
  .form-grid { grid-template-columns: 1fr; }
  .header-inner { gap: .5rem; }
  .nav-btn { padding: .4rem .65rem; font-size: .8rem; }
}
