/**
 * POD Creator Prototype – styles
 * Scoped under .pod-creator to avoid theme conflicts.
 */

.pod-creator {
  --pod-bg: #f4f6f9;
  --pod-surface: #ffffff;
  --pod-border: #e2e8f0;
  --pod-border-strong: #cbd5e1;
  --pod-text: #0f172a;
  --pod-muted: #64748b;
  --pod-primary: #4f46e5;
  --pod-primary-hover: #4338ca;
  --pod-primary-soft: #eef2ff;
  --pod-success: #059669;
  --pod-danger: #dc2626;
  --pod-radius: 14px;
  --pod-radius-sm: 10px;
  --pod-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --pod-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --pod-font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  /* Ciemniejsze tło stage – biały produkt nie zlewa się z tłem */
  --pod-stage-bg: #2b3340;
  --pod-stage-bg-2: #1e2530;
  --pod-secondary: #0f766e;
  --pod-secondary-hover: #0d9488;

  box-sizing: border-box;
  font-family: var(--pod-font);
  color: var(--pod-text);
  line-height: 1.5;
  max-width: 1200px;
  margin: 0 auto 2rem;
  padding: 0 0.5rem;
}

.pod-creator *,
.pod-creator *::before,
.pod-creator *::after {
  box-sizing: border-box;
}

.pod-creator img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Intro */
.pod-creator__intro {
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 55%, #ecfeff 100%);
  border: 1px solid var(--pod-border);
  border-radius: var(--pod-radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--pod-shadow-sm);
}

.pod-creator__title {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pod-creator__steps {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--pod-muted);
  font-size: 0.95rem;
}

.pod-creator__steps li {
  margin-bottom: 0.25rem;
}

.pod-creator__steps li:last-child {
  margin-bottom: 0;
}

/* Layout */
.pod-creator__layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 900px) {
  .pod-creator__layout {
    grid-template-columns: 1fr;
  }
}

/* Sidebar */
.pod-creator__sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  position: sticky;
  top: 1rem;
}

@media (max-width: 900px) {
  .pod-creator__sidebar {
    position: static;
  }
}

.pod-panel {
  background: var(--pod-surface);
  border: 1px solid var(--pod-border);
  border-radius: var(--pod-radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--pod-shadow-sm);
}

.pod-panel__heading {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pod-muted);
}

