/* ============================================================
   Tra Cứu Y Dược – Mobile-First Theme (Standalone SSG)
   ============================================================
   Ported from VitePress custom theme. Self-contained CSS
   with no VitePress dependencies.
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Brand colors – Emerald / Teal medical palette */
  --brand-1: #059669;
  --brand-2: #10b981;
  --brand-3: #34d399;
  --brand-soft: rgba(16, 185, 129, 0.14);

  /* Text */
  --c-text-1: #1a1a1a;
  --c-text-2: #4a5568;
  --c-text-3: #a0aec0;

  /* Backgrounds */
  --c-bg: #ffffff;
  --c-bg-soft: #f7f8fa;
  --c-bg-mute: #eef0f4;

  /* Borders */
  --c-divider: #e2e8f0;

  /* Fonts */
  --font-base: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Layout */
  --nav-height: 60px;
  --max-width: 1080px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --brand-1: #34d399;
    --brand-2: #6ee7b7;
    --brand-3: #a7f3d0;
    --brand-soft: rgba(52, 211, 153, 0.14);

    --c-text-1: #e2e8f0;
    --c-text-2: #a0aec0;
    --c-text-3: #718096;

    --c-bg: #1a202c;
    --c-bg-soft: #2d3748;
    --c-bg-mute: #4a5568;

    --c-divider: #4a5568;
  }
}

/* Manual dark class toggle */
.dark {
  --brand-1: #34d399;
  --brand-2: #6ee7b7;
  --brand-3: #a7f3d0;
  --brand-soft: rgba(52, 211, 153, 0.14);
  --c-text-1: #e2e8f0;
  --c-text-2: #a0aec0;
  --c-text-3: #718096;
  --c-bg: #1a202c;
  --c-bg-soft: #2d3748;
  --c-bg-mute: #4a5568;
  --c-divider: #4a5568;
}

/* ---------- Reset & Global ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}

body {
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.7;
  color: var(--c-text-1);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  max-width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--brand-1);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--c-bg-soft);
  padding: 2px 6px;
  border-radius: 4px;
}

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

/* ---------- Navbar ---------- */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-divider);
  backdrop-filter: blur(12px);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--c-text-1);
  font-weight: 700;
  font-size: 1.05rem;
}

.nav-logo {
  width: 28px;
  height: 28px;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--c-text-2);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-link:hover {
  color: var(--brand-1);
  text-decoration: none;
}

.nav-mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--c-text-1);
  cursor: pointer;
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
  .nav-mobile-toggle {
    display: none;
  }
}

/* Mobile nav */
.nav-mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.nav-mobile-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  z-index: 100;
  background: var(--c-bg);
  border-right: 1px solid var(--c-divider);
  padding: 80px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}

.nav-mobile-link {
  display: block;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 500;
  color: var(--c-text-1);
  text-decoration: none;
  transition: background 0.15s;
}

.nav-mobile-link:hover {
  background: var(--c-bg-soft);
  text-decoration: none;
}

body.nav-open .nav-mobile-overlay {
  opacity: 1;
  pointer-events: auto;
}

body.nav-open .nav-mobile-sidebar {
  transform: translateX(0);
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  padding: 0;
}

/* ---------- VitePress-compatible Doc Styles ---------- */
.vp-doc {
  padding: 12px 16px;
  overflow-x: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (min-width: 768px) {
  .vp-doc { padding: 24px 32px; }
}

@media (min-width: 1024px) {
  .vp-doc { padding: 32px 48px; }
}

.vp-doc h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 16px;
  line-height: 1.3;
  color: var(--c-text-1);
}

.vp-doc h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 32px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--c-divider);
  color: var(--c-text-1);
}

.vp-doc h2:first-child {
  border-top: none;
  margin-top: 0;
}

.vp-doc h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 24px 0 8px;
}

.vp-doc p {
  line-height: 1.8;
  margin: 0 0 12px;
}

.vp-doc ul, .vp-doc ol {
  margin: 0 0 12px;
  padding-left: 24px;
}

.vp-doc li {
  margin-bottom: 4px;
}

.vp-doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 8px 0 16px;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.vp-doc table th,
.vp-doc table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--c-divider);
  text-align: left;
  vertical-align: top;
}

.vp-doc table th {
  font-weight: 600;
  color: var(--c-text-2);
  font-size: 0.8rem;
  white-space: nowrap;
}

.vp-doc blockquote {
  margin: 16px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--brand-1);
  background: var(--c-bg-soft);
  border-radius: 0 8px 8px 0;
}

.vp-doc pre {
  background: var(--c-bg-soft);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
}

.vp-doc pre code {
  background: none;
  padding: 0;
}

.vp-doc img {
  border-radius: 8px;
  margin: 8px 0;
}

/* ---------- Drug Page Styles ---------- */
.drug-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

@media (min-width: 768px) {
  .drug-page { padding: 24px 32px; }
}

.drug-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--c-text-3);
  margin-bottom: 16px;
  padding: 8px 0;
}

.drug-breadcrumb a {
  color: var(--brand-1);
  text-decoration: none;
}

