/* WooCommerce Order Batch Number – Frontend Styles
   Flat, color-coded, mobile-first
*/

:root {
  --wc-obn-bg: #f4f6f9;
  --wc-obn-card-bg: #ffffff;
  --wc-obn-border: #d0d7e2;
  --wc-obn-border-soft: #e2e8f0;

  --wc-obn-primary: #00aeee;        /* Blau – Suchen/Scannen */
  --wc-obn-primary-hover: #0091d1;

  /* Grün – Hinzufügen/Speichern */
  --wc-obn-add-bg: #d4f3dd;
  --wc-obn-add-bg-hover: #bfe9cb;
  --wc-obn-add-text: #14532d;

  /* Rot – Entfernen/Löschen */
  --wc-obn-remove-bg: #ffe1e1;
  --wc-obn-remove-bg-hover: #ffcdcd;
  --wc-obn-remove-text: #991b1b;

  --wc-obn-muted: #6b7280;
  --wc-obn-heading: #111827;
  --wc-obn-text: #1f2933;

  --wc-obn-error-bg: #fef2f2;
  --wc-obn-error-border: #fecaca;
  --wc-obn-error-text: #b91c1c;

  --wc-obn-radius: 18px;
  --wc-obn-radius-sm: 10px;

  /* Flat: keine Schatten mehr */
  --wc-obn-shadow-soft: none;
  --wc-obn-shadow-chip: none;
}

/* Container
   -------------------------------------------------- */

.wc-obn-dashboard {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
  box-sizing: border-box;
  color: var(--wc-obn-text);
}

.wc-obn-dashboard-inner {
  background: var(--wc-obn-card-bg);
  border-radius: var(--wc-obn-radius);
  border: 1px solid var(--wc-obn-border);
  padding: 1.5rem 1.25rem;
}

@media (min-width: 768px) {
  .wc-obn-dashboard {
    padding: 2.5rem 1.5rem 3rem;
  }

  .wc-obn-dashboard-inner {
    padding: 2rem 1.75rem;
  }
}

/* Typo / Header
   -------------------------------------------------- */

.wc-obn-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.wc-obn-title {
  margin: 0;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--wc-obn-heading);
}

.wc-obn-subtitle {
  margin: 0;
  color: var(--wc-obn-muted);
  font-size: 0.92rem;
}

.wc-obn-section-title {
  font-size: 20px;
  font-weight: 700;
  margin: 1.6rem 0 0.75rem;
  color: var(--wc-obn-heading);
}

/* Form – Order Search
   -------------------------------------------------- */

.wc-obn-order-search-form {
  margin-bottom: 1.3rem;
  padding: 1rem 0 1.2rem;
  border-bottom: 1px solid var(--wc-obn-border-soft);
}

.wc-obn-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.wc-obn-label {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--wc-obn-heading);
}

.wc-obn-input {
  width: 100%;
  box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid var(--wc-obn-border-soft);
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
  background: #f9fafb;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.wc-obn-input:focus {
  outline: none;
  border-color: var(--wc-obn-primary);
  background: #ffffff;
}

.wc-obn-input-sm {
  max-width: 200px;
}

.wc-obn-actions {
  display: flex;
  gap: 0.75rem;
}

/* Buttons – flach, vollflächig, farbcodiert
   -------------------------------------------------- */

.wc-obn-button {
  font-size: 1rem !important;
  line-height: 1;
  border-radius: 999px !important;
  padding: 0.55rem 1.1rem !important;
  min-height: 40px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  white-space: nowrap;
  border: none !important;
  box-shadow: none !important;
  cursor: pointer;
}

/* Blau – Suchen / Scannen */
.wc-obn-button-primary {
  background: var(--wc-obn-primary) !important;
  color: #ffffff !important;
}

.wc-obn-button-primary:hover,
.wc-obn-button-primary:focus-visible {
  background: var(--wc-obn-primary-hover) !important;
}

/* Standard-Secondary -> dezentes Blau-Grau (z. B. Scan) */
.wc-obn-button-secondary {
  background: #e0f5fc !important;
  color: #055160 !important;
}

.wc-obn-button-secondary:hover,
.wc-obn-button-secondary:focus-visible {
  background: #c9eaf7 !important;
}

/* Neutraler "Ghost" (z. B. Links / weniger wichtige Aktionen) */
.wc-obn-button-ghost {
  background: #f3f4f6 !important;
  color: var(--wc-obn-muted) !important;
  padding-inline: 0.8rem !important;
}

.wc-obn-button-ghost:hover,
.wc-obn-button-ghost:focus-visible {
  background: #e5e7eb !important;
}

/* Grün – Save/Add in Batch-Bereich */
.wc-obn-batch-save-row .wc-obn-button {
  background: var(--wc-obn-add-bg) !important;
  color: var(--wc-obn-add-text) !important;
}