/* Product type */
.pod-product-type {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.pod-choice {
  cursor: pointer;
  margin: 0;
}

.pod-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pod-choice__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 0.5rem;
  border: 2px solid var(--pod-border);
  border-radius: var(--pod-radius-sm);
  background: #fafbfc;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

.pod-choice__box img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 8px;
  background:
    linear-gradient(145deg, #3a4556 0%, #1e2530 100%);
  padding: 4px;
}

.pod-choice:hover .pod-choice__box {
  border-color: var(--pod-border-strong);
}

.pod-choice input:checked + .pod-choice__box {
  border-color: var(--pod-primary);
  background: var(--pod-primary-soft);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.pod-choice input:focus-visible + .pod-choice__box {
  outline: 2px solid var(--pod-primary);
  outline-offset: 2px;
}

/* Colors */
.pod-color-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.pod-color {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  margin: 0;
  padding: 0.35rem 0.65rem 0.35rem 0.35rem;
  border: 2px solid var(--pod-border);
  border-radius: 999px;
  background: #fafbfc;
  transition: border-color 0.15s ease, background 0.15s ease;
  font-size: 0.875rem;
  font-weight: 500;
}

.pod-color input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pod-color__swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.pod-color__swatch--black {
  background: #1a1a1a;
}

.pod-color__swatch--white {
  background: #ffffff;
  border-color: #cbd5e1;
}

.pod-color:hover {
  border-color: var(--pod-border-strong);
}

.pod-color input:checked + .pod-color__swatch,
.pod-color:has(input:checked) {
  border-color: var(--pod-primary);
  background: var(--pod-primary-soft);
}

.pod-color input:focus-visible + .pod-color__swatch {
  outline: 2px solid var(--pod-primary);
  outline-offset: 2px;
}

.pod-thumbs {
  display: none;
}

/* Dropzone */
.pod-dropzone {
  position: relative;
  border: 2px dashed var(--pod-border-strong);
  border-radius: var(--pod-radius-sm);
  background: #f8fafc;
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

.pod-dropzone:hover,
.pod-dropzone:focus-visible {
  border-color: var(--pod-primary);
  background: var(--pod-primary-soft);
}

.pod-dropzone.is-dragover {
  border-color: var(--pod-primary);
  background: var(--pod-primary-soft);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.pod-dropzone.has-file {
  border-style: solid;
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.pod-dropzone__icon {
  color: var(--pod-primary);
  margin-bottom: 0.35rem;
  display: flex;
  justify-content: center;
}

.pod-dropzone__text {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--pod-text);
}

.pod-dropzone__text span {
  color: var(--pod-muted);
  font-size: 0.85rem;
}

.pod-dropzone__hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--pod-muted);
}

.pod-dropzone__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  font-size: 0;
}

.pod-upload-status {
  margin-top: 0.65rem;
  font-size: 0.85rem;
  color: var(--pod-success);
  font-weight: 600;
  word-break: break-all;
}

.pod-upload-status.is-error {
  color: var(--pod-danger);
}

/* Controls */
.pod-control {
  display: block;
  margin-bottom: 0.9rem;
}

.pod-control:last-child {
  margin-bottom: 0;
}

.pod-control__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.pod-control__label span:last-child {
  color: var(--pod-primary);
  font-variant-numeric: tabular-nums;
}

.pod-control__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pod-control__row input[type="range"] {
  flex: 1;
  accent-color: var(--pod-primary);
  height: 6px;
  cursor: pointer;
}

.pod-control__actions {
  margin-top: 0.5rem;
}

.pod-sidebar__footer {
  position: sticky;
  bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Buttons */
.pod-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--pod-surface);
  color: var(--pod-text);
}

.pod-btn:active {
  transform: translateY(1px);
}

.pod-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pod-btn--primary {
  background: var(--pod-primary);
  color: #fff;
  border-color: var(--pod-primary);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.pod-btn--primary:hover:not(:disabled) {
  background: var(--pod-primary-hover);
  border-color: var(--pod-primary-hover);
}

.pod-btn--secondary {
  background: var(--pod-secondary);
  color: #fff;
  border-color: var(--pod-secondary);
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.3);
  margin-top: 0.5rem;
}

.pod-btn--secondary:hover:not(:disabled) {
  background: var(--pod-secondary-hover);
  border-color: var(--pod-secondary-hover);
}

.pod-btn--ghost {
  background: transparent;
  border-color: var(--pod-border-strong);
  color: var(--pod-muted);
}

.pod-btn--ghost:hover:not(:disabled) {
  border-color: var(--pod-text);
  color: var(--pod-text);
  background: #f8fafc;
}

.pod-btn--sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  width: 100%;
  margin-top: 0.5rem;
}

.pod-btn--block {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
}

.pod-btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--pod-border);
  background: #f8fafc;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.pod-btn--icon:hover {
  border-color: var(--pod-primary);
  color: var(--pod-primary);
  background: var(--pod-primary-soft);
}

/* Stage */
.pod-creator__stage-wrap {
  background: var(--pod-surface);
  border: 1px solid var(--pod-border);
  border-radius: var(--pod-radius);
  padding: 1rem;
  box-shadow: var(--pod-shadow);
  min-width: 0;
}

.pod-stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pod-stage-toolbar__label {
  font-weight: 700;
  font-size: 0.95rem;
}

.pod-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pod-muted);
  background: #f1f5f9;
  border: 1px solid var(--pod-border);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
}

