:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #ffda93;    /* Dorado (Títulos) */
    --text-secondary: #dcdde1;  /* Gris claro (Artistas) */
    --text-white: #ffffff;      /* Blanco puro (Letras y Números) */
    --accent: #e58e26;
    --chord-color: #81ecec;
    --input-bg: #2f3640;
    
    --btn-bg: #353b48;
    --btn-shadow: #191c21;
    --btn-text: #f5f6fa;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-primary);
    padding-bottom: 40px;
}

/* --- HEADER --- */
header {
    background-color: var(--card-bg);
    padding: 15px 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    display: grid;
    /* Ajuste: la primera columna ahora se adapta al contenido (auto) */
    grid-template-columns: auto 1fr auto; 
    gap: 20px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #333;
}

.brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap; /* ESTO EVITA QUE SE ROMPA EN DOS LINEAS */
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Buscador */
.search-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    justify-self: center;
}

.search-input {
    width: 100%;
    padding: 12px 12px 12px 45px;
    border-radius: 30px;
    border: 2px solid transparent;
    background-color: var(--input-bg);
    color: white;
    font-size: 16px;
    outline: none;
    box-sizing: border-box;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-primary);
}

/* --- ENLACES DE NAVEGACIÓN --- */
.nav-links {
    justify-self: end;
    display: flex;
    gap: 10px; /* Espacio uniforme entre botones */
    align-items: center;
}

/* Estilo común para: Inicio, Lista y Compartir */
.nav-links a {
    text-decoration: none;
    color: #ffffff;      /* Texto blanco */
    font-weight: bold;
    font-size: 14px;
    
    /* Forma de botón "Pastilla" */
    padding: 8px 16px;
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.1); /* Fondo vidrio sutil */
    border: 1px solid transparent;
    
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap; /* Evita que el texto se rompa */
}

/* Efecto Hover para todos */
.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.25); /* Más brillo al pasar el mouse */
    transform: translateY(-2px); /* Pequeña elevación */
}

/* Estado activo (Opcional) */
.nav-links a:active {
    transform: scale(0.95);
}

/* --- FILTROS --- */
.filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 30px 20px;
    flex-wrap: wrap;
}

.filter-btn {
    position: relative;
    background-color: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    border-radius: 12px;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 0 var(--btn-shadow); 
    top: 0;
    transition: all 0.1s;
}

.filter-btn:active, .filter-btn.active {
    box-shadow: 0 0 0 var(--btn-shadow);
    top: 5px;
    background-color: var(--accent);
    color: #000;
}

/* --- TABLA --- */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 60vh;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
}

th, td {
    padding: 18px;
    text-align: left;
    border-bottom: 1px solid #333;
}

th { 
    background-color: #2f3640; 
    color: var(--text-primary); 
    text-transform: uppercase;
    font-size: 0.9rem;
}

tr:hover { background-color: #252525; }

/* NÚMEROS DE LISTA EN BLANCO */
.index-col { color: var(--text-white); font-weight: bold; opacity: 0.7; }

.song-title { color: var(--text-primary); font-weight: bold; cursor: pointer; font-size: 1.1rem; }
.artist-link { color: var(--text-secondary); cursor: pointer; font-style: italic; }

/* --- VISTA DETALLE CANCIÓN --- */
#songDetailView {
    display: none;
    background: var(--card-bg);
    padding: 40px;
    border-radius: 15px;
    color: var(--text-primary);
}

.song-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #444;
}

.control-btn {
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    font-weight: bold;
    cursor: pointer;
    color: white;
}

.btn-back { 
    background: #444; 
    margin-bottom: 5px; /* Reducido de 20px a 5px */
    display: inline-block;
}
.btn-down { background: #e84118; }
.btn-up { background: #4cd137; }

/* Busca la regla de #detailTitle en el HTML o agrega esto al final del CSS: */
#detailTitle {
    margin-top: 0px !important; /* Forzar margen superior a 0 */
    margin-bottom: 5px !important; /* Pegarlo un poco más al artista */
    line-height: 1.2;
}

#detailArtist {
    margin-top: 0px !important;
    margin-bottom: 20px !important; /* Espacio antes de los controles */
}

/* LETRA DE CANCIÓN EN BLANCO */
.song-content {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 17px;
    
    /* CAMBIO IMPORTANTE: Bajamos de 2.8 a 2.0 o 1.8 */
    line-height: 2.0; 
    
    white-space: pre-wrap;
    overflow-x: auto;
    color: var(--text-white);
}

