/**
 * Buzón de Atención Institucional
 * mod_buzon_atencion - Versión 1.4.12
 * Portal DGIRE - Joomla 6
 */
.buzon-widget-container {
    position: fixed;
    z-index: 99990;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
}
.buzon-widget-container *,
.buzon-widget-container *::before,
.buzon-widget-container *::after {
    box-sizing: border-box;
}
.buzon-widget-container.pos-bottom-right { bottom: 24px; right: 24px; }
.buzon-widget-container.pos-bottom-left { bottom: 24px; left: 24px; }

/* Telón de fondo móvil */
.bz-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 99980;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.buzon-widget-container.is-active .bz-backdrop {
    display: block;
    opacity: 1;
}

/* Botón Flotante con Borde de Contraste y Sombra Pronunciada */
.bz-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: var(--bz-primary, #334155);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    padding: 11px 20px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    outline: none;
    position: relative;
    z-index: 99992;
}
.bz-trigger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    filter: brightness(1.1);
}
.bz-trigger-btn:active {
    transform: translateY(0) scale(0.98);
}
.bz-trigger-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6), 0 0 0 5px var(--bz-primary, #334155);
}
.bz-trigger-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 22px;
    height: 22px;
}
.bz-icon-chat, .bz-icon-close { transition: transform 0.2s ease, opacity 0.2s ease; }
.bz-icon-close { display: none; position: absolute; }
.buzon-widget-container.is-active .bz-icon-chat { display: none; }
.buzon-widget-container.is-active .bz-icon-close { display: block; }

/* Punto Verde con Latido Sutil */
.bz-online-dot {
    width: 9px;
    height: 9px;
    background-color: #22c55e;
    border-radius: 50%;
    border: 2px solid var(--bz-primary, #334155);
    position: absolute;
    top: 7px;
    right: 13px;
    animation: bz-pulse 3s infinite ease-in-out;
}
@keyframes bz-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Ventana Flotante */
.bz-chat-window {
    position: absolute;
    bottom: 60px;
    width: 370px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 100px);
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.96);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 99991;
}
.buzon-widget-container.pos-bottom-right .bz-chat-window { right: 0; }
.buzon-widget-container.pos-bottom-left .bz-chat-window { left: 0; }
.buzon-widget-container.is-active .bz-chat-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.bz-chat-header {
    background: var(--bz-primary, #334155);
    color: #ffffff;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.bz-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.bz-header-info { flex-grow: 1; overflow: hidden; }
.bz-header-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bz-btn-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}
.bz-btn-close:hover { color: #ffffff; background: rgba(255, 255, 255, 0.18); }

.bz-chat-body {
    padding: 16px;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
    background-color: #fbfcfd;
}
.bz-msg-received { margin-bottom: 14px; }

/* Burbuja de Bienvenida con letra ampliada y muy legible */
.bz-bubble {
    background: #eef2f6;
    color: #0f172a;
    padding: 13px 15px;
    border-radius: 12px 12px 12px 2px;
    font-size: 14.5px;
    line-height: 1.5;
    font-weight: 450;
    border: 1px solid #e2e8f0;
}
.bz-msg-time { display: block; font-size: 11.5px; color: #64748b; margin-top: 6px; margin-left: 4px; }

.bz-form-group { margin-bottom: 11px; }
.bz-label { display: block; font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 4px; }

/* Inputs y Textareas con tipografía compacta, fina y elegante */
.bz-input, .bz-textarea {
    width: 100%;
    padding: 8px 11px;
    font-size: 12.8px;
    letter-spacing: 0.1px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #ffffff;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.bz-input::placeholder, .bz-textarea::placeholder {
    font-size: 12.2px;
    color: #94a3b8;
}
.bz-input:focus, .bz-textarea:focus {
    border-color: var(--bz-secondary, #0e42a1);
    box-shadow: 0 0 0 3px rgba(14, 66, 161, 0.12);
}
.bz-textarea { resize: vertical; min-height: 68px; }

/* Checkbox de Aviso de Privacidad DGIRE - ALINEACIÓN DE PRECISIÓN */
.bz-privacy-group {
    margin: 10px 0 14px 0 !important;
    padding: 10px 12px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
}
.bz-checkbox-label {
    display: grid !important;
    grid-template-columns: 18px 1fr !important;
    align-items: start !important;
    gap: 10px !important;
    cursor: pointer !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}
.bz-checkbox {
    width: 16px !important;
    height: 16px !important;
    margin: 2px 0 0 0 !important;
    padding: 0 !important;
    cursor: pointer !important;
    accent-color: var(--bz-secondary, #0e42a1) !important;
    vertical-align: top !important;
    float: none !important;
    display: block !important;
    position: static !important;
    box-sizing: border-box !important;
}
.bz-checkbox-text {
    font-size: 11.8px !important;
    line-height: 1.45 !important;
    color: #334155 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    user-select: none !important;
}

/* Mensajes de Feedback (Arriba del Botón) */
.bz-feedback {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
    line-height: 1.45;
    text-align: center;
    font-weight: 500;
}
.bz-feedback.success { 
    background-color: #f0fdf4; 
    color: #15803d; 
    border: 1.5px solid #86efac; 
}
.bz-feedback.error { 
    background-color: #fee2e2; 
    color: #b91c1c; 
    border: 1.5px solid #fca5a5; 
}
.bz-feedback.info { 
    background-color: #e0f2fe; 
    color: #0369a1; 
    border: 1.5px solid #7dd3fc; 
}

.bz-btn-submit {
    width: 100%;
    background-color: var(--bz-secondary, #0e42a1);
    color: #ffffff;
    border: none;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.bz-btn-submit:hover:not(:disabled) {
    background-color: var(--bz-primary, #334155);
}
.bz-btn-submit:disabled { opacity: 0.65; cursor: not-allowed; }
.bz-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: bz-spin 0.7s linear infinite;
}
@keyframes bz-spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
    .buzon-widget-container.pos-bottom-right,
    .buzon-widget-container.pos-bottom-left {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
    .bz-trigger-btn { width: 100%; justify-content: center; }
    .bz-chat-window { bottom: 64px; width: 100%; max-width: 100%; border-radius: 12px; }
}