/* ==========================================================================
   CHAT INTERNO — Radio Rumba Popayán
   Estilos aislados con prefijo "rr-chat-" para no afectar el resto del sitio.
   El widget vive dentro de la web (sin terceros, sin WhatsApp).
   ========================================================================== */

#rrChatBubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 250;
    width: 60px;
    height: 60px;
    padding: 0;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 22px rgba(37, 211, 102, .5);
    transition: transform .25s, box-shadow .25s;
}

.rr-chat-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#rrChatBubble:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(37, 211, 102, .7);
}

.rr-chat-close:focus-visible,
.rr-chat-option:focus-visible,
#rrChatSend:focus-visible,
#rrChatInput:focus-visible {
    outline: 2px solid #b9eaff;
    outline-offset: 2px;
}

#rrChatBubble .rr-chat-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #0b192c;
    display: none;
}

#rrChatBubble.has-news .rr-chat-dot {
    display: block;
}

#rrChatPanel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    left: auto;
    z-index: 260;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 130px);
    /* Reset del <section { padding: 100px 5% }> global del sitio: */
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    background: #0b192c;
    border: 1px solid rgba(51, 153, 255, .25);
    border-radius: 18px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
    font-family: 'Rajdhani', 'Exo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Todo el contenido interno ocupa el ancho completo del panel (sin huecos laterales) */
#rrChatPanel > * {
    width: 100%;
    box-sizing: border-box;
}

#rrChatPanel.open {
    display: flex;
    animation: rrChatIn .25s ease;
}

@keyframes rrChatIn {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.rr-chat-header {
    background: linear-gradient(135deg, #128C7E, #25D366);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    color: #fff;
    flex-shrink: 0;
}

/* Contenedor del título/subtítulo: ocupa el espacio restante y queda a la izquierda */
.rr-chat-header > div:not(.rr-chat-avatar) {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
}

.rr-chat-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.rr-chat-title {
    font-weight: 700;
    font-size: .98rem;
    letter-spacing: .03em;
    line-height: 1.15;
}

.rr-chat-sub {
    font-size: .72rem;
    opacity: .9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.rr-chat-sub::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #b9ffcf;
    box-shadow: 0 0 6px #b9ffcf;
}

.rr-chat-close {
    margin-left: auto;
    background: rgba(255, 255, 255, .14);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.rr-chat-close:hover {
    background: rgba(255, 255, 255, .3);
}

.rr-chat-messages {
    flex: 1 1 auto;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    scrollbar-width: thin;
}

.rr-chat-messages::-webkit-scrollbar { width: 6px; }
.rr-chat-messages::-webkit-scrollbar-thumb { background: rgba(51, 153, 255, .3); border-radius: 3px; }

.rr-chat-msg {
    max-width: 84%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: .86rem;
    line-height: 1.45;
    white-space: pre-line;
    word-wrap: break-word;
}

.rr-chat-msg.bot {
    align-self: flex-start;
    background: rgba(51, 153, 255, .12);
    border: 1px solid rgba(51, 153, 255, .22);
    color: #eaf4ff;
    border-bottom-left-radius: 4px;
}

.rr-chat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #128C7E, #1aa06d);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.rr-chat-msg a {
    color: #7dd3fc;
    text-decoration: underline;
}

.rr-chat-msg.user a {
    color: #eafff3;
}

.rr-chat-tag {
    display: inline-block;
    font-size: .62rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .6;
    margin-bottom: 4px;
}

.rr-chat-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 14px;
    background: rgba(51, 153, 255, .12);
    border: 1px solid rgba(51, 153, 255, .22);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.rr-chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #66ccff;
    animation: rrChatBlink 1.2s infinite;
}

.rr-chat-typing span:nth-child(2) { animation-delay: .2s; }
.rr-chat-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes rrChatBlink {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

.rr-chat-input-area {
    flex-shrink: 0;
    border-top: 1px solid rgba(51, 153, 255, .18);
    background: rgba(2, 8, 23, .6);
    padding: 10px 12px 12px;
}

/* Botones de opción (fallback TAREA 2E y aceptación de privacidad TAREA 3) */
.rr-chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-self: stretch;
    margin: 2px 0;
}

.rr-chat-option {
    min-height: 44px;
    background: rgba(51, 153, 255, .12);
    border: 1px solid rgba(51, 153, 255, .35);
    color: #eaf4ff;
    border-radius: 16px;
    padding: 8px 12px;
    font-size: .8rem;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}

.rr-chat-option:hover {
    background: rgba(51, 153, 255, .22);
    border-color: #7dd3fc;
}

.rr-chat-option.primary {
    background: linear-gradient(135deg, #128C7E, #25D366);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.rr-chat-option:disabled {
    opacity: .5;
    cursor: default;
}

.rr-chat-options.used {
    opacity: .65;
}

.rr-chat-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

#rrChatInput {
    flex: 1;
    background: rgba(11, 25, 44, .9);
    border: 1px solid rgba(51, 153, 255, .3);
    border-radius: 20px;
    padding: 10px 14px;
    color: #fff;
    font-size: .86rem;
    font-family: inherit;
    outline: none;
    resize: none;
}

#rrChatInput:focus {
    border-color: #25D366;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, .2);
}

#rrChatInput::placeholder { color: rgba(230, 240, 255, .4); }

#rrChatInput:disabled {
    opacity: .55;
    cursor: not-allowed;
}

#rrChatSend {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #fff;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform .2s;
}

#rrChatSend:hover { transform: scale(1.08); }

#rrChatSend:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 600px) {
    #rrChatBubble { bottom: 84px; right: 16px; }
    #rrChatPanel {
        bottom: 76px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        height: calc(100vh - 100px);
        max-height: none;
    }
}

/* ==========================================================================
   BANNER DE COOKIES (js/cookies-banner.js) — prefijo "rr-cookies-"
   Aislado del resto del sitio; se ancla abajo a la izquierda para no
   chocar con la burbuja del chat (#rrChatBubble, abajo a la derecha).
   ========================================================================== */

#rrCookiesBanner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 240;
    max-width: 420px;
    width: calc(100vw - 40px);
    box-sizing: border-box;
    background: #0b192c;
    border: 1px solid rgba(51, 153, 255, .28);
    border-radius: 14px;
    padding: 16px 18px;
    color: #eaf4ff;
    font-family: 'Rajdhani', 'Exo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .55);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: rrCookiesIn .3s ease;
}

@keyframes rrCookiesIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rr-cookies-text {
    font-size: .88rem;
    line-height: 1.45;
}

.rr-cookies-text a {
    color: #7dd3fc;
    text-decoration: underline;
}

.rr-cookies-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rr-cookies-btn {
    background: rgba(51, 153, 255, .12);
    border: 1px solid rgba(51, 153, 255, .35);
    color: #eaf4ff;
    border-radius: 16px;
    padding: 8px 14px;
    font-size: .82rem;
    font-family: inherit;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}

.rr-cookies-btn:hover {
    background: rgba(51, 153, 255, .22);
    border-color: #7dd3fc;
}

.rr-cookies-btn.primary {
    background: linear-gradient(135deg, #128C7E, #25D366);
    border-color: transparent;
    color: #fff;
}

@media (max-width: 600px) {
    #rrCookiesBanner {
        left: 12px;
        right: 12px;
        bottom: 92px; /* deja espacio para la burbuja del chat */
        max-width: none;
        width: auto;
    }
}