/* --- MODAL (Ventana emergente) --- */
.modal {
    display: none; /* Oculto por defecto */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    border: 1px solid var(--text-primary);
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close-modal:hover { color: white; }

.key-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.key-btn {
    background: var(--btn-bg);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
}
.key-btn:hover { background: var(--accent); color: black; }

/* Footer */
.custom-footer {
    margin-top: 60px; /* Separación del contenido principal */
    background-color: var(--card-bg); /* Mismo fondo que el header/tarjetas */
    border-top: 1px solid #333;       /* Línea sutil arriba */
    padding: 30px 40px;               /* Espaciado interno generoso */
    
    display: flex;
    justify-content: space-between;   /* Uno a la izq, otro a la derecha */
    align-items: center;
    flex-wrap: wrap;                  /* Para que se adapte en móviles */
    gap: 20px;
}

.footer-copyright {
    color: #7f8c8d; /* Un gris elegante y discreto */
    font-size: 0.95rem;
    font-weight: 500;
}

.footer-credit {
    color: #7f8c8d;
    font-size: 0.95rem;
}

/* Estilo para "CirceHathaway" */
.footer-credit span {
    color: var(--text-primary); /* Tu color dorado (#ffda93) */
    font-weight: bold;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    margin-left: 5px;
}

/* Efecto al pasar el mouse sobre tu nombre */
.footer-credit span:hover {
    text-shadow: 0 0 10px rgba(255, 218, 147, 0.6); /* Brillo dorado */
    color: #fff;
}

/* --- NUEVOS CONTROLES CIRCULARES --- */
.controls-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
    position: relative; /* Para posicionar modales cerca si quisieras */
}

.circle-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--btn-bg);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    position: relative;
    z-index: 10;
}

.circle-btn:hover {
    background: var(--accent);
    color: #000;
    transform: translateY(-2px);
}

.circle-btn svg {
    width: 24px;
    height: 24px;
}

/* --- MODALES PEQUEÑOS (TONO Y FORMATO) --- */
.mini-modal {
    display: none; /* IMPORTANTE: Oculto por defecto */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg);
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    border: 1px solid var(--text-primary);
    z-index: 200;
}

