/*
 * Recarga Barato Plugin Stylesheet
 * Versión Definitiva: 4.0.0
 * Contiene TODOS los estilos para Frontend y Backend.
*/

/* ============================================= */
/* 1. ESTILOS PARA EL FORMULARIO PÚBLICO (FRONTEND) */
/* ============================================= */

/* --- Contenedores Principales --- */
.rcb-app-wrapper {
    max-width: 800px;
    margin: 2em auto;
}
.rcb-app-container {
    position: relative; /* Contexto para el botón de contactos */
    background: #fff;
    border: 1px solid #e2e4e7;
    padding: 2em;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin-bottom: 2em;
}
#rcb-container-results {
    margin-top: 0;
    margin-bottom: 0;
}
.rcb-main-header {
    text-align: center; /* Centra el h2 */
    margin-bottom: 0.5em;
}
.rcb-app-container h2 { margin: 0; color: #1d2327; }
.rcb-app-container p { text-align: center; color: #50575e; margin-top: 0; }
.form-recarga .campo-telefono { max-width: 350px; margin-left: auto; margin-right: auto; display: flex; flex-direction: column; }
.form-recarga label { font-weight: 600; margin-bottom: 8px; color: #3c434a; }
.form-recarga input[type="tel"] { padding: 12px 15px; font-size: 1.2em; border: 1px solid #8c8f94; border-radius: 4px; transition: all 0.2s ease-in-out; }
.form-recarga input[type="tel"]:focus { border-color: #0073aa; box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.25); outline: none; }
.form-recarga input[type="tel"].is-valid { border-color: #28a745; box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25); }
.form-recarga input[type="tel"].is-invalid { border-color: #dc3545; box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25); }
.rcb-spinner { border: 4px solid #f3f3f3; border-top: 4px solid #2271b1; border-radius: 50%; width: 24px; height: 24px; animation: spin 1s linear infinite; margin: 1em auto 0 auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- Panel Lateral de Contactos --- */
#rcb-contacts-trigger { position: absolute; top: 1.8em; right: 2em; display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #ccc; padding: 8px 12px; border-radius: 5px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.2s; color: #3c434a; }
#rcb-contacts-trigger:hover { background-color: #f0f0f0; border-color: #999; }
#rcb-contacts-trigger svg { color: #50575e; }
#rcb-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 9998; opacity: 0; visibility: hidden; transition: opacity 0.3s ease-in-out, visibility 0.3s; }
#rcb-overlay.is-open { opacity: 1; visibility: visible; }
#rcb-contacts-panel { position: fixed; top: 0; right: 0; width: 340px; max-width: 90%; height: 100%; background-color: #f6f7f7; z-index: 9999; box-shadow: none; border-left: 1px solid #ddd; transform: translateX(100%); transition: transform 0.3s ease-in-out; display: flex; flex-direction: column; }
#rcb-contacts-panel.is-open { transform: translateX(0); }
#rcb-contacts-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid #e0e0e0; flex-shrink: 0; background-color: #fff; }
#rcb-contacts-panel-header h3 { margin: 0; font-size: 1.2em; }
.rcb-close-btn { background: none; border: none; font-size: 28px; cursor: pointer; color: #888; padding: 0 5px; line-height: 1; }
.rcb-close-btn:hover { color: #000; }
#rcb-contacts-panel-body { padding: 20px; overflow-y: auto; flex-grow: 1; }
#rcb-contacts-panel-body p { text-align: left; margin-top: 0; font-size: 0.9em; }
.rcb-contacts-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rcb-contacts-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; background-color: #ffffff; border: 1px solid #e0e0e0; border-radius: 5px; transition: all 0.2s ease-in-out; }
.rcb-contacts-list li:hover { border-color: #999; }
.rcb-contact-item { flex-grow: 1; padding: 10px 15px; color: #333; text-decoration: none; cursor: pointer; }
.rcb-contact-actions { display: flex; align-items: center; padding-right: 5px; }
.rcb-action-btn { background: none; border: none; cursor: pointer; padding: 8px; color: #787c82; border-radius: 50%; line-height: 0; transition: all 0.2s; }
.rcb-action-btn svg { display: block; }
.rcb-action-btn:hover { color: #2271b1; background-color: #f0f0f1; }
.rcb-contact-item .rcb-contact-name { display: block; font-weight: bold; }
.rcb-contact-item .rcb-contact-number { display: block; font-size: 0.9em; opacity: 0.8; }
#rcb-contacts-panel-footer { padding: 20px; background-color: #fff; border-top: 1px solid #e0e0e0; flex-shrink: 0; }
#rcb-add-contact-form h4 { margin-top: 0; margin-bottom: 15px; text-align: left; }
.rcb-form-row { margin-bottom: 10px; }
.rcb-form-row label { display: block; font-weight: bold; margin-bottom: 5px; font-size: 0.9em; }
.rcb-form-row input[type="text"], .rcb-form-row input[type="tel"] { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }
.rcb-form-row button { width: 100%; padding: 10px 15px; border-radius: 5px; font-weight: bold; cursor: pointer; border: 1px solid transparent; background-color: #2271b1; color: white; }
.rcb-feedback { padding: 10px; margin-top: 10px; border-radius: 4px; font-size: 0.9em; border: 1px solid transparent; text-align: center; }
.rcb-feedback.info { background-color: #f0f8ff; border-color: #b0c4de; color: #4682b4; }
.rcb-feedback.success { background-color: #dff0d8; border-color: #d6e9c6; color: #3c763d; }
.rcb-feedback.error { background-color: #f2dede; border-color: #ebccd1; color: #a94442; }

/* --- Área de Resultados y Tarjetas de Ofertas --- */
.rcb-tabs-nav { display: flex; flex-wrap: wrap; gap: 5px; border-bottom: 1px solid #ddd; margin-bottom: 1.5em; }
.rcb-operator-tab-button { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: none; background: transparent; border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; transition: all 0.2s; }
.rcb-operator-tab-button img { height: 24px; max-width: 80px; object-fit: contain; }
.rcb-operator-tab-button:hover { background-color: #f0f0f1; }
.rcb-operator-tab-button.active { border-bottom-color: #0073aa; font-weight: 600; background-color: #f6f7f7; }
.rcb-tab-button { padding: 10px 15px; border: none; background: transparent; cursor: pointer; font-size: 1em; font-weight: 500; color: #50575e; margin-bottom: -1px; border-bottom: 3px solid transparent; transition: all 0.2s; }
.rcb-tab-button.active { color: #2271b1; border-bottom-color: #2271b1; font-weight: 600; }
.rcb-tab-panel { display: none; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.5em; }
.rcb-tab-panel.active { display: grid; }
.rcb-offer-card { border: 1px solid #e2e4e7; border-radius: 6px; padding: 1.5em; padding-top: 3em; text-align: center; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.05); position: relative; transition: all 0.2s; display: flex; flex-direction: column; justify-content: space-between; }
.rcb-offer-card:hover { transform: translateY(-4px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.rcb-card-title { font-weight: 600; font-size: 1.1em; color: #1d2327; margin-bottom: 0.5em; flex-grow: 1; }
.rcb-card-price { font-size: 1.1em; margin-bottom: 1em; }
.rcb-price-original { text-decoration: line-through; color: #787c82; margin-right: 0.5em; }
.rcb-price-final { font-weight: 700; font-size: 1.4em; color: #0073aa; }
.rcb-badge { position: absolute; top: 10px; right: 10px; color: white; padding: 3px 8px; font-size: 0.75em; font-weight: bold; border-radius: 4px; }
.rcb-badge.discount { background-color: #d63638; }
.rcb-badge.promo { background-color: #5e35b1; }
.rcb-badge.upcoming { background-color: #ffc107; color: #212529; }
.rcb-offer-card.is-upcoming { opacity: 0.75; border-style: dashed; }
.rcb-offer-card.is-upcoming .rcb-price-final { color: #50575e; }
.rcb-card-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 15px; }
.rcb-add-to-cart-btn, .rcb-buy-now-btn { flex-grow: 1; padding: 10px 5px; border-radius: 5px; font-size: 14px; font-weight: bold; text-align: center; cursor: pointer; border: 2px solid #0073aa; transition: all 0.2s; line-height: 1; }
.rcb-buy-now-btn { background-color: #0073aa; color: #ffffff; }
.rcb-buy-now-btn:hover { background-color: #005a87; border-color: #005a87; }
.rcb-add-to-cart-btn { background-color: transparent; color: #0073aa; }
.rcb-add-to-cart-btn:hover { background-color: #0073aa; color: #ffffff; }
.rcb-add-to-cart-btn:disabled, .rcb-buy-now-btn:disabled { opacity: 0.7; cursor: not-allowed; background-color: #cccccc; border-color: #cccccc; color: #666666; }

/* ============================================= */
/* 2. ESTILOS PARA EL PANEL DE ADMINISTRACIÓN (BACKEND) */
/* ============================================= */
.rcb-cards-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px; margin-top: 20px; margin-bottom: 20px; }
.rcb-card { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 15px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.07); transition: box-shadow 0.2s ease-in-out; display: flex; flex-direction: column; justify-content: space-between; }
.rcb-card:hover { box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.rcb-card img, .rcb-card .rcb-card-logo { width: 100%; max-width: 120px; height: 70px; object-fit: contain; margin: 0 auto 10px auto; display: block; }
.rcb-card h4, .rcb-card .rcb-country-name { font-size: 1.1em; font-weight: bold; margin: 10px 0 5px 0; line-height: 1.3; min-height: 2.6em; flex-grow: 1; }
.rcb-card p, .rcb-card small, .rcb-card .rcb-country-code { font-size: 0.85em; color: #555; margin: 3px 0; word-wrap: break-word; }
.rcb-card label { display: block; margin-top: 15px; padding-top: 10px; border-top: 1px solid #eee; cursor: pointer; }
.rcb-card label input[type="checkbox"] { margin-right: 5px; vertical-align: middle; }
.rcb-provider-offers-group h3 { border-bottom: 2px solid #eee; padding-bottom: 5px; margin-top: 30px; margin-bottom: 15px; }
.rcb-stats-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
.rcb-stat-card { background: #fff; padding: 20px; border: 1px solid #ddd; border-left: 5px solid #0073aa; box-shadow: 0 1px 1px rgba(0,0,0,.04); }
.rcb-stat-card .label { font-size: 14px; color: #555; margin-bottom: 5px; }
.rcb-stat-card .value { font-size: 2.2em; font-weight: 600; color: #222; line-height: 1.2; }
.rcb-stats-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.rcb-chart-container { background: #fff; padding: 20px; border: 1px solid #ddd; box-shadow: 0 1px 1px rgba(0,0,0,.04); height: 450px; }
.rcb-status-badge { display: inline-block; padding: 2px 8px; font-size: 11px; font-weight: 700; line-height: 1.5; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: .25rem; color: #fff; text-transform: uppercase; }
.rcb-status-badge.status-completed { background-color: #28a745; }
.rcb-status-badge.status-failed { background-color: #dc3545; }
.rcb-status-badge.status-pending { background-color: #ffc107; color: #212529; }
.rcb-status-badge.status-processing { background-color: #17a2b8; }
.rcb-promo-badge { background-color: #6f42c1; color: #fff; padding: 1px 5px; font-size: 10px; border-radius: 3px; vertical-align: middle; margin-left: 5px; }
strong.profit-positive, span.profit-positive { color: #28a745; }
strong.profit-negative, span.profit-negative { color: #dc3545; }
.rcb-filters-wrapper { display: flex; flex-wrap: wrap; gap: 15px; align-items: flex-end; padding: 15px; background-color: #f6f7f7; border: 1px solid #ddd; margin-bottom: 20px; }
.rcb-filters-wrapper .filter-item { display: flex; flex-direction: column; }
.rcb-filters-wrapper .filter-item label { font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.rcb-filters-wrapper .filter-item input[type="text"], .rcb-filters-wrapper .filter-item input[type="date"], .rcb-filters-wrapper .filter-item select { min-width: 180px; }

/* ============================================= */
/* 3. MEDIA QUERIES (DISEÑO RESPONSIVO)          */
/* ============================================= */
@media (max-width: 782px) {
    .rcb-stats-charts { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .rcb-app-container { margin: 1em 10px; padding: 1.5em; }
    .rcb-tab-panel { grid-template-columns: 1fr; }
    #rcb-contacts-trigger { position: static; margin-top: 10px; display: flex; justify-content: center; width: 100%; }
}


.rcb-status-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: .25rem;
    color: #fff;
    text-transform: uppercase;
}

/* El estado 'Completed' que usa la función de sincronización */
.rcb-status-badge.status-completed { 
    background-color: #28a745; 
}

/* Los otros estados */
.rcb-status-badge.status-failed { background-color: #dc3545; }
.rcb-status-badge.status-pending { background-color: #ffc107; color: #212529; }
.rcb-status-badge.status-processing { background-color: #17a2b8; }

/* También agregué estos para cubrir todos los estados de WooCommerce */
.rcb-status-badge.status-on-hold { background-color: #ffc107; color: #212529; }
.rcb-status-badge.status-cancelled { background-color: #6c757d; }
.rcb-status-badge.status-refunded { background-color: #343a40; }

/* Estilo para el Precio de Venta Recomendado en el panel de Ofertas */
.rcb-recommended-price {
    background-color: #eef7ff; /* Un azul claro suave */
    border: 1px dashed #99c7f5;
    padding: 8px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 0.9em;
}

.rcb-recommended-price .rcb-label {
    font-weight: bold;
    color: #005a87;
}

.rcb-recommended-price .rcb-value strong {
    color: #1d2327;
}

/* --- Estilos para Icono de Información y Tooltip (Versión Corregida) --- */
.rcb-offer-card .rcb-card-info-icon-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
}

.rcb-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background-color: #a0aec0;
    color: white;
    border-radius: 50%;
    font-style: normal;
    font-weight: bold;
    font-size: 14px;
    cursor: help;
    user-select: none;
}

.rcb-card-info-icon-wrapper .rcb-tooltip {
    visibility: hidden;
    opacity: 0;
    width: 520px; /* --- AUMENTADO --- */
    max-width: 90vw; /* Evita que se salga de la pantalla en móviles */
    background-color: #2d3748;
    color: #fff;
    text-align: left;
    white-space: normal; /* Permite que el texto se divida en múltiples líneas */
    border-radius: 6px;
    padding: 10px 15px;
    position: absolute;
    z-index: 10;
    bottom: 125%; 
    left: 50%;
    transform: translateX(-50%); /* --- MEJORADO: Centra el tooltip sobre el icono --- */
    transition: opacity 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 13px;
    line-height: 1.5;
}

.rcb-card-info-icon-wrapper .rcb-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #2d3748 transparent transparent transparent;
}

.rcb-card-info-icon-wrapper:hover .rcb-tooltip {
    visibility: visible;
    opacity: 1;
}