.npc-app {
  --npc-gap: 20px;
  --npc-radius: 10px;
  --npc-border: #e5e7eb;
  --npc-border-hover: #2563eb;
  --npc-text: #111827;
  --npc-text-muted: #6b7280;
  --npc-bg-card: #ffffff;
  --npc-bg-badge: rgba(17, 24, 39, 0.85);
  --npc-transition: 200ms ease;

  max-width: 1200px;
  margin: 32px auto;
  padding: 0 16px;
  font-family: inherit;
  color: var(--npc-text);
}

.npc-header {
  margin-bottom: 24px;
}

.npc-title {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--npc-text);
}

.npc-filters {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.npc-filter {
  flex: 1 1 50%;
  min-width: 0;
}

.npc-filter label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--npc-text);
  font-weight: 500;
}

.npc-dropdown {
  position: relative;
}

.npc-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--npc-border);
  border-radius: var(--npc-radius);
  background: #fff;
  font-size: 14px;
  color: var(--npc-text);
  font-family: inherit;
  cursor: pointer;
  box-sizing: border-box;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--npc-transition);
}

.npc-dropdown-trigger:hover {
  border-color: #d1d5db;
}

.npc-dropdown-trigger:focus {
  outline: 2px solid var(--npc-border-hover);
  outline-offset: 1px;
}

.npc-dropdown-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.npc-dropdown-arrow {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  transition: transform var(--npc-transition);
}

.npc-dd-open .npc-dropdown-arrow {
  transform: rotate(180deg);
}

.npc-dropdown-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--npc-border);
  border-radius: var(--npc-radius);
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.12);
  z-index: 100;
}

.npc-dropdown-list[hidden] {
  display: none;
}

.npc-dropdown-list li {
  padding: 8px 12px;
  font-size: 14px;
  color: var(--npc-text);
  cursor: pointer;
  outline: none;
  transition: background var(--npc-transition);
}

.npc-dropdown-list li:hover:not(.npc-dd-disabled),
.npc-dropdown-list li:focus:not(.npc-dd-disabled) {
  background: #f3f4f6;
}

.npc-dropdown-list li.npc-dd-selected {
  font-weight: 500;
  background: #eff6ff;
  color: var(--npc-border-hover);
}

.npc-dropdown-list li.npc-dd-disabled {
  color: var(--npc-text-muted);
  font-style: italic;
  cursor: default;
  opacity: 0.7;
}

.npc-results-count {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.npc-count-badge {
  font-size: 13px;
  color: var(--npc-text-muted);
  font-weight: 500;
}

.npc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--npc-gap);
}

@media (min-width: 640px) {
  .npc-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .npc-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1200px) {
  .npc-grid { grid-template-columns: repeat(4, 1fr); }
}

.npc-loading,
.npc-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--npc-text-muted);
  font-size: 15px;
}

.npc-empty-icon {
  font-size: 36px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.npc-card {
  position: relative;
  background: var(--npc-bg-card);
  border: 1px solid var(--npc-border);
  border-radius: var(--npc-radius);
  overflow: hidden;
  cursor: pointer;
  transition:
    transform var(--npc-transition),
    border-color var(--npc-transition),
    box-shadow var(--npc-transition);
  display: flex;
  flex-direction: column;
}

.npc-card:hover {
  transform: translateY(-3px);
  border-color: var(--npc-border-hover);
  box-shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.08);
}

.npc-card:focus-visible {
  outline: 2px solid var(--npc-border-hover);
  outline-offset: 2px;
}

.npc-card-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f3f4f6;
  overflow: hidden;
}

.npc-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.npc-zone-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--npc-bg-badge);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  border-radius: 999px;
  letter-spacing: 0.2px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.npc-card-body {
  padding: 12px 14px;
  border-top: 1px solid var(--npc-border);
}

.npc-card-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--npc-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}

.npc-card-price {
  font-size: 13px;
  color: var(--npc-text-muted);
  line-height: 1.2;
}

.npc-card-price .woocommerce-Price-amount {
  color: var(--npc-text);
  font-weight: 500;
}

.npc-signature {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  background: #f3f4f6;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 10px;
  color: var(--npc-text-muted);
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   Form section styles
   ============================================ */

.npc-form-section {
  margin: 24px 0;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--npc-border);
  border-radius: var(--npc-radius);
}

#npc-inputs-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 16px;
  margin-bottom: 8px;
}

#npc-inputs-container.npc-single-input {
  grid-template-columns: 1fr;
}

.npc-field {
  display: flex;
  flex-direction: column;
}

.npc-field label {
  font-size: 13px;
  color: var(--npc-text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.npc-input {
  height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--npc-border);
  border-radius: var(--npc-radius);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--npc-text);
  box-sizing: border-box;
  width: 100%;
  transition: border-color var(--npc-transition);
}

.npc-input:focus {
  outline: none;
  border-color: var(--npc-border-hover);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.npc-font-selector {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  min-width: 180px;
}

.npc-font-selector label {
  font-weight: 500;
  color: var(--npc-text);
  font-size: 12px;
}

.npc-font-select {
  padding: 10px 32px 10px 12px;
  border: 1px solid var(--npc-border);
  border-radius: 6px;
  font-size: 14px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 10px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  color: var(--npc-text);
  font-family: inherit;
}

.npc-font-select:focus {
  outline: none;
  border-color: var(--npc-border-hover);
}

.npc-clear-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.npc-clear-btn {
  padding: 6px 14px;
  border: 1px solid var(--npc-border);
  border-radius: var(--npc-radius);
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--npc-transition);
}

.npc-clear-btn:hover {
  background: #f5f5f5;
}

/* npc-card-stage already declared above with position:relative */

@media (max-width: 639px) {
  .npc-filters { flex-direction: column; gap: 12px; }
  #npc-inputs-container { grid-template-columns: 1fr; gap: 8px; }
  .npc-input { height: 36px; font-size: 13px; }
}

/* ============================================
   Modal overlay — /try-it-live/ only
   ============================================ */

.npc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.npc-modal-backdrop[hidden] {
  display: none;
}

.npc-modal {
  position: relative;
  background: #fff;
  border-radius: var(--npc-radius, 10px);
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.3);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.npc-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f3f4f6;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--npc-text, #111827);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--npc-transition, 200ms ease);
}

.npc-modal-close:hover {
  background: #e5e7eb;
}

.npc-modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--npc-text, #111827);
  padding-right: 40px;
}

.npc-modal-preview {
  display: flex;
  align-items: center;
  gap: 16px;
}

.npc-modal-preview-img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--npc-border, #e5e7eb);
  background: #f3f4f6;
  flex-shrink: 0;
}

.npc-modal-product-name {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--npc-text, #111827);
  line-height: 1.4;
}

.npc-modal-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.npc-modal-submit {
  padding: 11px 24px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--npc-transition, 200ms ease);
}

.npc-modal-submit:hover {
  background: #1d4ed8;
}

.npc-modal-submit:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .npc-modal {
    padding: 20px 16px 16px;
  }
  .npc-modal-preview-img {
    width: 72px;
    height: 72px;
  }
}
