/* =========================
   CrossSell Mailer — Admin UI (WC-like)
   ========================= */

/* Lienzo */
.ppcr-wrap { max-width: 1120px; }
.ppcr-wrap .wp-heading-inline { display:flex; align-items:center; gap:.5rem; }

/* Tarjeta de regla */
.ppcr-rule {
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:12px;
  margin:16px 0;
  box-shadow:0 1px 0 rgba(16,24,40,.03);
}
.ppcr-rule__header{
  display:flex; flex-wrap:wrap; align-items:center; gap:10px;
  padding:12px 14px;
  border-bottom:1px solid #eef2f7;
  background:#fafafa;
  border-radius:12px 12px 0 0;
}
.ppcr-rule__title{ margin-right:6px; }
.ppcr-toggle { display:inline-flex; align-items:center; gap:8px; }
.ppcr-remove,.ppcr-delete{ color:#b91c1c; }

/* Cuerpo */
.ppcr-body{ padding:14px; }

/* ------------ Estilo WooCommerce: 2 columnas por fila ------------ */
.ppcr-grid { display:block; } /* contenedor */
.ppcr-grid > p{
  display:grid;
  grid-template-columns: 240px 1fr; /* etiqueta izquierda, control derecha */
  align-items:center;
  column-gap:16px;
  row-gap:8px;
  margin:0 0 14px 0;
}
.ppcr-grid > p > label{
  display:block;
  font-weight:600;
  color:#1f2937;
  margin:0;                 /* sin margen extra */
  line-height:1.25;
}
.ppcr-required{ color:#ef4444; font-weight:700; margin-left:4px; }

/* Controles a ancho completo en su columna */
.ppcr-grid input[type="text"],
.ppcr-grid input[type="number"],
.ppcr-grid input[type="email"],
.ppcr-grid select,
.ppcr-grid textarea{
  width:100%;
  box-sizing:border-box;
  margin:0;
}

/* Alturas homogéneas de inputs/select (como WP) */
.ppcr-grid input[type="text"],
.ppcr-grid input[type="number"],
.ppcr-grid input[type="email"],
.ppcr-grid select{
  height:32px;
  padding:3px 8px;
}

/* Textarea cómodo */
.ppcr-grid textarea{ min-height:110px; padding:8px; }

/* Select2/SelectWoo igual altura y 100% */
.select2-container{ width:100% !important; }
.select2-container .select2-selection--single{ height:32px; border-color:#8c8f94; }
.select2-container--default .select2-selection--single .select2-selection__rendered{ line-height:30px; padding-left:8px; }
.select2-container--default .select2-selection--single .select2-selection__arrow{ height:30px; }

/* Evitar “bailes” de number */
.ppcr-grid input[type="number"]::-webkit-outer-spin-button,
.ppcr-grid input[type="number"]::-webkit-inner-spin-button{ margin:0; }
.ppcr-grid input[type="number"]{ -moz-appearance:textfield; }

/* Bloque email */
.ppcr-email{ margin-top:10px; padding-top:12px; border-top:1px dashed #e2e8f0; }
.ppcr-email-row{ margin-bottom:10px; }
.ppcr-tokenbar{ display:flex; flex-wrap:wrap; gap:6px; }

/* Estado vacío */
.ppcr-empty{
  padding:12px; border:1px dashed #cbd5e1; border-radius:10px;
  background:#f8fafc; color:#334155;
}

/* Colapsables */
.ppcr-rule.is-collapsed .ppcr-body{ display:none; }
.ppcr-bulk-toggles{ margin:8px 0 6px; color:#64748b; }
.ppcr-bulk-toggles .button-link{ margin-right:8px; }
.ppcr-rule__header .ppcr-toggle-body{ margin-left:auto; display:inline-flex; align-items:center; gap:6px; }
.ppcr-toggle-body .dashicons{ transition:transform .15s ease; }
.ppcr-rule.is-collapsed .ppcr-toggle-body .dashicons{ transform:rotate(180deg); }

/* Responsive: a 1 columna en pantallas estrechas */
@media (max-width: 980px){
  .ppcr-grid > p{
    grid-template-columns: 1fr;
    align-items:start;
  }
  .ppcr-grid > p > label{ margin-bottom:6px; }
}


.ppcr-lite-badge{
  margin-left:8px;
  display:inline-block;
  padding:2px 6px;
  background:#e0f2fe;
  color:#0369a1;
  border-radius:6px;
  font-weight:600;
  vertical-align:middle;
}


/* Commercial polish: quick setup + coupon log */
.ppcr-onboarding,
.ppcr-log {
    margin-top: 18px;
    padding: 18px 20px;
    border-radius: 10px;
    border: 1px solid #dcdcde;
    background: #fff;
}

.ppcr-onboarding__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.ppcr-onboarding__header h2,
.ppcr-log h2 {
    margin: 0 0 6px;
}

.ppcr-onboarding__header p,
.ppcr-log p {
    margin: 0 0 12px;
    color: #50575e;
}

.ppcr-onboarding__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 8px 10px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
}

.ppcr-onboarding__steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.ppcr-onboarding__step {
    display: flex;
    gap: 10px;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}

.ppcr-onboarding__step.is-done {
    border-color: #86efac;
    background: #f0fdf4;
}

.ppcr-onboarding__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 700;
}

.ppcr-onboarding__step.is-done .ppcr-onboarding__icon {
    background: #22c55e;
    color: #fff;
}

.ppcr-onboarding__step p {
    margin: 4px 0 0;
    color: #646970;
}

.ppcr-log-table td,
.ppcr-log-table th {
    vertical-align: middle;
}

@media (max-width: 1100px) {
    .ppcr-onboarding__steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .ppcr-onboarding__steps {
        grid-template-columns: 1fr;
    }
}

.ppcr-email-preview {
    position: relative;
    z-index: 1;
}

.ppcr-email-preview summary {
    cursor: pointer;
    display: inline-block;
}

.ppcr-email-preview[open] {
    position: relative;
    z-index: 5;
}

.ppcr-email-preview__subject {
    margin: 10px 0 8px;
    max-width: 680px;
}

.ppcr-email-preview__frame {
    width: 100%;
    height: 500px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f7f7f7;
}


@media (max-width: 900px) {
    .ppcr-email-preview__frame {
        width: 86vw;
        height: 480px;
    }
}
.ppcr-email-preview__subject {
    font-size: 13px;
    margin-bottom: 8px;
    color: #555;
}
/* =========================
   Coupon log
========================= */

.ppcr-log-scroll {
    max-height: 520px;
    overflow-y: auto;
    border: 1px solid #ccd0d4;
    background: #fff;
    border-radius: 4px;
}

.ppcr-log-scroll table {
    margin: 0;
    border: 0;
}

.ppcr-log-table {
    width: 100%;
    border-collapse: collapse;
}

.ppcr-log-table th,
.ppcr-log-table td {
    vertical-align: middle;
    padding: 10px 12px;
}

.ppcr-log-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f6f7f7;
}

.ppcr-log-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.ppcr-log-actions .button {
    line-height: 24px;
    min-height: 24px;
    padding: 0 10px;
}

.ppcr-log-table td a {
    text-decoration: none;
}

.ppcr-log-table td a:hover {
    text-decoration: underline;
}

/* =========================
   Notices
========================= */

.notice.ppcr-notice {
    margin-top: 15px;
}

/* =========================
   Responsive
========================= */

@media screen and (max-width: 782px) {

    .ppcr-log-scroll {
        overflow-x: auto;
    }

    .ppcr-log-table {
        min-width: 760px;
    }

    .ppcr-log-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .ppcr-log-actions .button {
        width: 100%;
        text-align: center;
    }
}
/* ---------- Results panel (1.2.0) ---------- */
.ppcr-stats {
    margin-top: 18px;
    padding: 18px 20px;
    border-radius: 10px;
    border: 1px solid #dcdcde;
    background: #fff;
}
.ppcr-stats__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.ppcr-stats__header h2 { margin: 0; }
.ppcr-stats__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.ppcr-stats__tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}
.ppcr-stats__tile.is-highlight {
    border-color: #7dd3fc;
    background: #f0f9ff;
}
.ppcr-stats__label {
    font-size: 12px;
    color: #50575e;
}
.ppcr-stats__value {
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}
.ppcr-stats__tile.is-highlight .ppcr-stats__value { color: #0369a1; }
.ppcr-stats__note { margin: 12px 0 0; }
.ppcr-test-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
@media (max-width: 960px) {
    .ppcr-stats__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.ppcr-stack { display:flex; flex-direction:column; gap:6px; }

/* Email preview */
.ppcr-test-row .dashicons { vertical-align:text-bottom; font-size:16px; width:16px; height:16px; }
.ppcr-preview { width:min(760px, 94vw); height:min(86vh, 900px); padding:0; border:0; border-radius:12px; box-shadow:0 20px 60px rgba(15,23,42,.35); overflow:hidden; }
.ppcr-preview[open] { display:flex; flex-direction:column; }
.ppcr-preview::backdrop { background:rgba(15,23,42,.55); }
.ppcr-preview__bar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 16px; border-bottom:1px solid #e5e7eb; background:#f9fafb; }
.ppcr-preview__subject { margin:0; padding:10px 16px; color:#334155; border-bottom:1px solid #f1f5f9; }
.ppcr-preview__frame { flex:1; width:100%; border:0; background:#f6f7f7; }
