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

:root {
  --purple: #7B2D8B;
  --purple-light: #9B4DAB;
  --purple-pale: #F3E8F7;
  --green: #00A86B;
  --green-light: #E6F7F2;
  --bg: #FDF8FF;
  --white: #FFFFFF;
  --text: #1A1A2E;
  --text-muted: #6B6B85;
  --border: #E8E0F0;
  --shadow: 0 2px 12px rgba(123, 45, 139, 0.08);
  --shadow-hover: 0 6px 24px rgba(123, 45, 139, 0.16);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== HEADER ===== */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.logo-icon { font-size: 1.4rem; }

.logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--purple);
  white-space: nowrap;
}

.suggest-btn-header {
  background: var(--purple);
  color: var(--white);
  border: none;
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.suggest-btn-header:hover { background: var(--purple-light); }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--purple) 0%, #5B1D6B 60%, #3D1050 100%);
  color: var(--white);
  padding: 56px 20px 48px;
  text-align: center;
}

.hero-inner {
  max-width: 680px;
  margin: 0 auto;
}

.hero-title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  opacity: 0.88;
  margin-bottom: 32px;
  line-height: 1.6;
}

.search-wrap {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 14px 44px 14px 44px;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--white);
  color: var(--text);
}

.search-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 168, 107, 0.25);
}

.search-input::placeholder { color: var(--text-muted); }

.search-clear {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.search-clear.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ===== MAIN ===== */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* ===== FILTER BAR ===== */
.filter-section { margin-bottom: 28px; }

.filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  -webkit-overflow-scrolling: touch;
}

.filter-bar::-webkit-scrollbar { height: 4px; }
.filter-bar::-webkit-scrollbar-track { background: transparent; }
.filter-bar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.pill {
  flex-shrink: 0;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  font-family: inherit;
}

.pill:hover {
  border-color: var(--purple);
  color: var(--purple);
  background: var(--purple-pale);
}

.pill.active {
  background: var(--purple);
  border-color: var(--purple);
  color: var(--white);
}

.pill.empty {
  opacity: 0.5;
}

.pill .pill-count {
  display: inline-block;
  background: rgba(255,255,255,0.25);
  border-radius: var(--radius-pill);
  padding: 0 5px;
  font-size: 0.72rem;
  margin-left: 4px;
}

.pill:not(.active) .pill-count {
  background: var(--purple-pale);
  color: var(--purple);
}

/* ===== RESULTS INFO ===== */
.results-info {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  min-height: 1.4em;
}

.results-info strong { color: var(--text); }

/* ===== CARDS GRID ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

/* ===== DOCTOR CARD ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--purple-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-title-group { flex: 1; min-width: 0; }

.card-name {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}

.card-hospital {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--green-light);
  color: var(--green);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.state-badge-unknown {
  background: #FFF4E5;
  color: #D4830A;
}

.card-verified {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-state.hidden { display: none; }

.empty-icon { font-size: 3rem; margin-bottom: 16px; }

.empty-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-block;
  background: var(--purple);
  color: var(--white);
  border: none;
  border-radius: var(--radius-pill);
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
  font-family: inherit;
}

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

/* ===== FOOTER ===== */
.site-footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
}

.footer-inner {
  max-width: 800px;
  margin: 0 auto;
}

.site-footer p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-credit {
  margin-top: 6px;
  font-weight: 500;
}

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: 28px;
  right: 24px;
  z-index: 90;
  background: var(--purple);
  color: var(--white);
  border: none;
  border-radius: var(--radius-pill);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(123, 45, 139, 0.4);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.fab:hover {
  background: var(--purple-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(123, 45, 139, 0.5);
}

.fab-icon { font-size: 1.2rem; line-height: 1; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--purple);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}

.modal-close:hover {
  background: var(--purple-pale);
  color: var(--purple);
}

.modal-body {
  padding: 24px;
  flex: 1;
}

.modal-intro {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* Google Form iframe */
.form-embed iframe {
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  min-height: 520px;
}

/* Placeholder shown before Google Form is connected */
.form-placeholder {
  background: var(--purple-pale);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
}

.form-placeholder-icon { font-size: 2.5rem; margin-bottom: 12px; }

.form-placeholder h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--purple);
}

.form-placeholder p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.form-placeholder code {
  background: rgba(123,45,139,0.12);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--purple);
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .suggest-btn-header { display: none; }

  .hero { padding: 40px 16px 36px; }

  .main { padding: 24px 16px 100px; }

  .fab-label { display: none; }
  .fab { padding: 16px; border-radius: 50%; bottom: 20px; right: 16px; }

  .cards-grid { grid-template-columns: 1fr; }

  .modal { max-height: 95vh; border-radius: var(--radius) var(--radius) 0 0; align-self: flex-end; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}
