/* zone_editor.css — wspólny styl prostokąta rysowanego przez wireDrawRect()
   w zone_editor.js (akcja menu ołóweczka "Zaznacz strefę"), używany zarówno
   przez panel admina (adm/strefy.php, #scene-drag-rect) jak i front gry
   (index.php, #stage-drag-rect) — jedno miejsce zamiast dwóch rozjeżdżających
   się definicji, patrz world/DEVELOPER.md. Wartości przejęte z admina
   (powstał pierwszy). */
.zone-drag-rect {
  display: none;
  position: absolute;
  border: 2px solid #2563eb;
  background: rgba(37, 99, 235, 0.18);
  pointer-events: none;
  z-index: 10;
}

/* Trwały prostokąt pokazujący już zapisaną strefę kliknięcia komponentu
   (renderowany po stronie PHP przy wczytaniu strony i dopisywany przez JS
   zaraz po zapisie akcji "Zaznacz strefę" — bez tego okienko znikało po
   puszczeniu myszy aż do odświeżenia, patrz world/DEVELOPER.md). */
.zone-rect {
  position: absolute;
  border: 2px solid rgba(59, 130, 246, 0.7);
  background: rgba(59, 130, 246, 0.08);
  pointer-events: none;
  z-index: 1;
}
/* Na froncie gry (#stage, index.php) PHP renderuje .zone-rect zawsze dla właściciela sklepu
   ($SHOP_OWNER_MODE), ale widoczne mają być tylko w trybie budowniczego (body.zone-edit-mode,
   app.js openPanel()/closePanel()) — inaczej prostokąty stref zostają na scenie także po
   wyjściu z edycji. W panelu admina (#scene-canvas, adm/strefy.php) cała strona JEST
   edytorem, więc tam .zone-rect ma być widoczne zawsze — reguła dotyczy tylko #stage.
   Patrz world/DEVELOPER.md. */
#stage .zone-rect {
  display: none;
}
body.zone-edit-mode #stage .zone-rect {
  display: block;
}
.zone-rect .zone-rect-label {
  position: absolute;
  top: 100%;
  left: 0;
  font-size: 9px;
  color: rgba(59, 130, 246, 0.9);
  white-space: nowrap;
  text-shadow: 0 0 2px #fff;
}

/* Karta edycji strefy (.shelf-zone-card, render_shelf_zone_card() w inc/funkcje_tenant.php)
   i modal "Edytuj" (#comp-edit-modal) - wspólne dla adm/strefy.php (zakładka "Strefy
   specjalne" + modal ołóweczka) i frontu gry (index.php, modal ołóweczka) - patrz
   world/DEVELOPER.md 2026-08-19. */
.shelf-zone-card {
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
  overflow: hidden;
}

#comp-edit-modal-body .shelf-zone-card {
  border: none;
  border-radius: 0;
}

.shelf-zone-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  flex-wrap: wrap;
}

.szc-id {
  color: var(--text-muted, #888);
  font-size: 12px;
  min-width: 28px;
}

.szc-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted, #888);
  margin-bottom: 3px;
}

.szc-field { display: flex; flex-direction: column; }
.szc-field select, .szc-field input[type="text"] { width: auto; }
.szc-field-sm input[type="number"] { width: 70px; }
/* Ukrycie strzałek spinnera number inputu — było już w adm/style.css (globalnie), front
   nie miał odpowiednika, więc pole KOLEJNOŚĆ wyglądało inaczej niż w adminie. */
.shelf-zone-card input[type="number"]::-webkit-outer-spin-button,
.shelf-zone-card input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.shelf-zone-card input[type="number"] {
  -moz-appearance: textfield;
}
.szc-field-cb { align-items: center; }
.szc-field-cb form {
  display: flex;
  align-items: center;
  min-height: 38px;
}

.szc-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  margin-top: 19px;
}

@media (max-width: 768px) {
  .shelf-zone-row {
    flex-direction: column;
    align-items: stretch;
  }
  .shelf-zone-row .szc-field {
    flex-direction: row;
    align-items: center;
    width: 100%;
  }
  .shelf-zone-row .szc-label {
    width: 100px;
    min-width: 100px;
    margin-bottom: 0;
    word-break: break-word;
  }
  .shelf-zone-row .szc-field form,
  .shelf-zone-row .szc-field .szc-id {
    flex: 1;
    min-width: 0;
  }
  .shelf-zone-row .szc-field select,
  .shelf-zone-row .szc-field input[type="text"],
  .shelf-zone-row .szc-field input[type="number"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .shelf-zone-row .szc-actions {
    width: 100%;
    margin-top: 0;
  }
}

.shelf-label-modal-overlay {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,.5);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}

.shelf-label-modal-box {
  background: #fff;
  padding: 24px;
  border-radius: 8px;
  width: 700px;
  max-width: 95vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 32px rgba(0,0,0,.25);
}

.shelf-label-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.shelf-label-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.shelf-label-modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.shelf-label-modal-footer {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

/* Save bubble (dymek potwierdzenia zapisu formularza .szc-field) - używany przez
   ZoneEditor.showSaveBubble() (zone_editor.js) na froncie i przez admin.js w adminie. */
.save-bubble {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  animation: bubbleFade 1.2s ease-out forwards;
}

.save-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 12px;
  border: 5px solid transparent;
}

.save-bubble.ok {
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #1a1a1a;
}

.save-bubble.ok::after {
  border-top-color: #1a1a1a;
}

.save-bubble.err {
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #1a1a1a;
}

.save-bubble.err::after {
  border-top-color: #1a1a1a;
}

@keyframes bubbleFade {
  0% { opacity: 0; margin-top: 4px; }
  15% { opacity: 1; margin-top: 0; }
  85% { opacity: 1; margin-top: 0; }
  100% { opacity: 0; margin-top: -4px; }
}