/* Solo cuando tiene la clase 'active' se muestra y se acomoda */
.mini-modal.active {
    display: flex;           /* Aquí sí lo mostramos */
    flex-direction: row;     /* En fila */
    flex-wrap: nowrap;       /* Sin saltos de línea */
    width: auto;
    min-width: 360px;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

/* Botones dentro del modal */
.modal-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 1px solid #444;
    background: #2f3640;
    color: white;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.modal-btn:hover {
    background: var(--chord-color);
    color: #000;
}

/* Overlay invisible para cerrar al hacer click afuera */
.overlay-click-close {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 150;
    background: rgba(0,0,0,0.5); /* Un poco oscuro para enfocar */
}

@media (max-width: 768px) {
    header { grid-template-columns: 1fr; text-align: center; }
    .brand { justify-content: center; }
    .nav-links { justify-self: center; }
}

/* --- SISTEMA DE ACORDES PEGADOS (Responsive) --- */
.g {
    display: inline-flex;       /* Hace que sea una cajita flexible */
    flex-direction: column;     /* Pone los elementos uno arriba del otro */
    vertical-align: bottom;     /* Alinea la base con el texto de al lado */
    margin-right: 4px;          /* Un pequeño espacio a la derecha */
}

/* Ajuste del acorde cuando está dentro de un grupo */
.g .chord {
    align-self: flex-start;     /* Alinea el acorde a la izquierda de la palabra */
    margin-bottom: 0px;         /* Pegadito a la letra */
    font-size: 18px;            /* Tamaño legible */
    background: var(--chord-color);
    padding: 0px 6px;
    line-height: 1;
    color: #121212; 
    font-weight: bold;          /* Negrita para que resalte más */
}

/* --- BOTONES DE LISTA (ACCIÓN) --- */
.action-col {
    text-align: center;
    width: 50px;
}

.btn-add, .btn-remove {
    background: none;
    border: 2px solid;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

/* Botón + (Agregar) */
.btn-add {
    border-color: #4cd137;
    color: #4cd137;
}
.btn-add:hover {
    background: #4cd137;
    color: white;
}
.btn-add.added { /* Estado cuando ya fue agregada */
    border-color: #7f8c8d;
    color: #7f8c8d;
    cursor: default;
    background: transparent;
}

/* Botón x (Quitar) */
.btn-remove {
    border-color: #e55039;
    color: #e55039;
}
.btn-remove:hover {
    background: #e55039;
    color: white;
}

/* Botón especial para compartir lista */
.btn-share-list {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    margin: 20px auto;
    display: block; /* Centrado */
}

.btn-share-list:hover {
    transform: translateY(-2px);
}

/* --- Botón para vaciar lista --- */
.btn-clear-list {
    background-color: #e55039; /* Rojo consistente con borrar */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    margin: 0 auto 30px auto; /* Centrado y con espacio abajo */
    display: block; 
    transition: transform 0.2s, background-color 0.2s;
}

.btn-clear-list:hover {
    background-color: #c0392b; /* Un rojo un poco más oscuro */
    transform: translateY(-2px);
}

/* --- BOTONES DEL MODAL DE CONFIRMACIÓN --- */
.btn-modal-action {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 16px;
    flex: 1; /* Para que ocupen el mismo ancho */
}

.btn-modal-action.cancel {
    background-color: #444;
    color: white;
}

.btn-modal-action.delete {
    background-color: #e55039;
    color: white;
}

.btn-modal-action:active {
    transform: scale(0.95);
}

/* --- NOTIFICACIÓN FLOTANTE (TOAST) --- */
.custom-notification {
    visibility: hidden; /* Oculto por defecto */
    min-width: 250px;
    background-color: #2f3640; /* Fondo oscuro */
    color: #fff;
    text-align: center;
    border-radius: 50px; /* Bordes muy redondos */
    padding: 15px 25px;
    position: fixed;
    z-index: 3000; /* Por encima de todo, incluso modales */
    left: 50%;
    top: -50px; /* Empieza fuera de la pantalla arriba */
    transform: translateX(-50%);
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    border: 1px solid var(--accent); /* Borde naranja/dorado */
    opacity: 0;
    transition: all 0.5s ease;
    font-weight: bold;
    font-size: 16px;
}

/* Clase para mostrarlo */
.custom-notification.show {
    visibility: visible;
    opacity: 1;
    top: 30px; /* Baja a una posición visible */
}

/* =========================================
   RESPONSIVIDAD MÓVIL (Celulares y Tablets)
   ========================================= */

@media (max-width: 768px) {

    /* --- 1. HEADER APILADO --- */
    header {
        grid-template-columns: 1fr; /* Una sola columna */
        grid-template-areas: 
            "brand"
            "search"
            "nav";
        padding: 15px; /* Menos relleno */
        gap: 15px;
    }

    .brand {
        grid-area: brand;
        justify-content: center; /* Logo centrado */
        font-size: 1.8rem;
    }

    .search-container {
        grid-area: search;
        max-width: 100%; /* Ocupar todo el ancho */
    }

    .nav-links {
        grid-area: nav;
        justify-self: center;
        width: 100%;
        display: flex;
        justify-content: space-around; /* Distribuir enlaces */
        padding-right: 0;
    }

    /* --- 2. FILTROS --- */
    .filters {
        gap: 8px; /* Botones más pegaditos */
        padding: 15px 10px;
    }

    .filter-btn {
        flex: 1 1 auto; /* Que crezcan para llenar espacio */
        font-size: 14px;
        padding: 10px;
        text-align: center;
    }

    /* --- 3. TABLA OPTIMIZADA --- */
    /* Ocultamos la columna # (índice) para ganar espacio */
    th:nth-child(1), td:nth-child(1) {
        display: none;
    }

    /* Ajustamos paddings de celda */
    th, td {
        padding: 12px 8px; 
        font-size: 14px;
    }

    /* Título más grande para facilitar el toque */
    .song-title {
        font-size: 1rem; 
    }

    /* --- 4. VISTA DE CANCIÓN --- */
    #songDetailView {
        padding: 15px 10px; /* Márgenes laterales reducidos */
    }

    .song-content {
        /* 1. Obliga al texto a bajar de renglón si choca con el borde */
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
        
        /* 2. Achicamos la letra bastante para que entren las frases */
        /* En PC es 17px, en celular probamos con 12px o 11px */
        font-size: 12px; 
        
        /* 3. Eliminamos la barra de scroll horizontal */
        overflow-x: hidden !important;
        width: 100%;
    }
    
    /* Ajuste extra para los acordes en celular */
    .chord {
        padding: 0 2px; /* Menos relleno para ahorrar espacio */
        font-size: 12px; /* Acorde del mismo tamaño que la letra */
    }

    /* --- 5. MODALES (ARREGLO CRÍTICO) --- */
    /* Quitamos el ancho fijo de 360px que rompía pantallas pequeñas */
    .mini-modal.active {
        min-width: unset !important; /* Forzamos quitar el límite */
        width: 90% !important;       /* Ocupa el 90% de la pantalla */
        padding: 15px 5px;           /* Menos padding interno */
    }
    
    .modal-btn {
        width: 40px;  /* Botones un poco más chicos */
        height: 40px;
    }

    /* --- 6. FOOTER --- */
    .custom-footer {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding-bottom: 80px; /* Espacio extra abajo para scroll */
    }

    /* --- CORRECCIÓN TECLADO MÓVIL --- */
    .modal.keyboard-active {
        align-items: flex-start !important; /* Deja de centrar al medio y alinea arriba */
        padding-top: 40px !important; /* Un margen para que no se pegue al borde superior */
        transition: all 0.3s ease; /* Animación suave */
    }
}

/* ESTILOS PARA EL BOTÓN DE ACCIÓN (INSTALAR/COMPARTIR) */
#actionBtn {
    padding: 8px 15px;
    border-radius: 20px;
    transition: all 0.3s ease;
    border: 1px solid transparent; /* Para que no salte al agregar borde */
}

