/* ──────────────────────────────────────────────────────────────────────────────
   PRAXMA Affiliates — Public CSS
   Paleta: Slate oscuro (#0f172a) + Verde éxito (#16a34a) + Fondo limpio (#f8fafc)
   ────────────────────────────────────────────────────────────────────────────── */

/* ── Reset y base ────────────────────────────────────────────────────────── */
.praxma-aff-wrap *,
.praxma-aff-wrap *::before,
.praxma-aff-wrap *::after {
    box-sizing: border-box;
}

.praxma-aff-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    color: #1e293b;
    line-height: 1.6;
    max-width: 860px;
    margin: 0 auto;
}

/* ── Tabs principales ────────────────────────────────────────────────────── */
.praxma-aff-tabs {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 32px;
    gap: 0;
}

.praxma-aff-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: color .2s, border-color .2s;
}

.praxma-aff-tab:hover {
    color: #0f172a;
}

.praxma-aff-tab.active {
    color: #0f172a;
    border-bottom-color: #0f172a;
}

.praxma-aff-panel {
    display: none;
}

.praxma-aff-panel.active {
    display: block;
}

/* ── Formulario compartido ───────────────────────────────────────────────── */
.praxma-aff-form-wrap {
    max-width: 480px;
    margin: 0 auto;
}

.praxma-aff-form-header {
    text-align: center;
    margin-bottom: 28px;
}

.praxma-aff-form-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px;
}

.praxma-aff-form-header p {
    color: #64748b;
    margin: 0;
    font-size: 14px;
}

.praxma-aff-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.praxma-aff-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.praxma-aff-field label {
    font-weight: 600;
    font-size: 13px;
    color: #374151;
}

.praxma-aff-field input {
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 15px;
    color: #0f172a;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}

.praxma-aff-field input:focus {
    outline: none;
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15,23,42,.08);
}

.praxma-aff-field input.praxma-otp-input {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 10px;
    font-family: monospace;
}