.pod-stage {
  background:
    radial-gradient(ellipse 80% 70% at 50% 45%, #3a4556 0%, transparent 70%),
    linear-gradient(160deg, var(--pod-stage-bg) 0%, var(--pod-stage-bg-2) 100%);
  border-radius: var(--pod-radius-sm);
  border: 1px solid #1a2030;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 1rem;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.pod-stage__canvas {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 1 / 1.15;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
}

.pod-stage__product {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
  z-index: 1;
  user-select: none;
}

/* Print area guide */
.pod-print-area {
  position: absolute;
  z-index: 2;
  border: 1.5px dashed rgba(165, 180, 252, 0.55);
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.08);
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.pod-print-area__label {
  position: absolute;
  top: -1.35rem;
  left: 0;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(199, 210, 254, 0.95);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.pod-stage.is-interacting .pod-print-area {
  opacity: 1;
  background: rgba(99, 102, 241, 0.14);
}

/* Design layer */
.pod-design {
  position: absolute;
  z-index: 3;
  transform-origin: center center;
  cursor: grab;
  touch-action: none;
  will-change: left, top, width, height, transform;
}

.pod-design.is-dragging {
  cursor: grabbing;
  z-index: 4;
}

.pod-design__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  display: block;
}

.pod-design__handles {
  position: absolute;
  inset: -2px;
  border: 1.5px solid var(--pod-primary);
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.pod-design.is-active .pod-design__handles,
.pod-design:hover .pod-design__handles {
  opacity: 1;
  pointer-events: auto;
}

.pod-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid var(--pod-primary);
  border-radius: 2px;
  pointer-events: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.pod-handle--nw {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}

.pod-handle--ne {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}

.pod-handle--sw {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

.pod-handle--se {
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
}

.pod-stage__hint {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--pod-muted);
  text-align: center;
}

/* Modal */
.pod-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.pod-modal[hidden] {
  display: none !important;
}

.pod-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}

.pod-modal__dialog {
  position: relative;
  background: var(--pod-surface);
  border-radius: var(--pod-radius);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  max-width: 520px;
  width: 100%;
  padding: 1.5rem;
  max-height: 90vh;
  overflow: auto;
  animation: pod-modal-in 0.2s ease;
}

@keyframes pod-modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.pod-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--pod-muted);
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.pod-modal__close:hover {
  background: #f1f5f9;
  color: var(--pod-text);
}

.pod-modal__title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  padding-right: 2rem;
}

.pod-modal__body {
  margin: 0 0 1rem;
  color: var(--pod-muted);
  font-size: 0.95rem;
}

.pod-modal__preview {
  background:
    radial-gradient(ellipse 80% 70% at 50% 45%, #3a4556 0%, transparent 70%),
    linear-gradient(160deg, #2b3340 0%, #1e2530 100%);
  border: 1px solid #1a2030;
  border-radius: var(--pod-radius-sm);
  padding: 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: 0.75rem;
}

.pod-modal__preview img,
.pod-modal__preview canvas {
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.pod-modal__preview-meta {
  width: 100%;
  font-size: 0.85rem;
  color: var(--pod-text);
}

.pod-modal__preview-meta dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
}

.pod-modal__preview-meta dt {
  color: var(--pod-muted);
  font-weight: 500;
}

.pod-modal__preview-meta dd {
  margin: 0;
  font-weight: 600;
}

.pod-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Toast */
.pod-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100001;
  background: #0f172a;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  max-width: min(90vw, 400px);
  text-align: center;
  animation: pod-toast-in 0.25s ease;
}

.pod-toast.is-error {
  background: #991b1b;
}

.pod-toast[hidden] {
  display: none !important;
}

@keyframes pod-toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Mobile tweaks */
@media (max-width: 600px) {
  .pod-creator__title {
    font-size: 1.25rem;
  }

  .pod-stage {
    min-height: 320px;
    padding: 0.5rem;
  }

  .pod-handle {
    width: 16px;
    height: 16px;
  }

  .pod-handle--nw {
    top: -8px;
    left: -8px;
  }

  .pod-handle--ne {
    top: -8px;
    right: -8px;
  }

  .pod-handle--sw {
    bottom: -8px;
    left: -8px;
  }

  .pod-handle--se {
    bottom: -8px;
    right: -8px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .pod-creator *,
  .pod-creator *::before,
  .pod-creator *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
