/* ========================================
   AltPills – Enterprise Glassmorphism Theme
   Mobile-first, teal/green pharma palette
   ======================================== */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.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;
}

:root {
  --bg-primary: #0f172a;
  --bg-elevated: #1e293b;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #0d9488;
  --accent-light: #14b8a6;
  --accent-surface: rgba(13, 148, 136, 0.1);
  --accent-border: rgba(13, 148, 136, 0.2);
  --green: #10b981;
  --green-surface: rgba(16, 185, 129, 0.08);
  --red: #ef4444;
  --red-surface: rgba(239, 68, 68, 0.08);
  --red-border: rgba(239, 68, 68, 0.2);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --blur: 24px;
  --transition: 0.2s ease;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
    'Helvetica Neue', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle gradient bg */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(13, 148, 136, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 100%, rgba(16, 185, 129, 0.05) 0%, transparent 60%),
    var(--bg-primary);
  z-index: -1;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  gap: 14px;
}

/* Tablet/Desktop Layout */
@media (min-width: 768px) {
  #app {
    max-width: 640px;
    margin: 0 auto;
    padding: 28px 24px;
    gap: 24px;
  }
}

/* --- Glass Card --- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}

.row { width: 100%; }

/* ========================================
   Row 1 – Header
   ======================================== */
.row-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.15) 0%, rgba(20, 184, 166, 0.05) 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  width: 100%;
}

@media (min-width: 768px) {
  .row-header {
    padding: 32px 40px;
    gap: 20px;
  }
}

.logo-container {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 800px;
}

.logo-img {
  height: auto;
  width: 100%;
  max-width: 600px;
  object-fit: contain;
}

@media (min-width: 768px) {
  .logo-img {
    max-width: 700px;
  }
}

@media (min-width: 1200px) {
  .logo-img {
    max-width: 800px;
  }
}

/* Search Bar */
.search-container {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 4px;
  width: 100%;
}

.search-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px 0 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.medicine-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
  padding: 13px 4px;
  min-height: 48px;
}

.medicine-input::placeholder {
  color: var(--text-muted);
  font-size: clamp(0.72rem, 2vw, 0.85rem);
  /* Allow text to wrap naturally */
  white-space: normal;
  line-height: 1.3;
}

/* On very small screens, make placeholder more concise */
@media (max-width: 360px) {
  .medicine-input::placeholder {
    content: "Enter medicine name";
  }
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  min-height: 44px;
  white-space: nowrap;
}

.btn-primary:hover { background: var(--accent-light); }
.btn-primary:active { transform: scale(0.96); }

.btn-action {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.9rem;
  flex: 1;
  min-height: 48px;
}

.btn-action:hover { background: var(--accent-light); }
.btn-action:active { transform: scale(0.97); }
.btn-action:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.85rem;
  border: 1px solid var(--glass-border);
  cursor: pointer;
  min-height: 48px;
  white-space: nowrap;
}

.btn-outline:hover { border-color: var(--text-muted); color: var(--text-primary); }
.btn-outline:active { background: rgba(255,255,255,0.04); }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
  min-height: auto;
}

/* ========================================
   Row 2 – Camera
   ======================================== */
.camera-container {
  padding: 16px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.camera-preview-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
}

/* Idle state – shown before camera is opened */
.camera-idle-prompt {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.6) 0%, rgba(15, 23, 42, 0.85) 100%);
  z-index: 2;
}

.camera-idle-prompt .idle-icon {
  color: var(--text-muted);
  opacity: 0.5;
}

.camera-idle-prompt .idle-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.camera-idle-prompt .idle-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
}

#camera-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  display: none; /* Shown when camera is active */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Corner brackets scan frame */
.scan-frame {
  position: relative;
  width: 72%;
  height: 58%;
}

.corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--accent-light);
  border-style: solid;
  border-width: 0;
}

