:root {
  --ink: #101214;
  --muted: #64707b;
  --line: rgba(16, 18, 20, 0.12);
  --mint: #baf4d4;
  --green: #0f8f67;
  --teal: #156f85;
  --coral: #ff775f;
  --amber: #f5bc3b;
  --danger: #c4362e;
  --shadow: 0 24px 80px rgba(16, 18, 20, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 8%, rgba(186, 244, 212, 0.5), transparent 28rem),
    radial-gradient(circle at 86% 10%, rgba(255, 119, 95, 0.16), transparent 24rem),
    linear-gradient(180deg, #f7fbf5 0%, #ffffff 48%, #eef8f5 100%);
  font-family: "Emmanuel Sans", "Segoe UI", Arial, sans-serif;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.pharmacy-shell {
  display: grid;
  grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
  gap: 16px;
  width: min(1540px, calc(100vw - 28px));
  height: calc(100vh - 28px);
  margin: 14px auto;
}

.pharmacy-sidebar,
.shop-panel,
.cart-panel,
.map-panel {
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.pharmacy-sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.brand-link img {
  width: 142px;
  display: block;
}

.dashboard-link,
.location-button,
.checkout-button,
.add-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
  transition: transform 180ms ease, background 180ms ease;
}

.dashboard-link {
  padding: 0 15px;
}

.dashboard-link:hover,
.location-button:hover,
.checkout-button:hover,
.add-button:hover {
  transform: translateY(-2px);
  background: var(--green);
}

.hero-panel,
.nearest-panel,
.filters-panel,
.pharmacy-list-section {
  padding: 16px;
}

.hero-panel,
.nearest-panel,
.filters-panel {
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  width: fit-content;
  margin: 0 0 10px;
  padding: 7px 10px;
  border: 1px solid rgba(15, 143, 103, 0.22);
  border-radius: 999px;
  color: var(--green);
  background: rgba(186, 244, 212, 0.46);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.35rem, 5vw, 4.4rem);
  line-height: 0.94;
}

h2 {
  margin: 0;
  font-size: 1.25rem;
}

.hero-panel p,
.status-note,
.nearest-panel p,
.medicine-card p,
.pharmacy-card small,
.shop-heading p {
  color: var(--muted);
  line-height: 1.5;
}

.location-button {
  width: 100%;
  margin-top: 8px;
}

.status-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(16, 18, 20, 0.04);
  font-size: 0.88rem;
}

.status-note.is-good {
  color: var(--green);
  background: rgba(186, 244, 212, 0.32);
}

.status-note.is-error {
  color: var(--danger);
  background: rgba(196, 54, 46, 0.08);
}

.nearest-panel {
  display: grid;
  gap: 6px;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(16, 18, 20, 0.96), rgba(21, 111, 133, 0.92)),
    var(--ink);
}

.nearest-panel span,
.nearest-panel p {
  color: rgba(255, 255, 255, 0.72);
}

.nearest-panel strong {
  font-size: 1.2rem;
}

.filters-panel {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  outline: 0;
}

input:focus,
select:focus {
  border-color: rgba(15, 143, 103, 0.52);
  box-shadow: 0 0 0 4px rgba(186, 244, 212, 0.36);
}

.pharmacy-list-section {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.section-title,
.pharmacy-card-header,
.medicine-meta,
.cart-heading,
.shop-heading,
.cart-row,
.cart-summary div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  margin-bottom: 12px;
}

.section-title span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.pharmacy-list {
  min-height: 0;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0 2px 4px 0;
  overflow-y: auto;
  list-style: none;
}

.pharmacy-card,
.medicine-card,
.cart-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.pharmacy-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.pharmacy-card:hover,
.pharmacy-card.is-selected {
  transform: translateY(-2px);
  border-color: rgba(15, 143, 103, 0.32);
  background: rgba(186, 244, 212, 0.32);
}

.pharmacy-card.is-nearest {
  border-color: rgba(245, 188, 59, 0.62);
}

.pill,
.nearest-badge,
.distance-badge,
.stock-badge {
  width: fit-content;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

.pill {
  color: var(--green);
  background: rgba(15, 143, 103, 0.1);
}

.nearest-badge {
  color: #5e4611;
  background: rgba(245, 188, 59, 0.22);
}

.distance-badge,
.stock-badge {
  color: var(--ink);
  background: rgba(16, 18, 20, 0.06);
}

.store-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 390px);
  grid-template-rows: minmax(300px, 42vh) minmax(0, 1fr);
  gap: 16px;
}

.map-panel {
  overflow: hidden;
}

#pharmacyMap {
  width: 100%;
  height: 100%;
  min-height: 300px;
  background: #dbe7e2;
}

.shop-panel {
  min-height: 0;
  grid-column: 1;
  padding: 18px;
  overflow: hidden;
}

.cart-panel {
  min-height: 0;
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.wallet-chip {
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 12px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--ink);
}

.wallet-chip span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.78rem;
}

.catalog-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-right: 4px;
  overflow-y: auto;
}

.medicine-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.medicine-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.medicine-card p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.medicine-meta strong {
  font-size: 1.1rem;
}

.add-button {
  width: 100%;
}

.add-button:disabled,
.checkout-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.clear-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

.cart-items {
  min-height: 140px;
  display: grid;
  align-content: start;
  gap: 10px;
  margin: 16px 0;
  overflow-y: auto;
}

.cart-row {
  padding: 12px;
}

.cart-row button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
}

.checkout-form {
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.cart-summary {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(16, 18, 20, 0.04);
}

.checkout-button {
  width: 100%;
}

.order-message {
  display: none;
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  color: var(--green);
  background: rgba(186, 244, 212, 0.32);
  font-size: 0.9rem;
  line-height: 1.4;
}

.order-message.is-visible {
  display: block;
}

.order-message.is-error {
  color: var(--danger);
  background: rgba(196, 54, 46, 0.08);
}

.map-label {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 30px;
  padding: 0 9px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 12px 28px rgba(16, 18, 20, 0.28);
  font-size: 0.72rem;
  font-weight: 900;
}

.map-label.nearest {
  color: var(--ink);
  background: var(--amber);
}

.popup-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
}

@media (max-width: 1120px) {
  body {
    overflow: auto;
  }

  .pharmacy-shell,
  .store-stage {
    grid-template-columns: 1fr;
    height: auto;
  }

  .store-stage {
    grid-template-rows: 420px auto auto;
  }

  .shop-panel,
  .cart-panel {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 680px) {
  .pharmacy-shell {
    width: calc(100% - 20px);
    margin: 10px auto;
  }

  .sidebar-header,
  .shop-heading {
    display: grid;
  }

  .dashboard-link {
    width: 100%;
  }

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