.drug-breadcrumb a:hover {
  text-decoration: underline;
}

.drug-breadcrumb .sep {
  margin: 0 2px;
  color: var(--c-text-3);
}

.drug-breadcrumb .current {
  color: var(--c-text-2);
  font-weight: 500;
}

.drug-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--c-divider);
}

.drug-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--brand-1);
  margin-bottom: 4px;
  line-height: 1.3;
}

@media (min-width: 768px) {
  .drug-header h1 { font-size: 2.25rem; }
}

.drug-hero-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.drug-hero-img {
  width: 80px;
  height: 80px;
  border-radius: 14px;
  border: 2px solid var(--c-divider);
  background: var(--c-bg-soft);
  flex-shrink: 0;
  object-fit: cover;
}

.drug-hero-details {
  flex: 1;
  min-width: 0;
}

.drug-hero-sponsor {
  font-size: 0.72rem;
  color: var(--c-text-3);
  margin: 4px 0 0;
  font-style: italic;
}

.drug-reg {
  font-size: 0.85rem;
  color: var(--c-text-2);
  margin: 0 0 4px;
}

.drug-info-list {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drug-info-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 6px 10px;
  border-radius: 8px;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.drug-info-icon {
  flex-shrink: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.drug-info-text {
  flex: 1;
  min-width: 0;
}

.drug-info-item--form {
  background: var(--brand-soft);
  color: var(--brand-1);
}

.drug-info-item--category {
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
}

.drug-info-item--manufacturer {
  background: rgba(245, 158, 11, 0.08);
  color: #d97706;
}

.drug-ingredients {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 0.875rem;
}

.drug-ingredient-tag {
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-1);
  font-weight: 500;
  font-size: 0.8rem;
  word-break: break-word;
}

.drug-content {
  margin-bottom: 32px;
}

.drug-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 14px 0 8px;
  margin-top: 24px;
  border-top: 1px solid var(--c-divider);
}

.drug-content h2:first-child {
  border-top: none;
  margin-top: 0;
}

.drug-source-footer {
  padding: 20px 0;
  margin-top: 24px;
  border-top: 1px solid var(--c-divider);
  font-size: 0.85rem;
}

.drug-source-footer a {
  color: var(--brand-1);
  text-decoration: none;
}

.drug-source-footer a:hover {
  text-decoration: underline;
}

/* ---------- Home Page ---------- */
.home-page {
  padding: 24px 16px;
}

@media (min-width: 768px) {
  .home-page { padding: 48px 32px; }
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
  margin-bottom: 48px;
}

@media (min-width: 768px) {
  .hero {
    flex-direction: row;
    text-align: left;
  }
  .hero-content { flex: 1; }
}

.hero-name {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #059669 0%, #0ea5e9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .hero-name { font-size: 3rem; }
}

.hero-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--c-text-1);
  margin-bottom: 12px;
}

.hero-tagline {
  font-size: 1rem;
  color: var(--c-text-2);
  line-height: 1.7;
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

@media (min-width: 768px) {
  .hero-actions { justify-content: flex-start; }
}

.hero-image img {
  max-width: 180px;
  max-height: 180px;
}

@media (min-width: 640px) {
  .hero-image img {
    max-width: 240px;
    max-height: 240px;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  min-height: 44px;
}

.btn-brand {
  background: var(--brand-1);
  color: white;
}

.btn-brand:hover {
  background: var(--brand-2);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-alt {
  background: var(--c-bg-soft);
  color: var(--c-text-1);
  border: 1px solid var(--c-divider);
}

.btn-alt:hover {
  background: var(--c-bg-mute);
  text-decoration: none;
}

/* Features */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
}

.feature-card {
  padding: 24px;
  border: 1px solid var(--c-divider);
  border-radius: 12px;
  background: var(--c-bg);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.feature-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--c-text-1);
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--c-text-2);
  line-height: 1.6;
}

/* ---------- Search Page ---------- */
.drug-search-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

.search-box-wrapper {
  padding: 12px 0;
  border-bottom: 1px solid var(--c-divider);
  margin-bottom: 16px;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border: 2px solid var(--c-divider);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--c-bg-soft);
  color: var(--c-text-1);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
}

.search-input:focus {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

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

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--c-text-3);
  pointer-events: none;
}

.search-stats {
  font-size: 0.82rem;
  color: var(--c-text-2);
  margin: 6px 0 0;
}

/* Category dropdown */
.category-dropdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.category-dropdown-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-text-2);
  white-space: nowrap;
  flex-shrink: 0;
}

.category-dropdown {
  flex: 1;
  min-width: 0;
  padding: 8px 32px 8px 12px;
  border: 2px solid var(--c-divider);
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--c-bg-soft);
  color: var(--c-text-1);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  min-height: 40px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}