.corner.tl { top: 0; left: 0; border-top-width: 2.5px; border-left-width: 2.5px; border-top-left-radius: 6px; }
.corner.tr { top: 0; right: 0; border-top-width: 2.5px; border-right-width: 2.5px; border-top-right-radius: 6px; }
.corner.bl { bottom: 0; left: 0; border-bottom-width: 2.5px; border-left-width: 2.5px; border-bottom-left-radius: 6px; }
.corner.br { bottom: 0; right: 0; border-bottom-width: 2.5px; border-right-width: 2.5px; border-bottom-right-radius: 6px; }

/* Animated scan line inside the scan frame */
.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
  box-shadow: 0 0 8px rgba(20, 184, 166, 0.6);
  animation: scanSweep 1.8s ease-in-out infinite;
  border-radius: 1px;
}

@keyframes scanSweep {
  0%   { top: 0%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.camera-hint {
  margin-top: 16px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* Inline Image Preview (inside the camera-preview-wrapper) */
.preview-image-wrapper {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}

.preview-image-wrapper #capture-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.preview-retake-btn {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.18s, border-color 0.18s;
  white-space: nowrap;
}

.preview-retake-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Camera Action Buttons */
.camera-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* Camera Denied State */
.camera-denied .btn-action { display: none; }

.camera-denied .btn-outline {
  flex: 1;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.camera-denied .btn-outline:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
}

.camera-denied .camera-preview-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  aspect-ratio: unset;
}

.camera-denied-msg {
  text-align: center;
  padding: 16px;
}

.camera-denied-msg p {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 10px;
  line-height: 1.5;
}

/* ========================================
   Recent Searches
   ======================================== */
.recent-searches {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}

.recent-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.recent-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.recent-chip {
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.recent-chip:hover {
  border-color: var(--accent-border);
  color: var(--accent-light);
  background: var(--accent-surface);
}

.recent-clear {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--transition);
}

.recent-clear:hover { color: var(--text-primary); }

/* ========================================
   Loading Skeleton
   ======================================== */
.skeleton-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-block {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.09) 50%,
    rgba(255,255,255,0.04) 100%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 8px;
}

.skeleton-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.skeleton-title {
  height: 22px;
  width: 55%;
  border-radius: 6px;
}

.skeleton-badge {
  height: 22px;
  width: 64px;
  border-radius: 20px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.skeleton-cell {
  height: 40px;
  border-radius: 8px;
}

.skeleton-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-row {
  height: 36px;
  border-radius: 6px;
}

.skeleton-row:nth-child(2) { opacity: 0.7; }
.skeleton-row:nth-child(3) { opacity: 0.45; }

.loading-text {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
  transition: opacity 0.3s ease;
}

/* ========================================
   Row 3 – Output
   ======================================== */
.result-card {
  padding: 20px;
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.result-header-left {
  flex: 1;
  min-width: 0;
}

.result-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.result-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

/* Active ingredient – styled as clickable link */
.ingredient-btn {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--accent-light);
  font-size: 0.82rem;
  font-weight: 500;
  margin-top: 3px;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.ingredient-btn::after {
  content: '↗';
  font-size: 0.7rem;
  opacity: 0.6;
}

.ingredient-btn:hover { color: #fff; }

.result-badge {
  background: var(--accent-surface);
  color: var(--accent-light);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--accent-border);
  white-space: nowrap;
}

/* Share button */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.share-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent-light);
  background: var(--accent-surface);
}

.share-btn.copied {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-surface);
}

/* Result footer – new search */
.result-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: center;
}

.btn-new-search {
  font-size: 0.82rem;
  padding: 9px 20px;
  min-height: 38px;
  gap: 7px;
}

/* Medicine Detail Grid */
.medicine-details {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--glass-border);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  word-break: break-word;
}

.detail-price {
  color: var(--accent-light);
  font-weight: 700;
  font-size: 1rem;
}

/* Alternatives Section */
.alternatives-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.alternatives-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.alt-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alt-count {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.sort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  -webkit-tap-highlight-color: transparent;
}

.sort-toggle:hover {
  border-color: var(--accent-border);
  color: var(--accent-light);
}

.sort-toggle.active-savings {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-surface);
}

