/* =============================================================================
   SABORA · MÓDULO DE WHATSAPP
   -----------------------------------------------------------------------------
   Extraído de los bloques <style> que vivían dentro de los .razor. Se conserva
   el origen de cada tramo para poder seguir migrándolo a componentes.
   ========================================================================== */

/* ----------------------------------------------------------------------------
   Pages/Whatsapp/WhatsappIaConfiguracion.razor
   -------------------------------------------------------------------------- */
    .wa-ia-card-box {
        background: var(--sb-neutral-0);
        border: 1px solid var(--sb-neutral-200);
        border-radius: 18px;
        padding: 24px;
        box-shadow: 0 2px 10px rgba(18, 26, 44, .04);
        margin-bottom: 20px;
    }
    .wa-ia-card-box h3 {
        margin: 0 0 6px;
        font-size: 0.8rem;
        font-weight: 900;
        color: var(--sb-neutral-500);
        text-transform: uppercase;
        letter-spacing: .6px;
    }
    .wa-ia-card-box .sub {
        margin: 0 0 18px;
        color: var(--sb-neutral-400);
        font-size: 0.84rem;
        line-height: 1.5;
    }
    .wa-toggle-group {
        display: flex;
        gap: 10px;
    }
    .wa-toggle-btn {
        flex: 1;
        height: 44px;
        border-radius: 12px;
        border: 1px solid var(--sb-neutral-200);
        background: var(--sb-neutral-0);
        color: var(--sb-neutral-500);
        font-weight: 700;
        font-size: 0.86rem;
        cursor: pointer;
        transition: all .15s ease;
    }
    .wa-toggle-btn.activo {
        background: var(--sb-green-600);
        border-color: var(--sb-green-600);
        color: var(--sb-neutral-0);
    }
    .wa-barra-conf {
        display: flex;
        height: 32px;
        border-radius: 999px;
        overflow: hidden;
        border: 1px solid var(--sb-neutral-200);
        margin: 8px 0 10px;
    }
    .wa-barra-conf .zona {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.68rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: .3px;
        white-space: nowrap;
        overflow: hidden;
        transition: flex-basis .2s ease;
    }
    .wa-barra-conf .zona.aparta { background: var(--sb-red-100); color: var(--sb-red-800); }
    .wa-barra-conf .zona.revisa { background: var(--sb-amber-100); color: var(--sb-amber-700); }
    .wa-barra-conf .zona.sola   { background: var(--sb-green-100); color: var(--sb-green-800); }

    .wa-regla-item {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
        border: 1px solid var(--sb-neutral-200);
        border-radius: 14px;
        margin-bottom: 12px;
        background: var(--sb-neutral-50);
    }
    .wa-regla-item.inactiva { opacity: .55; }
    .wa-sugerencia-item {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        padding: 14px 16px;
        border: 1px solid var(--sb-neutral-200);
        border-radius: 14px;
        margin-bottom: 10px;
        background: var(--sb-neutral-0);
        cursor: pointer;
        transition: all .15s ease;
    }
    .wa-sugerencia-item:hover { border-color: #86efac; background: #f0fdf4; }
    .wa-sugerencia-item.marcada { border-color: var(--sb-green-600); background: #f0fdf4; }
    .wa-check-box {
        flex-shrink: 0;
        width: 20px;
        height: 20px;
        border-radius: 6px;
        margin-top: 1px;
        border: 2px solid var(--sb-neutral-300);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--sb-neutral-0);
        font-size: 0.68rem;
        transition: all .15s;
    }
    .wa-sugerencia-item.marcada .wa-check-box { background: var(--sb-green-600); border-color: var(--sb-green-600); }

/* ----------------------------------------------------------------------------
   Pages/Whatsapp/WhatsappIaContactoEditar.razor
   -------------------------------------------------------------------------- */
    .wa-edit-card {
        background: var(--sb-neutral-0);
        border: 1px solid var(--sb-neutral-200);
        border-radius: 18px;
        padding: 24px;
        box-shadow: 0 2px 10px rgba(18, 26, 44, .04);
        margin-bottom: 20px;
    }
    .wa-edit-card h3 {
        margin: 0 0 6px;
        font-size: 0.8rem;
        font-weight: 900;
        color: var(--sb-neutral-500);
        text-transform: uppercase;
        letter-spacing: .6px;
    }
    .wa-edit-card .sub {
        margin: 0 0 20px;
        color: var(--sb-neutral-400);
        font-size: 0.84rem;
    }
    .wa-toggle-group {
        display: flex;
        gap: 10px;
    }
    .wa-toggle-btn {
        flex: 1;
        height: 44px;
        border-radius: 12px;
        border: 1px solid var(--sb-neutral-200);
        background: var(--sb-neutral-0);
        color: var(--sb-neutral-500);
        font-weight: 700;
        font-size: 0.86rem;
        cursor: pointer;
        transition: all .15s ease;
    }
    .wa-toggle-btn.activo {
        background: var(--sb-green-600);
        border-color: var(--sb-green-600);
        color: var(--sb-neutral-0);
    }

/* ----------------------------------------------------------------------------
   Pages/Whatsapp/WhatsappMensajeEditar.razor
   -------------------------------------------------------------------------- */
    .wa-edit-card {
        background: var(--sb-neutral-0);
        border: 1px solid var(--sb-neutral-200);
        border-radius: 18px;
        padding: 24px;
        box-shadow: 0 2px 10px rgba(18, 26, 44, .04);
        margin-bottom: 20px;
    }
    .wa-edit-card h3 {
        margin: 0 0 6px;
        font-size: 0.8rem;
        font-weight: 900;
        color: var(--sb-neutral-500);
        text-transform: uppercase;
        letter-spacing: .6px;
    }
    .wa-edit-card .sub {
        margin: 0 0 20px;
        color: var(--sb-neutral-400);
        font-size: 0.84rem;
    }
    .wa-toggle-group {
        display: flex;
        gap: 10px;
    }
    .wa-toggle-btn {
        flex: 1;
        height: 44px;
        border-radius: 12px;
        border: 1px solid var(--sb-neutral-200);
        background: var(--sb-neutral-0);
        color: var(--sb-neutral-500);
        font-weight: 700;
        font-size: 0.86rem;
        cursor: pointer;
        transition: all .15s ease;
    }
    .wa-toggle-btn.activo {
        background: var(--sb-green-600);
        border-color: var(--sb-green-600);
        color: var(--sb-neutral-0);
    }
    .wa-dia-btn {
        min-width: 48px;
        height: 40px;
        border-radius: 10px;
        border: 1px solid var(--sb-neutral-200);
        background: var(--sb-neutral-0);
        color: var(--sb-neutral-500);
        font-weight: 700;
        font-size: 0.82rem;
        cursor: pointer;
        transition: all .15s ease;
    }
    .wa-dia-btn.activo {
        background: var(--sb-green-600);
        border-color: var(--sb-green-600);
        color: var(--sb-neutral-0);
    }
    .wa-encuesta-opciones {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .wa-encuesta-opcion {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .wa-encuesta-opcion .sb-input { flex: 1; min-width: 0; }

/* Historial de un mensaje: intentos y captura en el mismo diálogo. */
.wa-history-overlay { position: fixed; inset: 0; z-index: var(--sb-z-spotlight, 2000); display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(15,23,42,.55); backdrop-filter: blur(4px); }
.wa-history-dialog { width: min(1200px, 100%); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; overflow: hidden; background: var(--sb-neutral-0, #fff); border: 1px solid var(--sb-neutral-200, #e2e8f0); border-radius: 24px; box-shadow: 0 24px 80px rgba(15,23,42,.24); color: var(--sb-neutral-800, #1e293b); }
.wa-history-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 26px; border-bottom: 1px solid var(--sb-neutral-200, #e2e8f0); }
.wa-history-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.wa-history-symbol { display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 auto; border-radius: 14px; color: var(--sb-brand); background: var(--sb-neutral-100, #f1f5f9); font-size: 1.25rem; }
.wa-history-header h2 { font-size: 1.25rem; font-weight: 800; margin: 0 0 4px; }
.wa-history-header p { margin: 0; color: var(--sb-neutral-500, #64748b); font-size: .88rem; overflow-wrap: anywhere; }
.wa-history-close, .wa-history-refresh { border: 1px solid var(--sb-neutral-200, #e2e8f0); background: var(--sb-neutral-0, #fff); border-radius: 10px; height: 38px; width: 38px; flex: 0 0 auto; color: var(--sb-neutral-600, #475569); cursor: pointer; }
.wa-history-content { overflow-y: auto; padding: 24px 26px; min-height: 180px; }
.wa-history-columns { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(0, 1.65fr); gap: 24px; }
.wa-history-section-title, .wa-history-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.wa-history-section-title h3, .wa-history-detail-heading h3 { font-size: .94rem; font-weight: 800; margin: 0; }
.wa-history-section-title h3 span { margin-left: 6px; color: var(--sb-neutral-500, #64748b); font-weight: 500; }
.wa-history-detail-heading > span { color: var(--sb-neutral-500, #64748b); font-size: .78rem; }
.wa-history-attempts ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; max-height: 520px; overflow-y: auto; }
.wa-history-attempt { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left; width: 100%; padding: 16px; border: 1px solid var(--sb-neutral-200, #e2e8f0); border-radius: 14px; background: var(--sb-neutral-0, #fff); color: inherit; cursor: pointer; }
.wa-history-attempt:hover { background: var(--sb-neutral-50, #f8fafc); }
.wa-history-attempt.selected { border-color: var(--sb-brand); box-shadow: inset 3px 0 var(--sb-brand); background: #fff9f6; }
.wa-history-attempt-time { width: 100%; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: .8rem; }
.wa-history-attempt-time strong { margin-left: 6px; }
.wa-history-attempt-time small { color: var(--sb-neutral-500, #64748b); }
.wa-history-attempt-capture { color: var(--sb-neutral-500, #64748b); font-size: .76rem; }
.wa-history-preview { display: flex; justify-content: center; align-items: flex-start; background: var(--sb-neutral-100, #f1f5f9); border: 1px solid var(--sb-neutral-200, #e2e8f0); border-radius: 16px; overflow: auto; max-height: 460px; }
.wa-history-preview img { width: 100%; height: auto; display: block; }
.wa-history-preview.empty { min-height: 300px; align-items: center; flex-direction: column; gap: 12px; padding: 32px; color: var(--sb-neutral-500, #64748b); text-align: center; }
.wa-history-preview.empty > i { font-size: 2rem; color: var(--sb-neutral-400, #94a3b8); }
.wa-history-preview.empty span { font-size: .84rem; }
.wa-history-detail-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 0; font-size: .78rem; color: var(--sb-neutral-500, #64748b); }
.wa-history-message { font-size: .82rem; border-top: 1px solid var(--sb-neutral-200, #e2e8f0); padding-top: 10px; }
.wa-history-message summary { cursor: pointer; color: var(--sb-neutral-600, #475569); }
.wa-history-message p { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; margin: 8px 0 0; background: var(--sb-neutral-50, #f8fafc); border-radius: 10px; }
.wa-history-notice { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: .85rem; line-height: 1.5; overflow-wrap: anywhere; background: #eff6ff; color: #1e40af; }
.wa-history-notice.warning { background: #fffbeb; color: #92400e; }
.wa-history-notice.danger { background: #fef2f2; color: #991b1b; }
.wa-history-notice.success { background: #ecfdf5; color: #065f46; }
.wa-history-footer { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 26px; border-top: 1px solid var(--sb-neutral-200, #e2e8f0); background: var(--sb-neutral-50, #f8fafc); }
.wa-history-footer p { margin: 0; color: var(--sb-neutral-500, #64748b); font-size: .82rem; }
.wa-history-actions { display: flex; flex: 0 0 auto; gap: 10px; }
.wa-history-confirm { display: grid; gap: 4px; font-size: .85rem; }
.wa-history-confirm span { color: var(--sb-neutral-500, #64748b); }
.wa-history-empty { padding: 48px 24px; text-align: center; color: var(--sb-neutral-500, #64748b); }
.wa-history-empty > i { font-size: 2rem; margin-bottom: 12px; }
.wa-history-empty h3 { font-size: 1rem; }
.wa-history-dialog button:disabled { opacity: .55; cursor: wait; }
.wa-history-dialog button:focus-visible, .wa-history-message summary:focus-visible { outline: 3px solid var(--sb-brand); outline-offset: 3px; }
@media (max-width: 700px) {
    .wa-history-overlay { padding: 10px; }
    .wa-history-dialog { max-height: calc(100dvh - 20px); border-radius: 18px; }
    .wa-history-header, .wa-history-footer { padding: 16px; }
    .wa-history-content { padding: 16px; }
    .wa-history-columns { grid-template-columns: 1fr; gap: 20px; }
    .wa-history-attempts ol { max-height: 200px; }
    .wa-history-detail-heading { flex-wrap: wrap; }
    .wa-history-footer { align-items: stretch; flex-direction: column; gap: 12px; }
    .wa-history-actions { justify-content: flex-end; }
    .wa-history-symbol { display: none; }
}