.praxma-req     { color: #dc2626; }
.praxma-optional { color: #94a3b8; font-weight: 400; font-size: 12px; }

/* ── Botones ─────────────────────────────────────────────────────────────── */
.praxma-aff-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: background .15s, color .15s, border-color .15s, opacity .15s;
    text-decoration: none;
}

.praxma-aff-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.praxma-aff-btn--primary {
    background: #0f172a;
    color: #fff;
    width: 100%;
}

.praxma-aff-btn--primary:hover:not(:disabled) {
    background: #1e293b;
}

.praxma-aff-btn--ghost {
    background: transparent;
    color: #64748b;
    border-color: #e2e8f0;
    width: 100%;
    margin-top: 8px;
}

.praxma-aff-btn--ghost:hover:not(:disabled) {
    color: #0f172a;
    border-color: #94a3b8;
}

.praxma-aff-btn--outline {
    background: transparent;
    color: #0f172a;
    border-color: #0f172a;
}

.praxma-aff-btn--outline:hover:not(:disabled) {
    background: #0f172a;
    color: #fff;
}

.praxma-aff-btn--success {
    background: #16a34a;
    color: #fff;
}

.praxma-aff-btn--success:hover:not(:disabled) {
    background: #15803d;
}

.praxma-aff-btn--sm {
    padding: 7px 14px;
    font-size: 13px;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.praxma-aff-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.praxma-aff-alert--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.praxma-aff-alert--success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* ── Estado de éxito en registro ─────────────────────────────────────────── */
.praxma-aff-success-state {
    text-align: center;
    padding: 40px 20px;
}

.praxma-aff-success-icon {
    width: 64px;
    height: 64px;
    background: #f0fdf4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: #16a34a;
}

.praxma-aff-success-icon svg {
    width: 32px;
    height: 32px;
}

.praxma-aff-success-state h3 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 10px;
}

.praxma-aff-success-state p {
    color: #64748b;
    font-size: 14px;
    margin: 0;
}

/* ── Dashboard: encabezado ───────────────────────────────────────────────── */
.praxma-aff-dash-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.praxma-aff-dash-greeting {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.praxma-aff-dash-name {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.praxma-aff-dash-coupon-label {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.praxma-aff-coupon-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 14px;
    margin-top: 2px;
}

.praxma-aff-coupon-badge code {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #0f172a;
    background: none;
    font-family: 'Courier New', monospace;
}

.praxma-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b;
    padding: 2px;
    display: flex;
    align-items: center;
    transition: color .15s;
}

.praxma-copy-btn:hover { color: #0f172a; }

/* ── Dashboard: resumen de comisiones ────────────────────────────────────── */
.praxma-aff-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.praxma-aff-summary-card {
    border-radius: 10px;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid;
}

.praxma-aff-summary-card--process {
    background: #fffbeb;
    border-color: #fde68a;
}

.praxma-aff-summary-card--available {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.praxma-aff-summary-card--paid {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.praxma-summary-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
}

.praxma-summary-amount {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.praxma-summary-count {
    font-size: 12px;
    color: #94a3b8;
}

/* ── Info alert ──────────────────────────────────────────────────────────── */
.praxma-aff-alert--info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.praxma-aff-alert--warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
    font-size: 13px;
}

/* ── Código de afiliado: campo con validación ────────────────────────────── */
.praxma-aff-code-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.praxma-aff-code-wrap input {
    flex: 1;
}

.praxma-code-status {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 110px;
}

.praxma-code-status--ok    { color: #16a34a; }
.praxma-code-status--error { color: #dc2626; }

.praxma-aff-field-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.5;
}

/* ── Botón extra pequeño ─────────────────────────────────────────────────── */
.praxma-aff-btn--xs {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    width: auto;
    margin-top: 6px;
}

/* ── Panel cambio de código ──────────────────────────────────────────────── */
.praxma-change-code-panel {
    margin-top: 12px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    max-width: 420px;
}

.praxma-change-code-panel .praxma-aff-alert--warning {
    margin-bottom: 0;
    border-radius: 6px;
}
.praxma-aff-payout-box {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.praxma-aff-payout-box__info strong {
    display: block;
    color: #0f172a;
    margin-bottom: 4px;
}

.praxma-aff-payout-box__info p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.praxma-aff-payout-box__form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 220px;
}

.praxma-payout-method-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.praxma-payout-select {
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    color: #0f172a;
    background: #fff;
    cursor: pointer;
    width: 100%;
}

.praxma-payout-select:focus {
    outline: none;
    border-color: #0f172a;
}

.praxma-payout-detail {
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    color: #0f172a;
    background: #fff;
    width: 100%;
    transition: border-color .15s;
}

.praxma-payout-detail:focus {
    outline: none;
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15,23,42,.06);
}

.praxma-aff-payout-box__form .praxma-aff-btn {
    width: 100%;
}

/* ── Sub-tabs internos ───────────────────────────────────────────────────── */
.praxma-aff-inner-tabs {
    display: flex;
    border-bottom: 1.5px solid #e2e8f0;
    margin-bottom: 24px;
    gap: 0;
}

.praxma-aff-inner-tab {
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -1.5px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: color .15s, border-color .15s;
}

.praxma-aff-inner-tab:hover { color: #0f172a; }
.praxma-aff-inner-tab.active {
    color: #0f172a;
    border-bottom-color: #0f172a;
}

.praxma-aff-inner-panel { display: none; }
.praxma-aff-inner-panel.active { display: block; }

/* ── Productos ───────────────────────────────────────────────────────────── */
.praxma-aff-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.praxma-aff-product-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow .2s;
}

.praxma-aff-product-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
}

.praxma-aff-product-img {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #f1f5f9;
}

.praxma-aff-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.praxma-aff-product-img--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.praxma-aff-product-body {
    padding: 16px;
}

.praxma-aff-product-name {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px;
    line-height: 1.3;
}

.praxma-aff-product-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 14px;
    line-height: 1.5;
}

.praxma-aff-product-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
}

.praxma-aff-product-meta-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.praxma-meta-label {
    font-size: 12px;
    color: #94a3b8;
}

.praxma-meta-value {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.praxma-meta-value--discount {
    color: #d97706;
    background: #fef3c7;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
}

.praxma-meta-value--commission {
    color: #16a34a;
    font-size: 16px;
}

.praxma-aff-product-actions {
    display: flex;
    gap: 8px;
}

.praxma-aff-product-actions .praxma-aff-btn {
    flex: 1;
}

/* ── Historial de comisiones ─────────────────────────────────────────────── */
.praxma-aff-history-table-wrap {
    overflow-x: auto;
}

.praxma-aff-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.praxma-aff-history-table th {
    text-align: left;
    padding: 10px 14px;
    background: #0f172a;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.praxma-aff-history-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
    vertical-align: middle;
}

.praxma-aff-history-table tr:last-child td {
    border-bottom: none;
}

.praxma-aff-history-table tr:hover td {
    background: #f8fafc;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.praxma-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.praxma-badge--warning  { background: #fef3c7; color: #92400e; }
.praxma-badge--success  { background: #dcfce7; color: #166534; }
.praxma-badge--info     { background: #dbeafe; color: #1e40af; }
.praxma-badge--paid     { background: #e0e7ff; color: #3730a3; }
.praxma-badge--danger   { background: #fee2e2; color: #991b1b; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.praxma-aff-empty,
.praxma-aff-empty-text {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    font-size: 14px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .praxma-aff-summary-grid {
        grid-template-columns: 1fr;
    }

    .praxma-aff-dash-header {
        flex-direction: column;
    }

    .praxma-aff-payout-box {
        flex-direction: column;
        text-align: center;
    }

    .praxma-aff-payout-box .praxma-aff-btn {
        width: 100%;
    }

    .praxma-aff-tab {
        font-size: 13px;
        padding: 12px 10px;
    }

    .praxma-aff-products-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Password field con toggle ───────────────────────────────────────────── */
.praxma-aff-password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.praxma-aff-password-wrap input {
    padding-right: 44px !important;
    width: 100%;
}

.praxma-toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color .15s;
}

.praxma-toggle-password:hover { color: #0f172a; }

/* ── Link button ─────────────────────────────────────────────────────────── */
.praxma-link-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color .15s;
}

.praxma-link-btn:hover { color: #0f172a; }