.sort-toggle svg {
  transition: transform var(--transition);
}

.sort-toggle.active-savings svg {
  transform: rotate(180deg);
}

.alternatives-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -20px;
  padding: 0 20px;
}

.alternatives-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 480px;
}

.alternatives-table thead th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 8px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}

.alternatives-table tbody td {
  padding: 10px 8px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.alternatives-table tbody tr {
  transition: background var(--transition);
}

/* Cheapest row */
.alternatives-table tbody tr.cheapest {
  background: var(--green-surface);
}

.alternatives-table tbody tr.cheapest td {
  color: var(--green);
  font-weight: 600;
}

.cheapest-badge {
  display: inline-block;
  background: var(--green-surface);
  color: var(--green);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.savings-positive {
  color: var(--green) !important;
  font-weight: 600 !important;
}

.savings-negative {
  color: var(--red) !important;
  font-weight: 500 !important;
}

/* De-emphasize rows without price data */
.alternatives-table tbody tr.no-price {
  opacity: 0.45;
}

.no-alternatives {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 24px 0;
}

/* ========================================
   Error
   ======================================== */
.error-card {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--red-border);
  background: var(--red-surface);
}

.error-icon { color: var(--red); flex-shrink: 0; }

.error-text {
  color: var(--red);
  font-size: 0.85rem;
  flex: 1;
}

/* ========================================
   Did You Mean Modal
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px 24px;
  border-bottom: 1px solid var(--glass-border);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.modal-subtitle {
  padding: 16px 24px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
  border-bottom: 1px solid var(--glass-border);
}

.suggestions-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-item {
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.92rem;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.suggestion-item:hover {
  border-color: var(--accent-border);
  background: var(--accent-surface);
  transform: translateX(2px);
}

.suggestion-item:before {
  content: '→';
  color: var(--accent);
  font-weight: bold;
}

.modal-actions {
  padding: 16px 24px 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-actions .btn {
  min-height: 42px;
  padding: 10px 18px;
}

@media (max-width: 520px) {
  .modal-content {
    max-width: 100%;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
  }
}

/* ========================================
   Footer
   ======================================== */
.app-footer {
  margin-top: auto;
  text-align: center;
  padding: 20px 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--glass-border);
}

.app-footer p { margin-bottom: 4px; }

.app-footer a {
  color: var(--accent-light);
  text-decoration: none;
  font-weight: 500;
}

.app-footer a:active { opacity: 0.7; }

/* ========================================
   Animations
   ======================================== */
.row-output,
.row-loading,
.row-error {
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Desktop Responsive Design
   ======================================== */
@media (min-width: 768px) {
  .search-container {
    width: 100%;
  }

  .medicine-input {
    font-size: 1rem;
    padding: 14px 6px;
  }

  .camera-container {
    padding: 24px;
  }

  .camera-actions {
    gap: 16px;
  }

  .result-card {
    padding: 28px;
  }

  .result-title {
    font-size: 1.8rem;
  }

  .ingredient-btn {
    font-size: 1rem;
  }

  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .alternatives-table-wrapper {
    max-height: 500px;
    overflow-y: auto;
  }

  /* Footer */
  .app-footer {
    font-size: 0.85rem;
  }
}

@media (min-width: 1024px) {
  #app {
    max-width: 720px;
    padding: 40px 48px;
  }

  .camera-preview-wrapper {
    aspect-ratio: 16 / 10;
  }
}

@media (min-width: 1200px) {
  .detail-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .camera-preview-wrapper {
    aspect-ratio: 16 / 9;
  }
}

/* ========================================
   Responsive / Utilities
   ======================================== */
@media (min-width: 481px) and (max-width: 767px) {
  #app { padding: 24px; }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .app-footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  #app { padding-bottom: env(safe-area-inset-bottom); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.alternatives-table-wrapper::-webkit-scrollbar { height: 3px; }
.alternatives-table-wrapper::-webkit-scrollbar-track { background: transparent; }
.alternatives-table-wrapper::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 2px; }

 
 