/* ==========================================================================
   WooCommerce Bancaribe Gateway — Estilos principales
   Inspirado en Material UI (MUI) / Material Design
   ========================================================================== */

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
    --bcb-primary:         #1976d2;
    --bcb-primary-dark:    #115293;
    --bcb-primary-light:   #e3f2fd;
    --bcb-primary-hover:   rgba(25, 118, 210, 0.08);
    --bcb-text-primary:    rgba(0, 0, 0, 0.87);
    --bcb-text-secondary:  rgba(0, 0, 0, 0.6);
    --bcb-border:          rgba(0, 0, 0, 0.23);
    --bcb-radius:          4px;
    --bcb-transition:      0.2s ease;
    --bcb-shadow-sm:       0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

/* ==========================================================================
   CHECKOUT — Formulario de pago
   ========================================================================== */

/* ── Logo del gateway ──────────────────────────────────────────────────── */
.bcb-gateway-logo {
    display: block;
    width: 50%;
    max-width: 240px;
    margin-bottom: 8px;
}

/* ── Tabs del formulario de pago ───────────────────────────────────────── */
.bcb-checkout-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--bcb-border);
}

.bcb-checkout-tab {
    position: relative;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bcb-text-secondary);
    background: transparent;
    border-radius: var(--bcb-radius) var(--bcb-radius) 0 0;
    transition: color var(--bcb-transition), background var(--bcb-transition);
    user-select: none;
}

/* Indicador inferior — se anima al tab activo */
.bcb-checkout-tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: background var(--bcb-transition);
    border-radius: 2px 2px 0 0;
}

.bcb-checkout-tab:hover {
    background: var(--bcb-primary-hover);
    color: var(--bcb-primary);
}

.bcb-checkout-tab.bcb-active {
    color: var(--bcb-primary);
}

.bcb-checkout-tab.bcb-active::after {
    background: var(--bcb-primary);
}

/* ── Paneles de contenido ──────────────────────────────────────────────── */
.bcb-checkout-panel {
    display: none;
}

.bcb-checkout-panel.bcb-active {
    display: block;
}

/* Clearfix para contener los form-row flotados de WooCommerce */
.bcb-checkout-panel::after {
    content: '';
    display: table;
    clear: both;
}

/* ── Caja informativa (datos del beneficiario) ─────────────────────────── */
.bcb-info-box {
    background: var(--bcb-primary-light);
    border-left: 3px solid var(--bcb-primary);
    border-radius: 0 var(--bcb-radius) var(--bcb-radius) 0;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    line-height: 1.8;
    color: var(--bcb-text-primary);
}

.bcb-info-box p {
    margin-top: 0 !important;
    margin-bottom: 8px;
}

/* ── Corrección de ancho y alto para selects dentro del gateway ─────────── */
.bcb-checkout-panel .woocommerce-input-wrapper select {
    width: 100% !important;
    height: auto !important;
    min-height: 45px !important;
    padding: 10px 12px !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
}

/* ── Campos siempre a ancho completo, sin columnas ─────────────────────── */
.bcb-checkout-panel .form-row-first,
.bcb-checkout-panel .form-row-last {
    float: none !important;
    width: 100% !important;
    margin-right: 0 !important;
}

/* ── Normalizar color de labels en checkout clásico (shortcode) ─────────── */
#payment .payment_method_bancaribe_p2p .form-row label,
#payment .payment_method_bancaribe_p2p .form-row abbr.required {
    color: var(--bcb-text-primary) !important;
}

/* ==========================================================================
   ADMIN — Página de configuración del gateway
   ========================================================================== */

/* ── Tabs de configuración ─────────────────────────────────────────────── */
.bancaribe-tab-content           { display: none; }
.bancaribe-tab-content.is-active { display: block; }

.woocommerce_page_wc-settings .nav-tab { cursor: pointer; }

/* ── Títulos de sección dentro del tab ─────────────────────────────────── */
.bancaribe-section-title {
    font-size: 1em;
    font-weight: 600;
    margin: 28px 0 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #c3c4c7;
    color: #1d2327;
}

/* ── Encabezado de la sección auditoría ────────────────────────────────── */
.bancaribe-audit-count {
    margin-left: 8px;
    font-weight: 400;
    font-size: 0.9em;
    color: var(--bcb-text-secondary);
}

/* ==========================================================================
   ADMIN — Tabla de Auditoría (estilo MUI)
   ========================================================================== */

/* Contenedor tarjeta */
.bancaribe-audit-wrap {
    background: #fff;
    border-radius: var(--bcb-radius);
    box-shadow: var(--bcb-shadow-sm);
    overflow-x: auto;
    margin-top: 8px;
}

/* Tabla */
.bancaribe-audit-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.875rem;
}

/* Cabecera */
.bancaribe-audit-table thead tr {
    border-bottom: 1px solid rgba(224, 224, 224, 1);
}

.bancaribe-audit-table th {
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bcb-text-secondary);
    text-align: left;
    white-space: nowrap;
    background: #fff;
}

/* Celdas */
.bancaribe-audit-table td {
    padding: 14px 16px;
    color: var(--bcb-text-primary);
    border-bottom: 1px solid rgba(224, 224, 224, 0.8);
    vertical-align: middle;
    line-height: 1.5;
}

.bancaribe-audit-table tbody tr:last-child td {
    border-bottom: none;
}

.bancaribe-audit-table tbody tr:hover td {
    background: rgba(0, 0, 0, 0.03);
    cursor: default;
}

/* ── Chips de estado ───────────────────────────────────────────────────── */
.bancaribe-chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

.bancaribe-chip-ok {
    color: #1b5e20;
    background: #e8f5e9;
}

.bancaribe-chip-error {
    color: #b71c1c;
    background: #ffebee;
}

.bancaribe-chip-pendiente {
    color: #006064;
    background: #e0f7fa;
}

/* ── Estado vacío ──────────────────────────────────────────────────────── */
.bancaribe-audit-empty {
    padding: 24px 16px;
    color: var(--bcb-text-secondary);
    font-size: 0.875rem;
}

/* ── Paginación ────────────────────────────────────────────────────────── */
.bancaribe-audit-pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 16px;
    border-top: 1px solid rgba(224, 224, 224, 0.8);
}

.bancaribe-audit-pagination a,
.bancaribe-audit-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--bcb-radius);
    font-size: 0.875rem;
    text-decoration: none;
    color: var(--bcb-text-primary);
    transition: background var(--bcb-transition), color var(--bcb-transition);
}

.bancaribe-audit-pagination a:hover {
    background: var(--bcb-primary-hover);
    color: var(--bcb-primary);
}

.bancaribe-audit-pagination .current {
    background: var(--bcb-primary);
    color: #fff;
    font-weight: 600;
    pointer-events: none;
}

/* ── Link "Ver" en celdas de auditoría ─────────────────────────────────── */
.bcb-json-view {
    color: var(--bcb-primary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
}

.bcb-json-view:hover {
    text-decoration: underline;
}

/* ── Modal de JSON ─────────────────────────────────────────────────────── */
.bcb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.bcb-modal {
    background: #fff;
    border-radius: var(--bcb-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
    width: 560px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.bcb-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(224, 224, 224, 1);
    font-size: 0.9rem;
}

.bcb-modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--bcb-text-secondary);
    padding: 0 4px;
}

.bcb-modal-close:hover {
    color: var(--bcb-text-primary);
}

.bcb-modal-body {
    padding: 16px 20px;
    overflow: auto;
}

.bcb-modal-body pre {
    margin: 0;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--bcb-text-primary);
    line-height: 1.6;
}