/* Estado Compartir (Por defecto) */
#actionBtn.mode-share {
    color: var(--text-white) !important;
    background-color: rgba(255,255,255,0.1); /* Un fondo sutil queda elegante */
}

/* Estado Instalar (Cuando detecta que se puede instalar) */
#actionBtn.mode-install {
    color: #4cd137 !important;
    background-color: rgba(76, 209, 55, 0.1); /* Verde muy suave de fondo */
    border: 1px solid #4cd137;
    animation: pulse 2s infinite; /* Un latido para llamar la atención */
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Estilo para el comentario dentro de la canción */
.song-comment {
    text-align: center;
    color: var(--accent); /* Color naranja/dorado */
    font-size: 1rem;
    font-weight: normal;
    font-style: italic;
    margin-top: -15px; /* Lo pegamos un poco al artista */
    margin-bottom: 25px; /* Espacio antes de los botones */
    min-height: 10px; /* Para que no colapse feo si está vacío */
}

/* --- DRAG & DROP (LONG PRESS) --- */

/* La fila completa será el área táctil */
.draggable-row {
    transition: transform 0.1s, background-color 0.2s;
    user-select: none; /* Evita que se seleccione el texto al mantener presionado */
    -webkit-user-select: none;
    position: relative;
}

/* Estado cuando se activa el arrastre */
.dragging {
    background-color: #333 !important; /* Fondo más oscuro */
    box-shadow: 0 10px 20px rgba(0,0,0,0.5); /* Sombra para dar efecto de elevación */
    z-index: 100;
    opacity: 0.9;
    transform: scale(1.02); /* Se agranda un poquito */
    border: 1px solid var(--accent);
}

/* BOTÓN LIVE EN EL HEADER */
.btn-live-nav {
    background-color: #333;
    color: #ff5252; /* Rojo apagado */
    border: 1px solid #ff5252;
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    margin-right: 10px;
    cursor: pointer;
    transition: 0.3s;
}

/* Cuando está conectado parpadea */
.btn-live-nav.active {
    background-color: #ff5252;
    color: white;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 82, 82, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 82, 82, 0); }
}

/* GRILLA DE SALAS */
.room-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.btn-room {
    background-color: #444;
    color: white;
    border: none;
    padding: 20px;
    font-size: 1.2rem;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
}

.btn-room:active {
    background-color: var(--accent);
    transform: scale(0.95);
}

/* Botón de texto simple (Cerrar / Volver) */
.btn-text {
    background: transparent;
    border: none;
    color: #888; /* Color gris apagado por defecto */
    cursor: pointer;
    font-size: 1rem;
    padding: 12px;
    width: 100%;
    border-radius: 8px;
    transition: all 0.2s ease; /* Suaviza el cambio de color */
}

/* Efecto al pasar el mouse o tocar */
.btn-text:hover,
.btn-text:active {
    color: #ffffff !important; /* Se pone blanco brillante */
    background-color: rgba(255, 255, 255, 0.1); /* Fondo sutil para feedback visual */
}


