/* Scanner page — fullscreen experience */
body#module-ofiescola_barcodescanner-scanner #wrapper,
body#module-ofiescola_barcodescanner-scanner #content-wrapper,
body#module-ofiescola_barcodescanner-scanner .page-content {
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
}

body#module-ofiescola_barcodescanner-scanner #header,
body#module-ofiescola_barcodescanner-scanner #footer,
body#module-ofiescola_barcodescanner-scanner .breadcrumb,
body#module-ofiescola_barcodescanner-scanner .header-banner {
  display: none !important;
}

.of-scanner-app {
  --of-scan-primary: #1d4ed8;
  --of-scan-primary-dark: #1e3a8a;
  --of-scan-bg: #0f172a;
  --of-scan-surface: #ffffff;
  --of-scan-muted: #64748b;
  --of-scan-success: #059669;
  --of-scan-error: #dc2626;
  min-height: 100dvh;
  background: var(--of-scan-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.of-scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.of-scanner-back,
.of-scanner-flash,
.of-scanner-cart {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: #fff !important;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none !important;
  transition: background 0.15s ease;
  border: none;
  padding: 0;
  cursor: pointer;
}

.of-scanner-back:hover,
.of-scanner-flash:hover,
.of-scanner-cart:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff !important;
}

.of-scanner-flash.is-active {
  background: rgba(250, 204, 21, 0.28);
  color: #fde68a !important;
}

.of-scanner-flash-icon--on {
  display: none;
}

.of-scanner-flash.is-active .of-scanner-flash-icon--off {
  display: none;
}

.of-scanner-flash.is-active .of-scanner-flash-icon--on {
  display: block;
}

.of-scanner-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: 1;
  text-align: center;
}

.of-scanner-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.of-scanner-viewport-wrap {
  position: relative;
  flex: 1;
  min-height: 320px;
  max-height: 62dvh;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}

.of-scanner-reader {
  width: 100%;
  height: 100%;
  min-height: 320px;
}

.of-scanner-video {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  display: block;
  background: #000;
}

.of-scanner-app.is-ios .of-scanner-viewport-wrap {
  min-height: 380px;
  max-height: 72dvh;
}

.of-scanner-app.is-ios .of-scanner-hint--ios {
  display: block;
}

.of-scanner-hint--ios {
  display: none;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.72);
}

.of-scanner-status--error {
  background: rgba(220, 38, 38, 0.94) !important;
  color: #fff;
  font-weight: 600;
}

.of-scanner-status--info {
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
}

.of-scanner-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.of-scanner-frame {
  width: min(92%, 380px);
  height: 96px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  position: relative;
  flex-shrink: 0;
}

.of-scanner-frame::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #60a5fa, transparent);
  animation: of-scan-line 2s ease-in-out infinite;
}

@keyframes of-scan-line {
  0%, 100% { transform: translateY(-30px); opacity: 0.4; }
  50% { transform: translateY(30px); opacity: 1; }
}

.of-scanner-hint {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  padding: 0 24px;
}

.of-scanner-status {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  font-size: 0.85rem;
  white-space: nowrap;
}

.of-scanner-manual {
  padding: 16px;
  background: rgba(15, 23, 42, 0.95);
}

.of-scanner-manual-form {
  display: flex;
  gap: 10px;
}

.of-scanner-manual-input {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.of-scanner-manual-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.of-scanner-manual-input:focus {
  border-color: #60a5fa;
  background: rgba(255, 255, 255, 0.12);
}

.of-scanner-manual-btn {
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  padding: 0 20px;
  background: var(--of-scan-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.of-scanner-manual-btn:hover {
  filter: brightness(1.08);
}

.of-scanner-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--of-scan-surface);
  color: #0f172a;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 72dvh;
  overflow-y: auto;
}

.of-scanner-sheet.is-open {
  transform: translateY(0);
}

.of-scanner-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: #cbd5e1;
  margin: 12px auto 8px;
}

.of-scanner-sheet-content {
  padding: 8px 20px 28px;
}

.of-scanner-product {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.of-scanner-product-img {
  width: 88px;
  height: 88px;
  border-radius: 14px;
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
}

.of-scanner-product-info {
  flex: 1;
  min-width: 0;
}

.of-scanner-product-name {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
}

.of-scanner-product-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--of-scan-muted);
}

.of-scanner-product-price {
  margin: 8px 0 0;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--of-scan-primary);
}

.of-scanner-tiers-title {
  margin: 0 0 12px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--of-scan-muted);
  font-weight: 600;
}

.of-scanner-tiers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.of-scanner-tier {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  text-align: left;
  width: 100%;
}

.of-scanner-tier--add {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #1d4ed8;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.28);
  color: #fff;
}

.of-scanner-tier--add:hover {
  border-color: #1e40af;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 6px 18px rgba(29, 78, 216, 0.34);
}

.of-scanner-tier-action {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.of-scanner-tier-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.of-scanner-tier-icon {
  display: block;
}

.of-scanner-tier-icon-plus {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #22c55e;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.of-scanner-tier:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.of-scanner-tier--add:hover {
  border-color: #1e40af;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
}

.of-scanner-tier:active {
  transform: scale(0.98);
}

.of-scanner-tier.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

.of-scanner-tier-label {
  font-weight: 700;
  font-size: 0.98rem;
  color: #0f172a;
  line-height: 1.25;
}

.of-scanner-tier--add .of-scanner-tier-label {
  color: #fff;
}

.of-scanner-tier-prices {
  text-align: right;
  flex-shrink: 0;
}

.of-scanner-tier-total {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.of-scanner-tier--add .of-scanner-tier-total {
  color: #fff;
}

.of-scanner-tier-unit {
  font-size: 0.8rem;
  color: var(--of-scan-muted);
}

.of-scanner-tier--add .of-scanner-tier-unit {
  color: rgba(255, 255, 255, 0.82);
}

.of-scanner-actions {
  display: flex;
  gap: 10px;
}

.of-scanner-btn {
  flex: 1;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.of-scanner-btn:active {
  transform: scale(0.98);
}

.of-scanner-btn--primary {
  background: var(--of-scan-primary);
  color: #fff;
}

.of-scanner-btn--primary:hover {
  filter: brightness(1.05);
}

.of-scanner-btn--ghost {
  background: #f1f5f9;
  color: #334155;
}

.of-scanner-btn--ghost:hover {
  background: #e2e8f0;
}

.of-scanner-btn.is-loading {
  opacity: 0.65;
  pointer-events: none;
}

.of-scanner-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 50;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.of-scanner-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.of-scanner-toast--ok {
  background: var(--of-scan-success);
}

.of-scanner-toast--err {
  background: var(--of-scan-error);
}

.of-scanner-notfound {
  text-align: center;
  padding: 24px 12px;
}

.of-scanner-notfound-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.of-scanner-notfound p {
  margin: 0 0 16px;
  color: var(--of-scan-muted);
}

.of-scanner-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  color: var(--of-scan-muted);
}

.of-scanner-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--of-scan-primary);
  border-radius: 50%;
  animation: of-spin 0.7s linear infinite;
}

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

@media (min-width: 768px) {
  .of-scanner-app {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }
}
