/* ============================================================
   ScannerView.css — Barcode scanning interface styles
   ============================================================ */

/* ── Full-screen Overlay ─────────────────────────────────── */
.scanner-overlay {
  position: fixed;
  inset: 0;
  background: #0a0e17;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: fadeInFast 0.3s ease-out;
}

@keyframes fadeInFast {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Top Bar ─────────────────────────────────────────────── */
.scanner-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem calc(1rem + env(safe-area-inset-top));
  padding-top: calc(1rem + env(safe-area-inset-top));
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.scanner-back-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e2e8f0;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}
.scanner-back-btn:hover {
  background: rgba(255,255,255,0.14);
}

.scanner-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.01em;
}

/* ── Content Area ────────────────────────────────────────── */
.scanner-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem 1.25rem calc(2rem + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
}

/* ── Start Scan Button ───────────────────────────────────── */
.scan-start-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 1.1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 20px rgba(15, 118, 110, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}
.scan-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(15, 118, 110, 0.55);
}
.scan-start-btn:active {
  transform: translateY(0);
}

.scan-start-icon {
  font-size: 1.5rem;
}

/* ── Manual CIP Input ────────────────────────────────────── */
.manual-cip-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cip-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cip-input-group {
  display: flex;
  gap: 0.5rem;
}

.cip-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-family: 'Courier New', monospace;
  color: #e2e8f0;
  letter-spacing: 0.08em;
  outline: none;
  transition: border-color 0.2s;
}
.cip-input::placeholder {
  color: #475569;
  letter-spacing: 0.04em;
  font-family: system-ui, sans-serif;
}
.cip-input:focus {
  border-color: rgba(16, 185, 129, 0.5);
}

.cip-submit-btn {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s, box-shadow 0.2s;
}
.cip-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.4);
}

/* ── PWA Notice ──────────────────────────────────────────── */
.pwa-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 14px;
  padding: 1rem 1.2rem;
}
.pwa-notice-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.pwa-notice p {
  margin: 0;
  font-size: 0.9rem;
  color: #93c5fd;
  line-height: 1.5;
}

/* ── Error Panel ─────────────────────────────────────────── */
.scan-error-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 16px;
  padding: 1.5rem 1.2rem;
  text-align: center;
}

.scan-error-icon {
  font-size: 2.5rem;
}

.scan-error-msg {
  color: #fca5a5;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}

.scan-retry-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: 10px;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.scan-retry-btn:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ── Scanning Active Panel (native) ──────────────────────── */
.scan-active-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
}
.scan-active-panel p {
  color: #94a3b8;
  font-size: 0.95rem;
  margin: 0;
}

/* ── Camera Viewport (web PWA scanning) ──────────────────── */
.scanner-camera-container {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4/3;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner-frame {
  position: absolute;
  inset: 10% 12%;
  pointer-events: none;
}

.corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: #10b981;
  border-style: solid;
  border-width: 0;
}
.corner.tl { top: 0; left: 0;  border-top-width: 3px;    border-left-width: 3px;  border-radius: 4px 0 0 0; }
.corner.tr { top: 0; right: 0; border-top-width: 3px;    border-right-width: 3px; border-radius: 0 4px 0 0; }
.corner.bl { bottom: 0; left: 0;  border-bottom-width: 3px; border-left-width: 3px;  border-radius: 0 0 0 4px; }
.corner.br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-radius: 0 0 4px 0; }

.scanner-hint {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
}

/* ── Spinner ─────────────────────────────────────────────── */
.scanner-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: #10b981;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Prescriptions Panel ─────────────────────────────────── */
.scanner-prescriptions {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.5rem 1.25rem calc(2rem + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  animation: fadeInUp 0.4s ease-out;
}

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

.scanned-card-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 14px;
  padding: 1rem 1.2rem;
}
.scanned-icon { font-size: 2rem; }
.scanned-cip {
  font-size: 0.85rem;
  color: #64748b;
  font-family: 'Courier New', monospace;
  margin: 0;
}

.rx-heading {
  font-size: 1.1rem;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -0.02em;
  margin: 0;
}
.rx-subheading {
  font-size: 0.85rem;
  color: #64748b;
  margin: -0.5rem 0 0;
}

.rx-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 2rem 0;
  color: #64748b;
  font-size: 0.9rem;
}
.rx-empty {
  color: #64748b;
  text-align: center;
  padding: 1.5rem 0;
  font-size: 0.9rem;
}

.rx-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.rx-item:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(16, 185, 129, 0.35);
  transform: translateX(3px);
}

.rx-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}
.rx-name {
  font-size: 1rem;
  font-weight: 700;
  color: #e2e8f0;
}
.rx-detail {
  font-size: 0.82rem;
  color: #64748b;
}
.rx-ingredient {
  font-size: 0.78rem;
  color: #10b981;
  font-weight: 500;
}

.rx-arrow {
  color: #10b981;
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.rx-item:hover .rx-arrow {
  transform: translateX(4px);
}

.scan-again-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #94a3b8;
  border-radius: 12px;
  padding: 0.75rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}
.scan-again-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #e2e8f0;
}
