/* ============================================================
   PharmaDose — Public Search Page (search.css)
   ============================================================ */

/* ── Layout ─────────────────────────────────────────────── */
.search-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Site Header ────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: .8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: .75rem; }
.brand-icon { width: 36px; height: 36px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.02em;
}
.brand-sub {
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 500;
}
.header-admin-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: .35rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.header-admin-link:hover {
  color: var(--accent);
  border-color: var(--accent-light);
  background: var(--accent-subtle);
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
  padding: 3rem 1.5rem 2.5rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='28'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}
.hero-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -.03em;
  margin-bottom: .5rem;
}
.hero-sub {
  font-size: clamp(.85rem, 2vw, 1rem);
  color: rgba(255,255,255,.8);
  margin-bottom: 2rem;
  font-weight: 400;
}

/* ── Search Box ─────────────────────────────────────────── */
.search-container { width: 100%; max-width: 580px; margin: 0 auto; }
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 1rem;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.search-input {
  width: 100%;
  padding: 1rem 3.5rem 1rem 3rem;
  font-size: 1.05rem;
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 24px rgba(0,0,0,.18), 0 1px 4px rgba(0,0,0,.10);
  background: #fff;
  color: var(--text-primary);
  transition: box-shadow var(--transition);
}
.search-input:focus {
  outline: none;
  box-shadow: 0 4px 32px rgba(0,0,0,.22), 0 0 0 3px rgba(255,255,255,.4);
}
.search-input::placeholder { color: var(--text-faint); font-size: .95rem; }
.search-input::-webkit-search-cancel-button { display: none; }

.search-spinner {
  position: absolute;
  right: 3.2rem;
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  display: none;
}
.search-spinner.active { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.search-clear {
  position: absolute;
  right: .9rem;
  background: var(--surface-2);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  line-height: 1;
}
.search-clear:hover { background: var(--border); color: var(--text-primary); }

.search-meta {
  margin-top: .75rem;
  font-size: .8rem;
  color: rgba(255,255,255,.65);
  min-height: 1.2em;
  text-align: center;
  transition: opacity var(--transition);
}

/* ── Results Area ───────────────────────────────────────── */
.results-area {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
  flex: 1;
}

/* ── Idle / Welcome ─────────────────────────────────────── */
.state-idle { padding: 1rem 0 2rem; }
.idle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.quick-tip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
}
.quick-tip svg {
  width: 32px; height: 32px;
  color: var(--accent-light);
  margin: 0 auto .75rem;
}
.quick-tip h3 { font-size: .9rem; margin-bottom: .4rem; color: var(--text-primary); }
.quick-tip p  { font-size: .82rem; color: var(--text-muted); line-height: 1.55; }

/* ── Empty State ─────────────────────────────────────────── */
.state-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.state-empty svg   { color: var(--text-faint); margin-bottom: 1rem; }
.state-empty h3    { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: .5rem; }
.state-empty p     { font-size: .875rem; }

/* ── Result Card ─────────────────────────────────────────── */
#searchResults { display: flex; flex-direction: column; gap: 1rem; }

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: cardIn .22s cubic-bezier(.34,1.2,.64,1) both;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.result-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-focus);
}
@keyframes cardIn {
  from { opacity:0; transform:translateY(.6rem) scale(.98); }
  to   { opacity:1; transform:none; }
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.4rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent-subtle) 0%, #fff 100%);
}
.card-title-group { flex: 1; min-width: 0; }
.api-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: .3rem;
  word-break: break-word;
  letter-spacing: -.02em;
}
.category-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(30,64,175,.1);
  border: 1px solid rgba(30,64,175,.18);
  padding: .15rem .6rem;
  border-radius: 99px;
  letter-spacing: .02em;
  text-transform: uppercase;
}

/* Dose badge */
.dose-badge {
  flex-shrink: 0;
  text-align: right;
  background: var(--accent);
  color: #fff;
  padding: .7rem 1rem;
  border-radius: var(--radius);
  min-width: 110px;
}
.dose-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
}
.dose-unit-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  opacity: .85;
  margin-top: .1rem;
}
.dose-label {
  display: block;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .7;
  margin-top: .25rem;
}

/* Info rows */
.card-body { padding: 1rem 1.4rem; }

.info-row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: .25rem .75rem;
  align-items: start;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.info-row:last-child { border-bottom: none; }

.info-key {
  display: flex;
  align-items: center;
  gap: .35rem;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-top: .1rem;
}
.info-key svg { color: var(--accent-light); flex-shrink: 0; }
.info-val { color: var(--text-primary); line-height: 1.5; word-break: break-word; }

/* Notes block */
.notes-block {
  margin-top: .75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-light);
  border-radius: var(--radius);
  padding: .85rem 1rem;
}
.notes-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  margin-bottom: .5rem;
}
.notes-label svg { color: var(--accent-light); }
.notes-val {
  font-size: .855rem;
  color: var(--text-secondary);
  line-height: 1.65;
  white-space: pre-line;
}

/* Reference */
.reference-block {
  margin-top: .6rem;
  font-size: .78rem;
  color: var(--text-muted);
}
.ref-label { font-weight: 600; margin-right: .3rem; }
.ref-val   { font-style: italic; }

/* Card footer */
.card-footer {
  padding: .6rem 1.4rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: .73rem;
  color: var(--text-faint);
}

/* ── Site Footer ────────────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .hero { padding: 2rem 1rem 1.8rem; }
  .card-header { flex-direction: column; }
  .dose-badge  { align-self: flex-start; min-width: auto; }
  .info-row    { grid-template-columns: 1fr; }
  .info-key    { margin-bottom: 0; }
  .header-inner { padding: .65rem 1rem; }
  .results-area { padding: 1.25rem 1rem; }
}
