@import "variables.css";

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-hover);
}

/* ----- Header ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--color-bg);
  border-bottom: 1px solid #eee;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--color-text);
  font-weight: 500;
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-primary);
}

.nav-links a.active {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-right .icon-btn {
  background: none;
  border: none;
  padding: 0.35rem;
  cursor: pointer;
  color: var(--color-text);
}

.nav-right .icon-btn:hover {
  color: var(--color-primary);
}

.btn-login {
  padding: 0.5rem 1rem;
  background: var(--color-bg);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-login:hover {
  background: var(--color-primary);
  color: var(--color-bg);
}

/* ----- Hero (home) ----- */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  color: white;
  padding: 3rem 1.5rem 4rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
}

.hero .subtitle {
  margin: 0 0 2rem;
  font-size: 1.125rem;
  opacity: 0.95;
}

.hero-search {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
}

.hero-search svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.hero-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: white;
  font-size: 1rem;
}

.hero-search input::placeholder {
  color: rgba(255, 255, 255, 0.8);
}

.hero-search input:focus {
  outline: none;
}

/* ----- Main content ----- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2rem 0 1rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.btn-primary {
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

/* ----- Cards grid ----- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  padding-bottom: 3rem;
}

.peptide-card {
  background: var(--color-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition);
}

.peptide-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card-initials {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
  font-size: 0.75rem;
  border-radius: 6px;
}

.peptide-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
}

.peptide-card .card-desc {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.card-tags span {
  padding: 0.25rem 0.5rem;
  background: var(--color-bg-subtle);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.peptide-card .research-uses {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin: 0 0 0.75rem;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
}

.research-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.research-badge.extensive { background: #d4edda; color: #155724; }
.research-badge.well { background: var(--color-primary-light); color: var(--color-primary); }
.research-badge.limited { background: #e2e3e5; color: #383d41; }
.research-badge.emerging { background: #fff3cd; color: #856404; }
.research-badge.fda { background: #cce5ff; color: #004085; }

.card-footer a {
  font-size: 0.875rem;
  font-weight: 500;
}

/* ----- Calculator side panel ----- */
.calc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.calc-overlay.open {
  opacity: 1;
  visibility: visible;
}

.calc-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  height: 100%;
  background: var(--color-bg);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.calc-overlay.open .calc-panel {
  transform: translateX(0);
}

.calc-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #eee;
  background: var(--color-primary);
  color: white;
}

.calc-panel-header h2 {
  margin: 0;
  font-size: 1.125rem;
}

.calc-panel-close {
  background: none;
  border: none;
  color: white;
  padding: 0.35rem;
  cursor: pointer;
  border-radius: 4px;
}

.calc-panel-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.calc-panel-body {
  padding: 1.25rem;
}

.calc-placeholder {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* Calculator steps */
.calc-step {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #eee;
}

.calc-step:last-of-type {
  border-bottom: none;
}

.calc-step-title {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}

.calc-reset {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 0.75rem;
  padding: 0;
}

.calc-reset:hover {
  text-decoration: underline;
}

.calc-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calc-input-wrap input {
  flex: 1;
  min-width: 0;
}

.calc-unit {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.calc-vial-size,
.calc-frequency {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}

.calc-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.calc-radio input {
  width: auto;
}

.calc-dose-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calc-dose-row input {
  flex: 1;
  min-width: 5rem;
  width: auto;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
}

.calc-dose-row input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.calc-dose-row select {
  width: auto;
  min-width: 4.5rem;
  padding: 0.5rem 0.5rem 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.875rem;
  background: var(--color-bg);
  cursor: pointer;
}

.calc-results {
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--color-primary-light);
  border-radius: var(--radius);
}

.calc-results .calc-step-title {
  margin-bottom: 0.5rem;
}

.calc-result-line {
  font-size: 0.875rem;
  margin: 0.25rem 0;
  color: var(--color-text);
}

.calc-result-line strong {
  color: var(--color-primary);
}

/* ----- Browse page ----- */
.browse-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-bg);
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.filter-btn:hover {
  background: var(--color-primary-light);
}

.browse-search {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  font-size: 1rem;
}

.browse-search:focus {
  outline: none;
  border-color: var(--color-primary);
}

.browse-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}

.browse-meta {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.browse-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.browse-sort label {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.browse-sort select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-bg);
  cursor: pointer;
}