/* ------ BOTÓN DE CHAT EN HEADER ------ */
.btn-chat-nav {
    background-color: #333;
    color: white;
    border: 1px solid #555;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 1.1rem; /* Un poco más grande para el emoji */
    cursor: pointer;
    position: relative; /* Para el badge */
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* El globito rojo de notificación */
.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff5252;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card-bg); /* Borde para separar del botón */
}

/* --- OVERLAY DE CHAT (VENTANA COMPLETA) --- */
.chat-overlay {
    position: fixed;
    top: 73px; /* Justo debajo del header (aprox) */
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #121212; /* Fondo oscuro sólido */
    z-index: 2000; /* Por encima de todo */
    display: flex;
    flex-direction: column;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Header interno del chat (Opcional, para cerrar) */
.chat-header {
    background-color: #1e1e1e;
    padding: 10px 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: var(--text-primary);
}

/* Área de mensajes (Scroll) */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 80px;
    
    /* --- FONDO TIPO WHATSAPP DARK --- */
    background-color: #0a0a0a; /* Base casi negra */
    
    /* Patrón de dibujos (Notas y formas) */
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");

    /* Esto hace que el dibujo se quede quieto cuando haces scroll (Efecto elegante) */
    background-attachment: fixed; 
}

/* Burbuja de mensaje */
.message-bubble {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.95rem;
    position: relative;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Mensaje MÍO (Derecha) */
.msg-me {
    align-self: flex-end;
    background-color: var(--text-primary); /* Dorado/Naranja */
    color: black;
    border-bottom-right-radius: 2px;
}

/* Mensaje de OTROS (Izquierda) */
.msg-other {
    align-self: flex-start;
    background-color: #333;
    color: white;
    border-bottom-left-radius: 2px;
}

/* Nombre del remitente (pequeño arriba) */
.msg-sender {
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 2px;
    opacity: 0.8;
    display: block;
}

/* Hora (pequeño abajo) */
.msg-time {
    font-size: 0.7rem;
    opacity: 0.6;
    float: right;
    margin-left: 10px;
    margin-top: 5px;
}

/* Área de input (Fija abajo) */
.chat-input-area {
    background-color: #1e1e1e;
    padding: 10px 15px;
    display: flex;
    gap: 10px;
    border-top: 1px solid #333;
    position: sticky;
    bottom: 0;
}

.chat-input-area input {
    flex: 1;
    padding: 12px;
    border-radius: 25px;
    border: none;
    background-color: #333;
    color: white;
    font-size: 16px;
    outline: none;
}

.btn-send {
    background-color: var(--text-primary);
    color: rgb(38, 37, 37);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- COLORES DE CHAT PERSONALIZADOS --- */

/* Base para el nombre del remitente */
.msg-sender {
    font-size: 0.75rem;
    font-weight: 800; /* Más gordito */
    margin-bottom: 4px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* 1. SOL (Rosado Vibrante) */
.user-SOL {
    background-color: #fd79a8 !important; 
    color: #3a004c !important; /* Texto oscuro para que se lea bien */
    border: 1px solid #e84393;
}

/* 2. SAM (Azul Profundo) */
.user-SAM {
    background-color: #0984e3 !important;
    color: rgb(255, 255, 255) !important;
}

/* 3. PASTOR (Verde Esmeralda/Teal) */
.user-PASTOR {
    background-color: #00b894 !important;
    color: rgb(11, 1, 58) !important;
}

/* 4. SAMU (Violeta/Indigo) */
.user-SAMU {
    background-color: #6c5ce7 !important;
    color: rgb(255, 179, 0) !important;
}

/* Si entra alguien con otra clave (Gris por defecto) */
.user-UNKNOWN {
    background-color: #636e72 !important;
    color: white !important;
}

/* Ajuste para el icono del header */
.btn-chat-nav svg {
    margin-right: 0; /* Centrado */
}

/* --- ESTILOS FASE 2: STICKERS --- */

/* Botón Clip */
.btn-clip {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 0 10px 0 5px; 
    transition: 0.2s;
    display: flex;
    align-items: center;
}
.btn-clip:hover {
    color: var(--text-primary);
}

/* CLASE ESPECIAL PARA STICKERS */
.msg-sticker {
    background-color: transparent !important; /* Sin fondo de color */
    padding: 0 !important; /* Sin relleno */
    border: none !important;
    box-shadow: none !important;
    max-width: 50%; /* Tamaño controlado */
}

/* La imagen del sticker */
.msg-sticker img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}