.category-dropdown:focus {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

@media (max-width: 480px) {
  .category-dropdown-row {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
}

/* ---------- Drug Cards (Search Results) ---------- */
.drug-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding-top: 10px;
}

@media (min-width: 640px) {
  .drug-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .drug-grid { grid-template-columns: repeat(3, 1fr); }
}

.drug-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--c-divider);
  border-radius: 12px;
  text-decoration: none !important;
  color: inherit !important;
  transition: all 0.2s ease;
  background: var(--c-bg);
  min-height: 48px;
  overflow: hidden;
}

.drug-card:hover {
  border-color: var(--brand-1);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
  transform: translateY(-1px);
}

.drug-card__visual {
  display: flex;
  align-items: center;
  gap: 12px;
}

.drug-card__img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 1px solid var(--c-divider);
  background: var(--c-bg-soft);
  flex-shrink: 0;
  object-fit: cover;
}

.drug-card__info {
  flex: 1;
  min-width: 0;
}

.drug-card__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--brand-1);
  margin-bottom: 2px;
  line-height: 1.3;
}

.drug-card__reg {
  font-size: 0.75rem;
  color: var(--c-text-3);
  font-family: var(--font-mono);
}

.drug-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.drug-card__tag {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--c-bg-soft);
  color: var(--c-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.pagination button {
  min-width: 40px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--c-divider);
  border-radius: 8px;
  background: var(--c-bg);
  color: var(--c-text-1);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--brand-1);
  color: var(--brand-1);
}

.pagination button.active {
  background: var(--brand-1);
  color: white;
  border-color: var(--brand-1);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--c-text-2);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state__desc {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--c-divider);
  padding: 24px 16px;
  text-align: center;
  margin-top: auto;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-message {
  font-size: 0.8rem;
  color: var(--c-text-3);
  line-height: 1.6;
  margin-bottom: 8px;
}

.footer-copyright {
  font-size: 0.75rem;
  color: var(--c-text-3);
}

/* ---------- Scroll to top button ---------- */
.scroll-to-top {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 50;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--c-divider);
  background: var(--c-bg);
  color: var(--brand-1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.15s ease;
}

.scroll-to-top:hover {
  background: var(--brand-1);
  color: white;
  border-color: var(--brand-1);
}

.scroll-to-top:active {
  transform: scale(0.92);
}

@media (max-width: 480px) {
  .scroll-to-top {
    bottom: 16px;
    right: 14px;
  }
}

/* ---------- Search highlight ---------- */
mark {
  background: var(--brand-soft);
  color: var(--brand-1);
  padding: 0 2px;
  border-radius: 2px;
}

/* ---------- Page content ---------- */
.page-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

@media (min-width: 768px) {
  .page-content { padding: 32px; }
}

/* ---------- Warning box ---------- */
.warning {
  padding: 16px;
  margin: 16px 0;
  border-left: 4px solid #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  border-radius: 0 8px 8px 0;
}

/* ---------- Smooth animations ---------- */
@media (prefers-reduced-motion: no-preference) {
  .drug-card, .feature-card {
    transition-duration: 0.2s;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- Barcode / QR Code Scanner ---------- */

/* Scan button in search row */
.scan-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 2px solid var(--brand-1);
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-1);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.scan-btn:hover {
  background: var(--brand-1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}
.scan-btn:active {
  transform: scale(0.97);
}
.scan-btn svg {
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .scan-btn__label { display: none; }
  .scan-btn { padding: 10px 12px; }
}

/* Scanner modal */
.scanner-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.scanner-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.scanner-modal__content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: var(--c-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: scannerSlideIn 0.25s ease-out;
}

@keyframes scannerSlideIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.scanner-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-divider);
}
.scanner-modal__header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.scanner-modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--c-text-2);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s;
  line-height: 1;
}
.scanner-modal__close:hover {
  background: var(--c-bg-mute);
  color: var(--c-text-1);
}

.scanner-modal__body {
  padding: 16px 18px;
}

/* Camera preview area */
.scanner-preview {
  width: 100%;
  min-height: 240px;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a1a;
  position: relative;
}
.scanner-preview video {
  border-radius: 12px;
}

.scanner-hint {
  text-align: center;
  font-size: 0.82rem;
  color: var(--c-text-3);
  margin: 10px 0 0;
}

/* Scan result */
.scanner-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-top: 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--brand-1);
  animation: scannerFadeIn 0.3s ease;
}
.scanner-result__icon { font-size: 1.2rem; }
.scanner-result__text { font-family: var(--font-mono); word-break: break-all; }

.scanner-error {
  padding: 10px 14px;
  margin-top: 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  font-size: 0.82rem;
  color: #dc2626;
}

@keyframes scannerFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Actions */
.scanner-modal__actions {
  display: flex;
  gap: 10px;
  padding: 12px 18px 16px;
  justify-content: center;
}
.btn-sm {
  padding: 8px 16px !important;
  font-size: 0.82rem !important;
  border-radius: 10px !important;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .scanner-modal__content {
    max-width: 100%;
    border-radius: 14px;
  }
  .scanner-preview { min-height: 200px; }
}

/* ---------- Print ---------- */
@media print {
  .nav-bar, .site-footer, .scroll-to-top, .search-box-wrapper, .pagination, .scanner-modal {
    display: none !important;
  }
}