.browse-sort select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.request-cta {
  margin: 1rem 0;
  padding: 0.75rem;
  background: var(--color-bg-subtle);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.request-cta a {
  font-weight: 600;
}

/* ----- Filter Categories pop-out (Browse) ----- */
.filter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 250;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.filter-overlay.open {
  opacity: 1;
  visibility: visible;
}

.filter-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  max-width: 320px;
  height: 100%;
  background: var(--color-bg);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  z-index: 251;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.filter-overlay.open .filter-panel {
  transform: translateX(0);
}

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.filter-panel-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.filter-panel-close {
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem;
  cursor: pointer;
  border-radius: 4px;
}

.filter-panel-close:hover {
  background: var(--color-bg-subtle);
  color: var(--color-primary);
}

.filter-panel-body {
  padding: 1rem 0;
  overflow-y: auto;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 1.5rem;
  background: none;
  border: none;
  font-size: 0.9375rem;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}

.filter-option:hover {
  background: var(--color-bg-subtle);
}

.filter-option.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 500;
}

.filter-option.filter-all {
  padding: 0.75rem 1.5rem;
  font-weight: 500;
}

.filter-option.filter-all.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.filter-label {
  flex: 1;
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.2rem 0.5rem;
  background: #e9ecef;
  border-radius: 999px;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.filter-option.active .filter-count {
  background: rgba(255, 255, 255, 0.8);
  color: var(--color-primary);
}

.filter-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.filter-section-title {
  margin: 0 1.5rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.filter-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: var(--color-text-muted);
  opacity: 0.8;
  border-radius: 2px;
}

.filter-icon-injectable { border-radius: 2px 2px 0 0; }
.filter-icon-nasal { border-radius: 50%; width: 14px; height: 14px; align-self: center; }
.filter-icon-oral { border-radius: 50%; }
.filter-icon-topical { border-radius: 50%; width: 10px; height: 10px; align-self: center; }

.filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filter-dot-emerging { background: #f0ad4e; }
.filter-dot-extensive { background: #5cb85c; }
.filter-dot-fda { background: #5cb85c; }
.filter-dot-limited { background: #383d41; }
.filter-dot-well { background: var(--color-primary); }

.filter-chevron {
  font-size: 1rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* ----- Contact modal ----- */
.contact-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.contact-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.contact-modal {
  background: var(--color-bg);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.contact-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #eee;
}

.contact-modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.contact-modal-body {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.contact-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #eee;
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid #ddd;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--color-bg-subtle);
}

.btn-send {
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}

.btn-send:hover {
  background: var(--color-primary-hover);
}

.info-box {
  padding: 0.75rem 1rem;
  background: var(--color-primary-light);
  border-radius: 6px;
  font-size: 0.8125rem;
  color: var(--color-primary);
  margin-top: 1rem;
}

/* ----- Page titles ----- */
.page-title {
  margin: 2rem 0 1rem;
  font-size: 1.75rem;
  font-weight: 700;
}

/* ----- Peptide detail page ----- */
.peptide-page {
  padding-bottom: 3rem;
}

.breadcrumb {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 1rem 0 1.5rem;
}

.breadcrumb a {
  color: var(--color-text-muted);
}

.breadcrumb a:hover {
  color: var(--color-primary);
}

.breadcrumb-sep {
  margin: 0 0.35rem;
}

.peptide-hero {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

.peptide-title {
  margin: 0 0 0.35rem;
  font-size: 2rem;
  font-weight: 700;
}

.peptide-subtitle {
  margin: 0 0 1rem;
  font-size: 1.0625rem;
  color: var(--color-text-muted);
}

.peptide-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.peptide-admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.peptide-admin-tab {
  padding: 0.25rem 0.6rem;
  background: var(--color-primary-muted);
  color: var(--color-primary);
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.peptide-key-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding: 1rem;
  background: var(--color-primary-muted);
  border-radius: 8px;
}

.peptide-key-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.peptide-key-card-label {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #b5b5b5;
}

.peptide-key-card-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.peptide-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.peptide-tags span {
  padding: 0.25rem 0.5rem;
  background: var(--color-bg-subtle);
  border-radius: 4px;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.peptide-section {
  margin-bottom: 1.75rem;
}

.peptide-section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.peptide-section p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text);
}

.peptide-section p + p {
  margin-top: 0.75rem;
}

.peptide-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text);
}

.peptide-list li {
  margin-bottom: 0.35rem;
}

.peptide-section--external {
  background: var(--color-bg-subtle);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  border-left: 3px solid var(--color-primary);
}

.peptide-section--external h2 {
  margin-top: 0;
}

.peptide-back {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
  font-size: 0.9375rem;
}

.peptide-back a {
  font-weight: 500;
}

.peptide-loading {
  margin: 2rem 0;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}
