/* CarePlus Medical — layout & theme */
:root {
  --bg: #f4f8f7;
  --surface: #ffffff;
  --text: #1a2e2a;
  --muted: #5c726c;
  --primary: #0d7a6e;
  --primary-dark: #095c53;
  --accent: #e8f5f3;
  --border: #d4e3df;
  --shadow: 0 12px 40px rgba(13, 122, 110, 0.08);
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary-dark);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.75rem 1rem;
  background: var(--primary);
  color: #fff;
  z-index: 100;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--primary), #0a9e8f);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--accent);
  color: var(--primary-dark);
}

.btn-secondary:hover:not(:disabled) {
  background: #d8efe9;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.9rem;
  min-width: 2.25rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--accent);
  border-color: transparent;
}

.btn-cart {
  position: relative;
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 2rem;
  display: grid;
  gap: 2rem;
  align-items: center;
}

@media (min-width: 860px) {
  .hero {
    grid-template-columns: 1fr 1fr;
    padding-top: 3.5rem;
  }
}

.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.03em;
}

.hero-copy p {
  color: var(--muted);
  margin: 0 0 1.5rem;
  max-width: 36ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.75rem;
  padding: 0;
  list-style: none;
}

.trust-row li {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  border-radius: 999px;
  border: 1px solid var(--border);
}

.hero-visual {
  border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(160deg, #e8f5f3 0%, #fff 50%, #dff0ec 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  min-height: 260px;
  display: grid;
  place-items: center;
}

.hero-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  max-width: 320px;
  text-align: center;
}

.hero-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--primary-dark);
}

.catalog {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.catalog-head {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .catalog-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.catalog-head h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0;
}

.search-input {
  width: 100%;
  max-width: 280px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--surface);
}

.search-input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

#category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.chip {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.chip.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

#product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.empty-hint {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 2rem;
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}

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

.product-img-wrap {
  position: relative;
  aspect-ratio: 1;
  background: var(--accent);
  overflow: hidden;
}

.product-card--oos .product-img-wrap img {
  opacity: 0.55;
  filter: grayscale(0.35);
}

.oos-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(26, 46, 42, 0.88);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  pointer-events: none;
}

.product-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-body {
  padding: 1rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.25rem;
}

.product-cat {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
}

.product-card h3 {
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.3;
}

.product-unit {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.product-price {
  margin: 0.35rem 0 0.75rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary-dark);
}

.product-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
}

.qty {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 700;
}

.site-footer {
  background: #0f2521;
  color: #c5d9d4;
  padding: 2.5rem 1.25rem;
  margin-top: 2rem;
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }
}

.site-footer h3 {
  font-family: var(--font-display);
  color: #fff;
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

.site-footer p {
  margin: 0.35rem 0;
  font-size: 0.95rem;
}

.footer-copy {
  grid-column: 1 / -1;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
}

/* Cart drawer */
.cart-drawer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
}

.cart-drawer--open {
  pointer-events: auto;
}

.cart-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 37, 33, 0.4);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cart-drawer--open .cart-drawer__backdrop {
  opacity: 1;
}

.cart-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(400px, 100%);
  height: 100%;
  background: var(--surface);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
}

.cart-drawer--open .cart-panel {
  transform: translateX(0);
}

.cart-panel__head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-panel__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

#cart-lines {
  list-style: none;
  margin: 0;
  padding: 0.75rem 1.25rem;
  flex: 1;
  overflow-y: auto;
}

.cart-empty {
  color: var(--muted);
  padding: 1rem 0;
}

.cart-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.cart-line strong {
  display: block;
  font-size: 0.95rem;
}

.cart-line-actions {
  display: flex;
  gap: 0.25rem;
}

.btn-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.btn-icon:hover {
  background: var(--accent);
  border-color: var(--primary);
}

.cart-panel__foot {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.cart-subtotal {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 37, 33, 0.45);
}

.modal[hidden] {
  display: none;
}

.modal__card {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
}

.modal__head {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.order-form {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.order-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.order-form input,
.order-form textarea {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.order-form input:focus,
.order-form textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.order-preview {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: pre-wrap;
  background: var(--accent);
  padding: 0.75rem;
  border-radius: 8px;
  max-height: 140px;
  overflow-y: auto;
  margin: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
}

.toast--ok {
  background: var(--primary);
  color: #fff;
}