.wc-obn-batch-save-row .wc-obn-button:hover,
.wc-obn-batch-save-row .wc-obn-button:focus-visible {
  background: var(--wc-obn-add-bg-hover) !important;
}

/* Grün – "Add another" Button */
.wc-obn-batch-add-more {
  background: var(--wc-obn-add-bg) !important;
  color: var(--wc-obn-add-text) !important;
}

.wc-obn-batch-add-more:hover,
.wc-obn-batch-add-more:focus-visible {
  background: var(--wc-obn-add-bg-hover) !important;
}

/* Rot – Remove-Button an den Chips */
.wc-obn-batch-remove {
  background: var(--wc-obn-remove-bg) !important;
  color: var(--wc-obn-remove-text) !important;
  padding-inline: 0.55rem !important;
  min-height: 28px;
}

.wc-obn-batch-remove:hover,
.wc-obn-batch-remove:focus-visible {
  background: var(--wc-obn-remove-bg-hover) !important;
}

/* Messages
   -------------------------------------------------- */

.wc-obn-message {
  margin-top: 0.85rem;
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
}

.wc-obn-message-error {
  background: var(--wc-obn-error-bg);
  border: 1px solid var(--wc-obn-error-border);
  color: var(--wc-obn-error-text);
}

/* Order Summary
   -------------------------------------------------- */

.wc-obn-order-summary {
  margin-top: 1rem;
}

.wc-obn-summary-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem 1.5rem;
  font-size: 0.9rem;
}

@media (min-width: 640px) {
  .wc-obn-summary-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.wc-obn-summary-item {
  display: flex;
  gap: 0.35rem;
}

.wc-obn-summary-label {
  font-weight: 500;
  color: var(--wc-obn-heading);
}

.wc-obn-summary-value {
  color: #374151;
}

/* Order Items List
   -------------------------------------------------- */

.wc-obn-order-items {
  margin-top: 0.75rem;
}

.wc-obn-order-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 0.5rem;
}

/* Item Card – app-like
   -------------------------------------------------- */

.wc-obn-order-item-card {
  border-radius: 16px;
  border: 1px solid var(--wc-obn-border-soft);
  background: #f9fafb;
  padding: 0.75rem 0.85rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Top row: thumb + main info */

.wc-obn-item-top {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.wc-obn-item-thumb {
  flex: 0 0 110px;
  max-width: 110px;
}

.wc-obn-item-thumb-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--wc-obn-border-soft);
}

@media (min-width: 640px) {
  .wc-obn-item-thumb {
    flex-basis: 130px;
    max-width: 130px;
  }
}

.wc-obn-item-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.wc-obn-item-title-row {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
}

.wc-obn-item-pos, .wc-obn-item-spcr, .wc-obn-item-title {
  margin: 0;
  font-family: 'Montserrat';
  font-size: 20px;
  font-weight: 700;
  color: var(--wc-obn-heading);
}

.wc-obn-item-sub-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

.wc-obn-item-subtext {
  font-size: 0.8rem;
  color: var(--wc-obn-muted);
}

.wc-obn-item-chip {
  font-size: 0.78rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #e5f4fb;
  color: #055160;
}

/* Meta section – like settings list */

.wc-obn-item-meta {
  border-top: 1px solid var(--wc-obn-border-soft);
  padding-top: 0.45rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem 1.5rem;
}

@media (min-width: 640px) {
  .wc-obn-item-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.wc-obn-meta-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wc-obn-meta-row {
  display: flex;
  flex-direction: row;
  gap: 0.2rem;
  font-size: 0.85rem;
}

.wc-obn-meta-label {
  font-weight: 500;
}

.wc-obn-meta-label, .wc-obn-meta-value {
  color: #111827;
  line-height: 1;
}

/* Batches – footer section */

.wc-obn-batches {
  border-top: 1px solid var(--wc-obn-border-soft);
  padding-top: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wc-obn-batches-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.wc-obn-batches-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--wc-obn-heading);
}

.wc-obn-batches-empty {
  margin: 0;
  font-size: 0.8rem;
  color: var(--wc-obn-muted);
}

/* Batch list als Chips */

.wc-obn-batch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.wc-obn-batch-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0rem 0rem 0rem 1rem;
  background: #ffffff;
  border-radius: 999px;
  border: 1px solid var(--wc-obn-border-soft);
}

.wc-obn-batch-label {
  font-size: 0.78rem;
}

/* Batch add – inline, app-like */

.wc-obn-batch-add-form {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.1rem;
}

.wc-obn-batch-add-label {
  font-size: 0.8rem;
  color: var(--wc-obn-muted);
}

.wc-obn-batch-add-rows {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.wc-obn-batch-add-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
}

