﻿:root {
  --text: #111;
  --muted: #555;
  --border: #d0d0d0;
  --accent: #0f6d5c;
  --bg: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Work Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: grid;
  gap: 18px;
}

.header {
  display: grid;
  gap: 6px;
}

.brand {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: 1.8rem;
}

p {
  margin: 0;
  color: var(--muted);
}

.controls {
  display: grid;
  gap: 12px;
}

.store-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.store-btn {
  border: 1px solid var(--border);
  background: #fff;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.store-logo {
  width: 70px;
  height: auto;
  object-fit: contain;
}

.store-btn.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 109, 92, 0.15);
}

.store-btn:focus-visible,
.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.icon-btn:focus-visible {
  outline: 3px solid rgba(15, 109, 92, 0.25);
  outline-offset: 2px;
}

.primary-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

#start-scan {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#start-scan .scan-icon {
  width: 32px;
  height: 32px;
  display: inline-block;
}

.secondary-btn {
  border: 1px solid var(--border);
  background: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.scanner {
  display: none;
}

body.is-scanning .scanner {
  display: block;
}

.scanner-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 70vh;
  margin: 0 auto;
  background: #000;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  z-index: 0;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 1;
}

.scan-guide {
  --corner-size: 18px;
  --corner-border: 3px;
  position: relative;
  width: min(60%, 420px);
  aspect-ratio: 3 / 1;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 10px;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.2),
    0 12px 30px rgba(0, 0, 0, 0.25);
}

.scan-corner {
  position: absolute;
  width: var(--corner-size);
  height: var(--corner-size);
  border: var(--corner-border) solid rgba(255, 255, 255, 0.95);
}

.corner-tl {
  top: -8px;
  left: -8px;
  border-right: none;
  border-bottom: none;
  border-radius: 8px 0 0 0;
}

.corner-tr {
  top: -8px;
  right: -8px;
  border-left: none;
  border-bottom: none;
  border-radius: 0 8px 0 0;
}

.corner-bl {
  bottom: -8px;
  left: -8px;
  border-right: none;
  border-top: none;
  border-radius: 0 0 0 8px;
}

.corner-br {
  bottom: -8px;
  right: -8px;
  border-left: none;
  border-top: none;
  border-radius: 0 0 8px 0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2;
}

.modal[hidden] {
  display: none;
}

.modal-content {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  width: 100%;
  max-width: 520px;
  display: grid;
  gap: 15px;
  position: relative;
}

.modal-content h2 {
  margin: 0;
  font-size: 1.2rem;
}

.ean-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}

.ean-label {
  font-size: 0.9rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
}

.ean-code {
  font-size: 0.95rem;
  font-weight: 400;
  font-family: inherit;
  letter-spacing: normal;
  color: var(--muted);
}

.copy-btn {
  flex: 0 0 auto;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn.is-copied,
.icon-btn:disabled {
  background: transparent;
  color: var(--accent);
  cursor: default;
}

.copy-icon svg,
.copy-icon img {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1;
}

.close-btn .close-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.product-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  text-decoration: none;
}

.external-icon {
  display: inline-flex;
}

.external-icon svg,
.external-icon img {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}
