/*
 * Stylesheet documented for readability and maintenance.
 */

body.modal-open {
  overflow: hidden;
}
/* Overlay */
.cppt-pp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 99998;
  backdrop-filter: blur(3px);
}
/* Modal container */
.cppt-pp-modal {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  max-width: 960px;
  width: 94%;
  max-height: 90vh;
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  z-index: 99999;
  font-family: system-ui, sans-serif;
}

/* Conteúdo interno */
.cppt-pp-modal-inner {
  position: relative;
  padding: 24px 26px 20px;
}

/* Modal title */
#cppt-pp-modal-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 600;
  color: #0f172a;
}

/* Subtitle/description text (optional) */
.cppt-pp-modal-inner > p.cppt-pp-subtitle {
  margin: 2px 0 14px;
  color: #64748b;
  font-size: 13px;
}

/* Botão de fechar */
.cppt-pp-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: black;
  padding: 10px;
  transition: color 0.15s ease, background 0.15s ease;
  border-radius: 999px;
}

.cppt-pp-modal-close:hover {
  color: #0f172a;
  background: #e5e7eb;
}

/* Increment section numbers */
.cppt-pp-grid {
  counter-reset: sec;
}

.cppt-pp-grid .cppt-pp-section h3 {
  counter-increment: sec;
}

.cppt-pp-grid .cppt-pp-section h3::before {
  content: counter(sec) ". ";
}

/* Grid 2x2 mais consistente */
.cppt-pp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 18px 20px;
  margin-top: 18px;
}

/* Card de cada seção */
.cppt-pp-section {
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Header da seção */
.cppt-pp-section h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Labels dentro das seções */
.cppt-pp-section label {
  font-size: 12px;
  font-weight: 500;
  color: black;
  margin-bottom: 4px;
  display: block;
}

/* Campos: select, textarea, file */
.cppt-pp-section select,
.cppt-pp-section textarea,
.cppt-pp-section input[type="text"],
.cppt-pp-section input[type="url"],
.cppt-pp-section input[type="file"] {
  width: 100%;
  font-size: 13px;
  border-radius: 9px;
  border: 1px solid rgb(182, 182, 182);
  padding: 8px 10px;
  color: #111827;
  background-color: #ffffff;
  box-shadow: 0 0 0 1px transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease;
}

.cppt-pp-section select:focus,
.cppt-pp-section textarea:focus,
.cppt-pp-section input[type="text"]:focus,
.cppt-pp-section input[type="url"]:focus,
.cppt-pp-section input[type="file"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
  background-color: #ffffff;
}

/* Placeholder / textos auxiliares */
.cppt-pp-section textarea::placeholder {
  color: #9ca3af;
}

/* Textarea mais bonitinha */
.cppt-pp-section textarea {
  min-height: 90px;
  resize: vertical;
}

/* Preview thumbnail for the selected print location */
.cppt-pp-location-preview {
  margin-top: 6px;
  border-radius: 10px;
  border: 1px dashed #e5e7eb;
  background: #f3f4f6;
  padding: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cppt-pp-location-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
}

/* Small helper note under the "Add to product" button */
.cppt-pp-note {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #4b5563;
}

/* Modal footer (action buttons row) */
.cppt-pp-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  gap: 10px;
}

/* Generic buttons inside the modal */
/* .cppt-pp-modal-footer .button,
.cppt-pp-modal-inner .button {
  border-radius: 999px;
  font-size: 13px;
  padding: 8px 16px;
  border-width: 1px;
  border-style: solid;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease,
    transform 0.1s ease;
} */

.woocommerce form.cart .cppt-pp-open-modal {
  width: fit-content;
  color: #ffffff;
  background-color: #f26a44;
  border-radius: 10px;
}

.woocommerce form.cart .cppt-pp-open-modal:hover {
  color: #ffffff;
  background-color: #c25638;
}

/* Primary action button (Add/Update personalization) */
.cppt-pp-modal-footer .button-primary.cppt-pp-add-personalization {
  background: #f26a44;
  border-color: transparent;
  color: #ffffff;
  font-weight: 600;
  border-radius: 0;
}

.cppt-pp-modal-footer .button-primary.cppt-pp-add-personalization:hover {
  background: #c25638;
  color: #ffffff;
}

/* Secondary button (reset all fields) */
.cppt-pp-modal-footer .button.cppt-pp-reset-fields {
  background: #e9e6ed;
  border-color: transparent;
  color: #515151;
  font-weight: 600;
  border-radius: 0;
}

.cppt-pp-modal-footer .button.cppt-pp-reset-fields:hover {
  background: #dcd7e2;
  color: #000000;
}

/* Error message container – controlled by JS */
.cppt-pp-error {
  margin-top: 14px;
  padding: 10px 12px;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid #fecaca;
  display: none; /* o JS controla o show/hide */
}

/* "Personalized: Yes | Details" line in the cart */
.cppt-pp-personalized-line {
  margin-bottom: 6px;
  font-size: 13px;
  color: #374151;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.cppt-pp-personalized-label strong {
  font-weight: 600;
  color: #111827;
}

.cppt-pp-personalized-yes {
  color: #16a34a;
  font-weight: 500;
}

.cppt-pp-personalized-sep {
  color: #9ca3af;
}

a.cppt-pp-personalized-details-classic {
  text-decoration: underline;
}

.cppt-pp-personalized-details {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.cppt-pp-personalized-details {
  text-decoration: underline;
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .cppt-pp-modal {
    max-width: 100%;
    width: 100%;
    inset: 50% auto auto 50%;
    border-radius: 16px;
  }

  .cppt-pp-modal-inner {
    padding: 18px 16px 16px;
  }

  .cppt-pp-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .cppt-pp-section {
    padding: 12px 12px 10px;
  }
}

/* Hide plugin meta rows when details are disabled in the cart */
.cppt-pp-hidden-meta {
  display: none !important;
}

/* Cart: variation meta layout */

.cart-product-meta dl.variation {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 5px;
}

.cart-product-meta dl.variation dt {
  font-weight: 600;
}

.cart-product-meta dl.variation dt,
.cart-product-meta dl.variation dd {
  margin: 0;
}

/* Checkout: variation meta styling */
.woocommerce-checkout-review-order-table dl.variation {
  color: gray;
  font-size: 12px;
  line-height: 160%;
}

.woocommerce-checkout-review-order-table dd:first-of-type {
  color: green;
}

/* Lightbox used to preview artwork files */
.cppt-pp-artwork-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 99999;
  display: none;
  padding: 2rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cppt-pp-artwork-lightbox-inner {
  position: relative;
  width: fit-content;
  height: fit-content;
}

.cppt-pp-artwork-lightbox-content img {
  max-width: 100%;
  height: 100%;
  width: 100%;
  display: block;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  background: #111827;
}

.cppt-pp-artwork-lightbox-close {
  position: absolute;
  top: -10px;
  right: -30px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

body.cppt-pp-artwork-lightbox-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .cppt-pp-modal {
    /* max-width: 960px; */
    width: 92%;
  }

  .cppt-pp-location-preview img {
    max-width: 100%;
    max-height: 100px;
    border-radius: 8px;
  }
}