.wc-obn-batch-add-row .wc-obn-input-sm {
  flex: 1;
  max-width: none;
}

/* „Add another“ + Save */

.wc-obn-batch-add-more-wrap {
  display: flex;
  justify-content: flex-start;
}

.wc-obn-batch-save-row {
  display: none;
  margin-top: 0.3rem;
  justify-content: flex-end;
}

.wc-obn-batch-save-row.is-visible {
  display: flex;
}

/* Mobile */

@media (max-width: 480px) {
  .wc-obn-item-top {
    align-items: flex-start;
  }

  .wc-obn-item-thumb {
    flex-basis: 70px;
    max-width: 70px;
  }

  .wc-obn-item-meta {
    grid-template-columns: 1fr;
  }
}

/* Mobile tweaks
   -------------------------------------------------- */

@media (max-width: 480px) {
  .wc-obn-dashboard-inner {
    padding-inline: 1.1rem;
  }

  .wc-obn-order-search-form {
    padding-top: 0.7rem;
  }

  .wc-obn-button {
    width: auto;
    min-width: 44px;
  }

  .wc-obn-item-thumb {
    max-width: 100px;
  }
}

/* Save-Button-Reihe für Batchnummern */
.wc-obn-batch-save-row {
  display: none;
  margin-top: 0.35rem;
  justify-content: flex-end;
}

.wc-obn-batch-save-row.is-visible {
  display: flex;
}

/* =======================================================
   Scanner Overlay (fullscreen)
   ======================================================= */

.wc-obn-scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none; /* wird per .is-open aktiviert */
  align-items: center;
  justify-content: center;
  pointer-events: none; /* nur Dialog & Backdrop bekommen Pointer */
}

.wc-obn-scanner-overlay.is-open {
  display: flex;
}

.wc-obn-scanner-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  pointer-events: auto;
}

.wc-obn-scanner-dialog {
  position: relative;
  pointer-events: auto;
  background: #111827;
  border-radius: 22px;
  padding: 1rem 1rem 1.1rem;
  max-width: min(480px, 94vw);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  color: #e5e7eb;
}

.wc-obn-scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.wc-obn-scanner-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.wc-obn-scanner-close {
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.wc-obn-scanner-close:hover {
  color: #e5e7eb;
}

.wc-obn-scanner-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Video + Rahmen */

.wc-obn-scanner-video-wrap {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
}

.wc-obn-scanner-video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: cover;
}

/* Rahmen zum Ausrichten des Barcodes */

.wc-obn-scanner-frame {
  position: absolute;
  inset: 14% 10%;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

/* Hinweise */

.wc-obn-scanner-hint,
.wc-obn-scanner-hint-sub {
  margin: 0;
  font-size: 0.8rem;
  text-align: center;
  color: #d1d5db;
}

.wc-obn-scanner-hint-sub {
  color: #9ca3af;
}

.wc-obn-scanner-error {
  margin: 0.25rem 0 0;
  min-height: 1em;
  font-size: 0.8rem;
  text-align: center;
  color: #fecaca;
}

/* Icons & Button-Label */
.wc-obn-icon {
  display: block;
}

.wc-obn-icon svg {
  display: block;
  width: 1.5em;
  height: 1.5em;
  fill: currentColor; /* wichtig */
}

.wc-obn-button-ghost .wc-obn-icon {
  opacity: 0.7;
}


/* optional etwas mehr Abstand zwischen Icon und Text */
.wc-obn-btn-label {
  font-size: 1rem;
  font-weight: 600;
}

/* Input + Search-Button als Einheit */
.wc-obn-input-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.wc-obn-input-row--with-button .wc-obn-input {
  border-radius: 999px 0 0 999px;
  border-right: none;
}

.wc-obn-input-row--with-button .wc-obn-order-search-btn {
  border-radius: 0 999px 999px 0 !important;
  padding-inline: 1rem !important;
}

/* Fix für schmale Screens: Button nicht zu breit */
@media (max-width: 480px) {
  .wc-obn-input-row--with-button .wc-obn-order-search-btn {
    padding-inline: 0.8rem !important;
  }
}

/* Actions-Bereich nur für den Scan-Button */
.wc-obn-actions {
  margin-top: 0.6rem;
}

/* Scan-Button für Ordernummer: volle Breite */
.wc-obn-scan-main {
  width: 100%;
  justify-content: center;
}


/* Mobile Tweaks */

@media (max-width: 480px) {
  .wc-obn-scanner-dialog {
    margin: 0 0.75rem;
    padding-inline: 0.9rem;
  }

  .wc-obn-scanner-video {
    max-height: 55vh;
  }

  .wc-obn-scanner-frame {
    inset: 18% 12%;
  }
}
