/* ============================================
   ESTILOS GENERALES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0b0e18;
    color: #fff;
    min-height: 100vh;
    overflow: hidden;
}

/* ============================================
   LOGIN
   ============================================ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(145deg, #0b0e18, #1a1f2b);
}

.login-box {
    background: rgba(26, 31, 43, 0.95);
    padding: 3rem;
    border-radius: 2rem;
    border: 1px solid #2e3545;
    width: 400px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.logo-container img {
    width: 50%;
    height: 50%;
    object-fit: contain;
    margin-bottom: 1rem;
    border-radius: 20%;
    background: rgba(74, 127, 255, 0.1);
    padding: 0.5rem;
}

.login-box h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: #e3e9f5;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #8892a8;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #2e3545;
    background: #0b0e18;
    color: #fff;
    border-radius: 0.8rem;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #4a7fff;
    box-shadow: 0 0 0 3px rgba(74, 127, 255, 0.1);
}

.login-btn {
    width: 100%;
    padding: 0.8rem;
    background: #4a7fff;
    color: #fff;
    border: none;
    border-radius: 0.8rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.login-btn:hover {
    background: #3a6ae0;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(74, 127, 255, 0.3);
}

.error-message {
    color: #ff6b6b;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* ============================================
   APP PRINCIPAL
   ============================================ */
.scene {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(145deg, #121624, #1a1f2b);
    overflow: hidden;
}

/* ============================================
   LLUVIA
   ============================================ */
.lluvia {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.gota {
    position: absolute;
    top: -20px;
    width: 2px;
    background: rgba(180, 210, 255, 0.4);
    border-radius: 0 0 6px 6px;
    animation: caerLluvia linear infinite;
}

@keyframes caerLluvia {
    0% {
        transform: translateY(-20px) translateX(0);
        opacity: 0.6;
    }
    80% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(calc(100vh + 40px)) translateX(-8px);
        opacity: 0;
    }
}

/* ============================================
   HEADER / NAVEGACIÓN
   ============================================ */
.app-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    padding: 0.8rem 2rem;
    background: rgba(11, 14, 24, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #2e3545;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    color: #e3e9f5;
}

.header-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-btn {
    background: transparent;
    color: #8892a8;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.nav-btn:hover {
    background: rgba(74, 127, 255, 0.15);
    color: #fff;
}

.nav-btn.active {
    background: #4a7fff;
    color: #fff;
}

#logoutBtn:hover {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

/* ============================================
   CONTENIDO PRINCIPAL
   ============================================ */
.main-content {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    overflow-y: auto;
    padding: 2rem;
}

.section {
    height: 100%;
    position: relative;
    display: none;
}

.section.active {
    display: block;
}

/* ============================================
   ESQUELETO CON PARAGUAS (IMAGEN ÚNICA)
   ============================================ */
.esqueleto-wrapper {
    position: absolute;
    bottom: 6%;
    left: 3%;
    width: 300px;
    height: 350px;
    z-index: 10;
}

.esqueleto-completo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.4));
    animation: flotarEsqueleto 4s ease-in-out infinite;
}

@keyframes flotarEsqueleto {
    0%, 100% { 
        transform: translateY(0px) rotate(-1deg); 
    }
    50% { 
        transform: translateY(-8px) rotate(1deg); 
    }
}

/* ============================================
   NOTIFICACIONES
   ============================================ */
.notifications-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 25;
    background: rgba(11, 14, 24, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid #2e3545;
    border-radius: 1rem;
    padding: 1rem;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #2e3545;
}

.notifications-header h3 {
    color: #e3e9f5;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification-badge {
    background: #4a7fff;
    color: white;
    border-radius: 50%;
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
}

.btn-clear {
    background: transparent;
    border: none;
    color: #5a6480;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
    transition: all 0.3s;
}

.btn-clear:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.notification-item {
    padding: 0.8rem;
    background: rgba(74, 127, 255, 0.08);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid #4a7fff;
    animation: fadeIn 0.3s ease;
}

.notification-item:last-child {
    margin-bottom: 0;
}

.notification-content {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
}

.notification-icon {
    font-size: 1.2rem;
}

.notification-text {
    flex: 1;
}

.notification-text strong {
    color: #e3e9f5;
    display: block;
    font-size: 0.9rem;
}

.notification-text span {
    color: #8892a8;
    font-size: 0.85rem;
}

.notification-text small {
    color: #5a6480;
    font-size: 0.7rem;
    display: block;
    margin-top: 0.2rem;
}

.notification-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* ============================================
   AMIGOS
   ============================================ */
.friend-item, .request-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    background: rgba(74, 127, 255, 0.05);
    border-radius: 0.8rem;
    margin-bottom: 0.5rem;
    transition: background 0.3s;
}

.friend-item:hover, .request-item:hover {
    background: rgba(74, 127, 255, 0.1);
}

.friend-item img, .request-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #2e3545;
}

.btn-primary {
    background: #4a7fff;
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 0.8rem;
}

.btn-primary:hover {
    background: #3a6ae0;
}

.btn-danger {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 0.8rem;
}

.btn-danger:hover {
    background: #e05555;
}

/* ============================================
   MENSAJES / CHAT
   ============================================ */
.messages-container {
    display: flex;
    height: calc(100vh - 160px);
    background: rgba(11, 14, 24, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid #2e3545;
    border-radius: 1rem;
    overflow: hidden;
}

.chat-list {
    width: 300px;
    border-right: 1px solid #2e3545;
    padding: 1rem;
    overflow-y: auto;
}

.chat-list h3 {
    color: #e3e9f5;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.3s;
}

.chat-item:hover {
    background: rgba(74, 127, 255, 0.08);
}

.chat-item.active {
    background: rgba(74, 127, 255, 0.15);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #2e3545;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name {
    color: #e3e9f5;
    font-size: 0.9rem;
    font-weight: 500;
}

.chat-last-message {
    color: #5a6480;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #2e3545;
    margin-bottom: 1rem;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.chat-header-info .chat-avatar {
    width: 32px;
    height: 32px;
}

#chatTimer {
    color: #5a6480;
    font-size: 0.8rem;
}

.btn-close {
    background: transparent;
    border: none;
    color: #5a6480;
    cursor: pointer;
    padding: 0.3rem 0.8rem;
    border-radius: 0.3rem;
    transition: all 0.3s;
    font-size: 0.8rem;
}

.btn-close:hover {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    min-height: 200px;
}

.empty-chat, .chat-expired, .chat-closed {
    text-align: center;
    padding: 3rem 1rem;
    color: #5a6480;
}

.empty-chat p, .chat-expired p, .chat-closed p {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.empty-chat small, .chat-expired small, .chat-closed small {
    font-size: 0.8rem;
}

.message {
    margin-bottom: 0.8rem;
    display: flex;
    animation: fadeIn 0.3s ease;
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 0.6rem 1rem;
    border-radius: 1rem;
    word-wrap: break-word;
}

.message.sent .message-bubble {
    background: #4a7fff;
    color: white;
    border-bottom-right-radius: 0.3rem;
}

.message.received .message-bubble {
    background: #2e3545;
    color: #e3e9f5;
    border-bottom-left-radius: 0.3rem;
}

.message-bubble small {
    display: block;
    font-size: 0.6rem;
    opacity: 0.7;
    margin-top: 0.2rem;
    text-align: right;
}

.chat-input {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
}

.chat-input input {
    flex: 1;
    padding: 0.8rem;
    border: 1px solid #2e3545;
    background: #0b0e18;
    color: #e3e9f5;
    border-radius: 0.8rem;
    font-size: 0.9rem;
}

.chat-input input:focus {
    outline: none;
    border-color: #4a7fff;
}

.chat-input button {
    padding: 0.8rem 1.5rem;
    background: #4a7fff;
    color: white;
    border: none;
    border-radius: 0.8rem;
    cursor: pointer;
    transition: background 0.3s;
}

.chat-input button:hover {
    background: #3a6ae0;
}

/* ============================================
   PERFIL
   ============================================ */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(11, 14, 24, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid #2e3545;
    border-radius: 1rem;
    overflow: hidden;
}

.profile-cover {
    width: 100%;
    height: 200px;
    background: linear-gradient(145deg, #2e3545, #1a1f2b);
    overflow: hidden;
}

.profile-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    text-align: center;
    padding: 0 2rem 2rem;
    margin-top: -60px;
    position: relative;
    z-index: 1;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid #1a1f2b;
    object-fit: cover;
    background: #2e3545;
}

.profile-info h2 {
    color: #e3e9f5;
    font-size: 1.8rem;
    margin-top: 0.5rem;
}

.profile-info .username {
    color: #8892a8;
    font-size: 0.9rem;
}

.profile-info .bio {
    color: #b0b8c8;
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #2e3545;
    margin-top: 1rem;
}

.profile-stats span {
    color: #8892a8;
    font-size: 0.9rem;
}

.profile-stats span strong {
    color: #e3e9f5;
    display: block;
    font-size: 1.2rem;
}

/* ============================================
   ANIMACIONES
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   SCROLL PERSONALIZADO
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(11, 14, 24, 0.5);
}

::-webkit-scrollbar-thumb {
    background: #2e3545;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a7fff;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
    }
    
    .header-nav {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .nav-btn {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
    
    .esqueleto-wrapper {
        width: 150px;
        height: 200px;
        left: 2%;
    }
    
    .paraguas {
        width: 80px;
        top: -40px;
        left: -10px;
    }
    
    .notifications-container {
        width: 250px;
        right: 10px;
        top: 10px;
    }
    
    .messages-container {
        flex-direction: column;
        height: calc(100vh - 140px);
    }
    
    .chat-list {
        width: 100%;
        max-height: 150px;
        border-right: none;
        border-bottom: 1px solid #2e3545;
    }
    
    .profile-cover {
        height: 120px;
    }
    
    .profile-avatar {
        width: 80px;
        height: 80px;
    }
    
    .profile-info {
        margin-top: -40px;
    }
    
    .login-box {
        padding: 2rem;
    }
    
    .login-box h1 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .esqueleto-wrapper {
        width: 100px;
        height: 140px;
        bottom: 5%;
        left: 1%;
    }
    
    .paraguas {
        width: 60px;
        top: -30px;
        left: -5px;
    }
    
    .notifications-container {
        width: 200px;
        right: 5px;
        padding: 0.5rem;
    }
    
    .texto-goodbye {
        font-size: 1.8rem;
    }
    
    .header-nav {
        gap: 0.2rem;
    }
    
    .nav-btn {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
}

/* ============================================
   MENSAJE DE BIENVENIDA
   ============================================ */
.mensaje-bienvenida {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    color: #e3e9f5;
    pointer-events: none;
}

.mensaje-bienvenida h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    color: #ffffff;
    text-shadow: 
        0 0 40px rgba(74, 127, 255, 0.3),
        0 4px 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5rem;
    animation: fadeInUp 1s ease;
}

.mensaje-bienvenida p {
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: #b0c4de;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6);
    margin-bottom: 0.3rem;
}

.mensaje-bienvenida .pequeno {
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: #8892a8;
    font-style: italic;
    margin-top: 0.5rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(30px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0);
    }
}

/* ============================================
   AMIGOS - BÚSQUEDA
   ============================================ */
.friends-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

.buscador-container {
    background: rgba(11, 14, 24, 0.8);
    border: 1px solid #2e3545;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.buscador-container h3 {
    color: #e3e9f5;
    margin-bottom: 1rem;
}

.buscador-input {
    display: flex;
    gap: 0.5rem;
}

.buscador-input input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid #2e3545;
    background: #0b0e18;
    color: #e3e9f5;
    border-radius: 0.8rem;
    font-size: 1rem;
}

.buscador-input input:focus {
    outline: none;
    border-color: #4a7fff;
}

.buscador-input button {
    padding: 0.8rem 2rem;
}

/* Resultados de búsqueda */
.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: rgba(74, 127, 255, 0.05);
    border-radius: 0.8rem;
    margin-top: 0.5rem;
    border: 1px solid rgba(46, 53, 69, 0.5);
}

.search-result-item:hover {
    background: rgba(74, 127, 255, 0.1);
}

.search-result-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #2e3545;
}

.search-result-name {
    color: #e3e9f5;
    font-weight: 500;
}

.search-result-username {
    color: #8892a8;
    font-size: 0.85rem;
}

.btn-agregar {
    background: #4a7fff;
    color: white;
    border: none;
    padding: 0.4rem 1.2rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
}

.btn-agregar:hover {
    background: #3a6ae0;
    transform: scale(1.05);
}

.btn-agregar:disabled {
    background: #2e3545;
    cursor: not-allowed;
    transform: none;
}

.btn-agregar.solicitado {
    background: #fbbf24;
    color: #1a1f2b;
}

.btn-agregar.amigo {
    background: #4ade80;
    color: #1a1f2b;
}

.btn-agregar.error {
    background: #f87171;
    color: #1a1f2b;
}

.mensaje-vacio {
    color: #5a6480;
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

.solicitudes-container {
    background: rgba(11, 14, 24, 0.8);
    border: 1px solid #2e3545;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.solicitudes-container h3 {
    color: #e3e9f5;
    margin-bottom: 1rem;
}

.amigos-container {
    background: rgba(11, 14, 24, 0.8);
    border: 1px solid #2e3545;
    border-radius: 1rem;
    padding: 1.5rem;
}

.amigos-container h3 {
    color: #e3e9f5;
    margin-bottom: 1rem;
}

.friend-item, .request-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: rgba(74, 127, 255, 0.05);
    border-radius: 0.8rem;
    margin-bottom: 0.5rem;
}

.friend-item:hover, .request-item:hover {
    background: rgba(74, 127, 255, 0.1);
}

.friend-item .friend-info, .request-item .request-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.friend-item img, .request-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #2e3545;
}

.request-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-aceptar {
    background: #4ade80;
    color: #1a1f2b;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-aceptar:hover {
    background: #34d399;
    transform: scale(1.05);
}

.btn-rechazar {
    background: #f87171;
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-rechazar:hover {
    background: #ef4444;
    transform: scale(1.05);
}

/* ============================================
   TOAST NOTIFICATIONS (emergentes)
   ============================================ */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: rgba(11, 14, 24, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid #2e3545;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.4s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    transition: all 0.3s ease;
    min-width: 250px;
}

.toast-success {
    border-left: 4px solid #4ade80;
}

.toast-error {
    border-left: 4px solid #f87171;
}

.toast-warning {
    border-left: 4px solid #fbbf24;
}

.toast-info {
    border-left: 4px solid #60a5fa;
}

.toast-friend {
    border-left: 4px solid #a78bfa;
}

.toast-chat {
    border-left: 4px solid #34d399;
}

.toast-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    color: #e3e9f5;
    font-size: 0.9rem;
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    color: #5a6480;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.3s;
}

.toast-close:hover {
    color: #e3e9f5;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive toasts */
@media (max-width: 600px) {
    .toast-container {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        min-width: auto;
        padding: 12px 14px;
    }
}

/* ✅ Ocultar el icono en el panel de notificaciones */
.notification-item .notification-icon {
    display: none !important;
}

/* ✅ Ajustar el padding cuando no hay icono */
.notification-item .notification-text {
    padding-left: 0 !important;
}

/* ✅ Mantener el icono SOLO en los toasts */
.toast .toast-icon {
    display: flex !important;
}

/* ✅ Ocultar iconos en el panel de notificaciones */
.notification-item .notification-icon {
    display: none !important;
}

/* ✅ Ajustar padding del texto en el panel */
.notification-item .notification-text {
    padding-left: 0 !important;
}

/* ✅ Mantener iconos en los toasts */
.toast .toast-icon {
    display: flex !important;
    font-size: 1.4rem !important;
}

.btn-secondary {
    background: transparent;
    color: #8892a8;
    border: 1px solid #2e3545;
    padding: 0.8rem 1.5rem;
    border-radius: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: rgba(46, 53, 69, 0.3);
    color: #e3e9f5;
}

/* ============================================
   BOTÓN DE LIMPIAR
   ============================================ */
.btn-secondary {
    background: transparent;
    color: #8892a8;
    border: 1px solid #2e3545;
    padding: 0.8rem 1.5rem;
    border-radius: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: rgba(46, 53, 69, 0.3);
    color: #e3e9f5;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: rgba(26, 31, 43, 0.95);
    border: 1px solid #2e3545;
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.modal-content h3 {
    color: #e3e9f5;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.modal-content p {
    color: #8892a8;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-buttons .btn-primary,
.modal-buttons .btn-danger {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 0.8rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-buttons .btn-primary {
    background: #4a7fff;
    color: white;
}

.modal-buttons .btn-primary:hover {
    background: #3a6ae0;
    transform: scale(1.02);
}

.modal-buttons .btn-danger {
    background: #f87171;
    color: white;
}

.modal-buttons .btn-danger:hover {
    background: #ef4444;
    transform: scale(1.02);
}

/* ============================================
   INDICADOR DE ESCRITURA
   ============================================ */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
    background: rgba(46, 53, 69, 0.5);
    border-radius: 1rem;
    max-width: 100px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #8892a8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ============================================
   IMÁGENES EN CHAT
   ============================================ */
.image-message {
    padding: 4px !important;
    background: transparent !important;
}

.image-message img.chat-image {
    max-width: 250px;
    max-height: 250px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.image-message img.chat-image:hover {
    transform: scale(1.02);
}

.message.sent .image-message img.chat-image {
    border-color: rgba(74, 127, 255, 0.3);
}

.message.received .image-message img.chat-image {
    border-color: rgba(46, 53, 69, 0.5);
}

/* ============================================
   PREVISUALIZACIÓN DE IMAGEN (MODAL)
   ============================================ */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    cursor: pointer;
}

.image-preview-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.image-preview-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.image-preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.3s;
}

.image-preview-close:hover {
    transform: scale(1.2);
}

/* ============================================
   BOTÓN DE SUBIR IMAGEN
   ============================================ */
.btn-image-upload {
    background: transparent;
    border: 1px solid #2e3545;
    color: #8892a8;
    padding: 0.6rem 1rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.btn-image-upload:hover {
    background: rgba(46, 53, 69, 0.3);
    color: #e3e9f5;
}

/* ============================================
   RESPONSIVE IMÁGENES
   ============================================ */
@media (max-width: 600px) {
    .image-message img.chat-image {
        max-width: 180px;
        max-height: 180px;
    }
    
    .image-preview-content {
        max-width: 95%;
    }
}

/* ============================================
   PERFIL - VERSIÓN COMPLETA
   ============================================ */
.profile-container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(11, 14, 24, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid #2e3545;
    border-radius: 1.5rem;
    overflow: hidden;
    padding-bottom: 2rem;
}

/* ========== PORTADA ========== */
.profile-cover {
    position: relative;
    width: 100%;
    height: 280px;
    background: linear-gradient(145deg, #1a1f2b, #2e3545);
    overflow: hidden;
}

.profile-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-cover img:not([src]), 
.profile-cover img[src=""] {
    display: none;
}

.btn-edit-cover {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.2rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    z-index: 5;
}

.btn-edit-cover:hover {
    background: rgba(74, 127, 255, 0.8);
    border-color: #4a7fff;
    transform: scale(1.02);
}

/* ========== AVATAR ========== */
.profile-avatar-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin: -70px auto 0;
    z-index: 2;
}

.profile-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 4px solid #1a1f2b;
    object-fit: cover;
    background: #2e3545;
}

.profile-avatar:not([src]), 
.profile-avatar[src=""] {
    content: '';
    background: #2e3545;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5a6480;
    font-size: 3rem;
}

.btn-edit-avatar {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(74, 127, 255, 0.9);
    color: #fff;
    border: 2px solid #1a1f2b;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 5;
}

.btn-edit-avatar:hover {
    background: #4a7fff;
    transform: scale(1.1);
}

/* ========== INFORMACIÓN ========== */
.profile-info {
    padding: 1.5rem 2rem 0;
    text-align: center;
}

/* Modo visualización */
#profileView {
    padding: 1rem 0;
}

.profile-name {
    font-size: 2rem;
    font-weight: 700;
    color: #e3e9f5;
    margin: 0 0 0.2rem 0;
}

.profile-username {
    font-size: 1rem;
    color: #8892a8;
    margin: 0 0 0.5rem 0;
}

.profile-bio {
    font-size: 0.95rem;
    color: #b0b8c8;
    max-width: 500px;
    margin: 0.5rem auto 1rem;
    line-height: 1.6;
}

.profile-bio:empty,
.profile-bio:not(:has(*)) {
    color: #5a6480;
    font-style: italic;
}

.btn-edit-profile {
    padding: 0.6rem 2rem;
    background: transparent;
    color: #8892a8;
    border: 1px solid #2e3545;
    border-radius: 2rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-edit-profile:hover {
    background: rgba(74, 127, 255, 0.1);
    color: #e3e9f5;
    border-color: #4a7fff;
}

/* Modo edición */
#profileEdit {
    padding: 0.5rem 0;
}

.profile-edit-fields {
    max-width: 500px;
    margin: 0 auto;
    text-align: left;
}

.profile-field {
    margin-bottom: 1.2rem;
}

.profile-field label {
    display: block;
    color: #8892a8;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}

.profile-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #2e3545;
    background: #0b0e18;
    color: #e3e9f5;
    border-radius: 0.8rem;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.profile-input:focus {
    outline: none;
    border-color: #4a7fff;
    box-shadow: 0 0 0 3px rgba(74, 127, 255, 0.1);
}

.profile-textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #2e3545;
    background: #0b0e18;
    color: #e3e9f5;
    border-radius: 0.8rem;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    transition: border-color 0.3s;
    line-height: 1.5;
}

.profile-textarea:focus {
    outline: none;
    border-color: #4a7fff;
    box-shadow: 0 0 0 3px rgba(74, 127, 255, 0.1);
}

.profile-edit-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.btn-save-profile {
    padding: 0.8rem 2rem;
    background: #4a7fff;
    color: #fff;
    border: none;
    border-radius: 0.8rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
}

.btn-save-profile:hover {
    background: #3a6ae0;
    transform: scale(1.02);
}

.btn-cancel-edit {
    padding: 0.8rem 2rem;
    background: transparent;
    color: #8892a8;
    border: 1px solid #2e3545;
    border-radius: 0.8rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancel-edit:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
    border-color: #f87171;
}

.profile-message {
    margin-top: 0.8rem;
    font-size: 0.9rem;
    min-height: 1.5rem;
    text-align: center;
}

.profile-message.success {
    color: #4ade80;
}

.profile-message.error {
    color: #f87171;
}

/* ========== ESTADÍSTICAS ========== */
.profile-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid #2e3545;
    margin-top: 1rem;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #e3e9f5;
}

.stat-label {
    font-size: 0.8rem;
    color: #5a6480;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== AMIGOS EN PERFIL ========== */
.profile-friends-section {
    padding: 0 2rem;
}

.profile-friends-section h3 {
    color: #e3e9f5;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #2e3545;
}

.profile-friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.8rem;
}

.profile-friend-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    background: rgba(74, 127, 255, 0.04);
    border-radius: 0.8rem;
    border: 1px solid rgba(46, 53, 69, 0.5);
    transition: all 0.3s;
}

.profile-friend-card:hover {
    background: rgba(74, 127, 255, 0.08);
    transform: translateY(-2px);
    border-color: rgba(74, 127, 255, 0.2);
}

.profile-friend-card img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #2e3545;
}

.profile-friend-card .friend-info {
    flex: 1;
    min-width: 0;
}

.profile-friend-card .friend-name {
    color: #e3e9f5;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-friend-card .friend-username {
    color: #5a6480;
    font-size: 0.7rem;
}

.profile-friend-card .friend-status {
    font-size: 0.8rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .profile-cover {
        height: 180px;
    }
    
    .profile-avatar-container {
        width: 100px;
        height: 100px;
        margin-top: -50px;
    }
    
    .profile-avatar {
        width: 100px;
        height: 100px;
    }
    
    .profile-name {
        font-size: 1.5rem;
    }
    
    .profile-info {
        padding: 1rem 1rem 0;
    }
    
    .profile-edit-actions {
        flex-direction: column;
    }
    
    .profile-friends-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .profile-stats {
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .btn-edit-cover {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
}

@media (max-width: 480px) {
    .profile-cover {
        height: 140px;
    }
    
    .profile-avatar-container {
        width: 80px;
        height: 80px;
        margin-top: -40px;
    }
    
    .profile-avatar {
        width: 80px;
        height: 80px;
    }
    
    .profile-friends-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   ESTILOS PARA PERFIL DE AMIGOS
   ============================================ */

/* Botón de ver perfil en tarjetas de amigos */
.btn-view-profile {
    background: #4a90d9;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    font-family: 'Playfair Display', serif;
}

.btn-view-profile:hover {
    background: #357abd;
    transform: scale(1.05);
}

/* Tarjeta de amigo clickeable */
.friend-card {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.friend-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
    border-color: rgba(74, 144, 217, 0.5);
}

.friend-card .friend-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.friend-card .friend-info {
    flex: 1;
}

.friend-card .friend-name {
    font-weight: bold;
    color: #e0e7ff;
    font-size: 16px;
}

.friend-card .friend-username {
    color: #94a3b8;
    font-size: 13px;
}

.friend-card .friend-status {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

/* Botón de volver al perfil propio */
.btn-back-profile {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    z-index: 10;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-back-profile:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
}

/* Profile container debe tener position relative */
.profile-container {
    position: relative;
    padding-bottom: 30px;
}

/* Ajuste para el grid de amigos en el perfil */
.profile-friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.profile-friend-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.profile-friend-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
    border-color: rgba(74, 144, 217, 0.5);
}

.profile-friend-card img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.profile-friend-card .friend-info {
    margin: 8px 0;
}

.profile-friend-card .friend-name {
    color: #e0e7ff;
    font-weight: bold;
    font-size: 14px;
}

.profile-friend-card .friend-username {
    color: #94a3b8;
    font-size: 12px;
}

.profile-friend-card .friend-status {
    font-size: 14px;
}

/* Mensaje de perfil amigo */
.profile-friend-indicator {
    background: rgba(74, 144, 217, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    color: #93c5fd;
    font-size: 13px;
    display: inline-block;
    margin-bottom: 15px;
    border: 1px solid rgba(74, 144, 217, 0.3);
}

/* ============================================
   CORRECCIÓN: PORTADA Y AVATAR CENTRADO
   ============================================ */

/* ✅ Asegurar que la portada se muestre correctamente */
.profile-cover {
    position: relative;
    width: 100%;
    height: 280px;
    background: linear-gradient(145deg, #1a1f2b, #2e3545);
    overflow: hidden;
    border-radius: 1.5rem 1.5rem 0 0;
}

.profile-cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

/* ✅ Forzar que la imagen de portada se muestre incluso si no tiene src válido */
.profile-cover img:not([src]), 
.profile-cover img[src=""],
.profile-cover img[src="undefined"],
.profile-cover img[src="null"] {
    display: none !important;
}

/* ✅ Avatar centrado (restaurar estilo original) */
.profile-avatar-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin: -70px auto 0 !important;  /* ← Esto centra el avatar */
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
}

.profile-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 4px solid #1a1f2b;
    object-fit: cover;
    background: #2e3545;
    display: block;
}

/* ✅ Asegurar que el avatar se muestre correctamente */
.profile-avatar:not([src]), 
.profile-avatar[src=""],
.profile-avatar[src="undefined"] {
    display: none;
}

/* ✅ Indicador de perfil de amigo - mejor posición */
.profile-friend-indicator {
    background: rgba(74, 144, 217, 0.25);
    padding: 8px 20px;
    border-radius: 20px;
    color: #93c5fd;
    font-size: 14px;
    display: inline-block;
    margin: 10px auto 0;
    border: 1px solid rgba(74, 144, 217, 0.3);
    backdrop-filter: blur(10px);
    text-align: center;
    width: fit-content;
}

/* ✅ Asegurar que el contenedor del perfil tenga el layout correcto */
.profile-container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(11, 14, 24, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid #2e3545;
    border-radius: 1.5rem;
    overflow: hidden;
    padding-bottom: 2rem;
    position: relative;
}

/* ✅ La información del perfil debe estar centrada */
.profile-info {
    padding: 1.5rem 2rem 0;
    text-align: center;
}

/* ✅ Botón de volver - posición corregida */
.btn-back-profile {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    z-index: 20;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-back-profile:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
}

/* ✅ Ajuste responsive */
@media (max-width: 768px) {
    .profile-cover {
        height: 180px;
    }
    
    .profile-avatar-container {
        width: 100px;
        height: 100px;
        margin-top: -50px !important;
    }
    
    .profile-avatar {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    .profile-cover {
        height: 140px;
    }
    
    .profile-avatar-container {
        width: 80px;
        height: 80px;
        margin-top: -40px !important;
    }
    
    .profile-avatar {
        width: 80px;
        height: 80px;
    }
}

/* ============================================
   PORTADA CON AJUSTE DE POSICIÓN
   ============================================ */

.profile-cover {
    position: relative;
    width: 100%;
    height: 280px;
    background: linear-gradient(145deg, #1a1f2b, #2e3545);
    overflow: hidden;
    border-radius: 1.5rem 1.5rem 0 0;
}

.cover-image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.cover-image-wrapper img {
    width: 100%;
    height: 120%; /* Más altura para permitir desplazamiento */
    object-fit: cover;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    transition: none;
    image-rendering: auto;
}

.btn-edit-cover {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.2rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    z-index: 5;
}

.btn-edit-cover:hover {
    background: rgba(74, 127, 255, 0.8);
    border-color: #4a7fff;
    transform: scale(1.02);
}

.btn-adjust-cover {
    position: absolute;
    bottom: 16px;
    right: 160px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.2rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    z-index: 5;
}

.btn-adjust-cover:hover {
    background: rgba(74, 127, 255, 0.8);
    border-color: #4a7fff;
    transform: scale(1.02);
}

/* Control de ajuste de portada */
.cover-adjust-control {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 12px;
    z-index: 10;
    min-width: 300px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.cover-adjust-control label {
    color: #e3e9f5;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 10px;
}

.cover-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.cover-slider-container span {
    color: #8892a8;
    font-size: 1.2rem;
}

#coverPositionSlider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #2e3545, #4a7fff);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

#coverPositionSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a7fff;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(74, 127, 255, 0.4);
}

#coverPositionSlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a7fff;
    cursor: pointer;
    border: 2px solid #fff;
}

.cover-adjust-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 8px;
}

.btn-save-cover-position {
    background: #4ade80;
    color: #1a1f2b;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-save-cover-position:hover {
    background: #34d399;
    transform: scale(1.02);
}

.btn-cancel-cover-adjust {
    background: rgba(255, 255, 255, 0.1);
    color: #8892a8;
    border: 1px solid #2e3545;
    padding: 0.5rem 1.5rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.btn-cancel-cover-adjust:hover {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
    border-color: #f87171;
}

#coverPositionValue {
    color: #8892a8;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .profile-cover {
        height: 180px;
    }
    
    .btn-adjust-cover {
        right: 130px;
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
    
    .btn-edit-cover {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
    
    .cover-adjust-control {
        min-width: 250px;
        padding: 12px 18px;
        bottom: 60px;
    }
    
    .cover-adjust-control label {
        font-size: 0.8rem;
    }
    
    .btn-save-cover-position,
    .btn-cancel-cover-adjust {
        font-size: 0.75rem;
        padding: 0.4rem 1rem;
    }
}

/* ============================================
   PORTADA CON AJUSTE DE POSICIÓN - CORREGIDO
   ============================================ */

.profile-cover {
    position: relative;
    width: 100%;
    height: 280px;
    background: linear-gradient(145deg, #1a1f2b, #2e3545);
    overflow: hidden;
    border-radius: 1.5rem 1.5rem 0 0;
}

/* ✅ Contenedor de la imagen - oculta el exceso */
.cover-image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* ✅ La imagen es más grande para permitir desplazamiento */
.cover-image-wrapper img {
    width: 100%;
    height: 150% !important; /* Más altura para desplazamiento */
    object-fit: cover;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    transition: none;
    /* La posición top se controla desde JS */
}

/* ✅ Botones en la portada */
.btn-edit-cover {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.2rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    z-index: 5;
}

.btn-edit-cover:hover {
    background: rgba(74, 127, 255, 0.8);
    border-color: #4a7fff;
    transform: scale(1.02);
}

.btn-adjust-cover {
    position: absolute;
    bottom: 16px;
    right: 170px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.2rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    z-index: 5;
}

.btn-adjust-cover:hover {
    background: rgba(74, 127, 255, 0.8);
    border-color: #4a7fff;
    transform: scale(1.02);
}

/* ✅ Control de ajuste - UI mejorada */
.cover-adjust-control {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(11, 14, 24, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 30px;
    border-radius: 16px;
    z-index: 10;
    min-width: 320px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.cover-adjust-control label {
    color: #e3e9f5;
    font-size: 0.95rem;
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
}

.cover-slider-container {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.cover-slider-container span {
    color: #8892a8;
    font-size: 1.4rem;
    font-weight: 300;
}

#coverPositionSlider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #2e3545, #4a7fff);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

#coverPositionSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a7fff;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 10px rgba(74, 127, 255, 0.5);
    transition: all 0.2s;
}

#coverPositionSlider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

#coverPositionSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a7fff;
    cursor: pointer;
    border: 2px solid #fff;
}

.cover-adjust-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 10px;
}

.btn-save-cover-position {
    background: #4ade80;
    color: #1a1f2b;
    border: none;
    padding: 0.6rem 1.8rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-save-cover-position:hover {
    background: #34d399;
    transform: scale(1.03);
}

.btn-cancel-cover-adjust {
    background: rgba(255, 255, 255, 0.08);
    color: #8892a8;
    border: 1px solid #2e3545;
    padding: 0.6rem 1.8rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.btn-cancel-cover-adjust:hover {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
    border-color: #f87171;
}

#coverPositionValue {
    color: #8892a8;
    font-size: 13px;
    display: block;
    margin-top: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .profile-cover {
        height: 200px;
    }
    
    .btn-adjust-cover {
        right: 140px;
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
    
    .btn-edit-cover {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
    
    .cover-adjust-control {
        min-width: 280px;
        padding: 15px 20px;
        bottom: 55px;
    }
    
    .cover-adjust-control label {
        font-size: 0.8rem;
    }
    
    .btn-save-cover-position,
    .btn-cancel-cover-adjust {
        font-size: 0.75rem;
        padding: 0.4rem 1.2rem;
    }
}

@media (max-width: 480px) {
    .profile-cover {
        height: 150px;
    }
    
    .cover-adjust-control {
        min-width: 220px;
        padding: 12px 15px;
        bottom: 50px;
    }
    
    .cover-adjust-control label {
        font-size: 0.7rem;
    }
    
    .btn-adjust-cover {
        right: 100px;
        font-size: 0.6rem;
        padding: 0.3rem 0.6rem;
    }
    
    .btn-edit-cover {
        font-size: 0.6rem;
        padding: 0.3rem 0.6rem;
    }
}

/* ============================================
   PORTADA CON ARRASTRE - CORREGIDO
   ============================================ */

.profile-cover {
    position: relative;
    width: 100%;
    height: 280px;
    background: linear-gradient(145deg, #1a1f2b, #2e3545);
    overflow: hidden;
    border-radius: 1.5rem 1.5rem 0 0;
    cursor: default;
}

.profile-cover.dragging {
    cursor: grabbing;
}

.profile-cover .cover-image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* ✅ La imagen es mucho más grande para permitir desplazamiento extremo */
.profile-cover .cover-image-wrapper img {
    width: 100%;
    height: 300% !important; /* 3 veces la altura para movimiento amplio */
    object-fit: cover;
    display: block;
    position: absolute;
    top: -100%; /* Comienza centrada */
    left: 0;
    transition: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* ✅ Modo ajuste activo - la imagen se puede arrastrar */
.profile-cover.adjusting .cover-image-wrapper img {
    pointer-events: auto;
    cursor: grab;
}

.profile-cover.adjusting.dragging .cover-image-wrapper img {
    cursor: grabbing;
}

/* ✅ Overlay de instrucciones */
.cover-drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 2;
}

.profile-cover.adjusting .cover-drag-overlay {
    opacity: 1;
}

.cover-drag-overlay span {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

/* ✅ Botones */
.btn-edit-cover {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.2rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    z-index: 5;
}

.btn-edit-cover:hover {
    background: rgba(74, 127, 255, 0.8);
    border-color: #4a7fff;
    transform: scale(1.02);
}

.btn-adjust-cover {
    position: absolute;
    bottom: 16px;
    right: 170px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.2rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    z-index: 5;
}

.btn-adjust-cover:hover {
    background: rgba(74, 127, 255, 0.8);
    border-color: #4a7fff;
    transform: scale(1.02);
}

/* ✅ Control de ajuste */
.cover-adjust-control {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(11, 14, 24, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px 24px;
    border-radius: 16px;
    z-index: 10;
    min-width: 340px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.cover-adjust-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cover-adjust-header span {
    color: #e3e9f5;
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-close-adjust {
    background: transparent;
    border: none;
    color: #5a6480;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.3s;
}

.btn-close-adjust:hover {
    color: #f87171;
}

.cover-adjust-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: #8892a8;
}

.cover-hint {
    color: #4a7fff;
    font-size: 0.75rem;
}

.cover-adjust-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-save-cover-position {
    background: #4ade80;
    color: #1a1f2b;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    font-weight: 600;
    flex: 1;
}

.btn-save-cover-position:hover {
    background: #34d399;
    transform: scale(1.02);
}

.btn-reset-cover-position {
    background: rgba(255, 255, 255, 0.08);
    color: #8892a8;
    border: 1px solid #2e3545;
    padding: 0.5rem 1.5rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    flex: 1;
}

.btn-reset-cover-position:hover {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
    border-color: #f87171;
}

/* Responsive */
@media (max-width: 768px) {
    .profile-cover {
        height: 200px;
    }
    
    .btn-adjust-cover {
        right: 140px;
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
    
    .btn-edit-cover {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
    
    .cover-adjust-control {
        min-width: 280px;
        padding: 12px 16px;
        bottom: 55px;
    }
    
    .cover-adjust-header span {
        font-size: 0.8rem;
    }
    
    .cover-adjust-info {
        font-size: 0.7rem;
        flex-direction: column;
        gap: 4px;
    }
    
    .btn-save-cover-position,
    .btn-reset-cover-position {
        font-size: 0.75rem;
        padding: 0.4rem 1rem;
    }
}

@media (max-width: 480px) {
    .profile-cover {
        height: 150px;
    }
    
    .cover-adjust-control {
        min-width: 220px;
        padding: 10px 12px;
        bottom: 50px;
    }
    
    .btn-adjust-cover {
        right: 100px;
        font-size: 0.6rem;
        padding: 0.3rem 0.6rem;
    }
    
    .btn-edit-cover {
        font-size: 0.6rem;
        padding: 0.3rem 0.6rem;
    }
}

/* ============================================
   TELEGRAM STATUS
   ============================================ */
.profile-telegram-section {
    margin-top: 20px;
    padding: 20px;
    background: rgba(11, 14, 24, 0.6);
    border-radius: 12px;
    border: 1px solid #2e3545;
}

.profile-telegram-section h3 {
    color: #e3e9f5;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.telegram-status {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.telegram-status.connected {
    color: #4ade80;
}

.telegram-status.disconnected {
    color: #f87171;
}

.telegram-chat-id {
    font-size: 0.8rem;
    color: #5a6480;
    background: rgba(255,255,255,0.05);
    padding: 2px 10px;
    border-radius: 12px;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 0.8rem;
    border-radius: 12px;
}

.btn-primary.btn-sm {
    background: #4a7fff;
    color: white;
    border: none;
    cursor: pointer;
}

.btn-primary.btn-sm:hover {
    background: #3a6ae0;
}

.btn-danger.btn-sm {
    background: #f87171;
    color: white;
    border: none;
    cursor: pointer;
}

.btn-danger.btn-sm:hover {
    background: #ef4444;
}

/* ============================================
   BOT�N DAR TOQUE
   ============================================ */
.btn-tap {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    font-family: 'Playfair Display', serif;
}

.btn-tap:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(245, 87, 108, 0.6);
}

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

/* ============================================
   OCULTAR TELEGRAM EN PERFIL DE AMIGO
   ============================================ */
.profile-container.viewing-friend .profile-telegram-section,
.profile-container.viewing-friend #telegramSection {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================
   TELEGRAM STATUS
   ============================================ */
.profile-telegram-section {
    margin-top: 20px;
    padding: 20px;
    background: rgba(11, 14, 24, 0.6);
    border-radius: 12px;
    border: 1px solid #2e3545;
}

.profile-telegram-section h3 {
    color: #e3e9f5;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.telegram-status {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.telegram-status.connected {
    color: #4ade80;
}

.telegram-status.disconnected {
    color: #f87171;
}

.telegram-chat-id {
    font-size: 0.8rem;
    color: #5a6480;
    background: rgba(255,255,255,0.05);
    padding: 2px 10px;
    border-radius: 12px;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 0.8rem;
    border-radius: 12px;
    cursor: pointer;
}

.btn-primary.btn-sm {
    background: #4a7fff;
    color: white;
    border: none;
}

.btn-primary.btn-sm:hover {
    background: #3a6ae0;
}

.btn-danger.btn-sm {
    background: #f87171;
    color: white;
    border: none;
}

.btn-danger.btn-sm:hover {
    background: #ef4444;
}


/* En styles.css */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 20px;
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    margin: 20px 0;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #f0c27b;
    font-family: 'Playfair Display', serif;
}

.stat-label {
    font-size: 0.8rem;
    color: #8892a8;
    margin-top: 4px;
}




























/* ============================================
   SISTEMA DE MENSAJES - ESTILO FACEBOOK
   ============================================ */

/* --- Contenedor principal del input --- */
.chat-input-container {
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border-top: 1px solid rgba(255,255,255,0.06);
    position: relative;
}

/* --- Wrapper del input con botones --- */
.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* --- Botones de la barra de herramientas --- */
.toolbar-btn {
    background: transparent;
    border: none;
    color: #8892a8;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 50%;
    transition: all 0.2s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toolbar-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #e0e6ed;
    transform: scale(1.05);
}

/* --- Campo de input con emoji dentro --- */
.chat-input-field {
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 24px;
    padding: 0 4px 0 16px;
    transition: all 0.2s;
    position: relative;
}

.chat-input-field:focus-within {
    border-color: #f0c27b;
    background: rgba(255,255,255,0.08);
}

.chat-input-field input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 0;
    color: #e0e6ed;
    font-size: 0.95rem;
    outline: none;
    min-width: 0;
}

.chat-input-field input::placeholder {
    color: #5a6480;
}

/* --- Botón de emoji dentro del input --- */
.emoji-btn {
    background: transparent;
    border: none;
    color: #8892a8;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 50%;
    transition: all 0.2s;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.emoji-btn:hover {
    color: #e0e6ed;
    background: rgba(255,255,255,0.05);
}

/* --- Botón de enviar --- */
.send-btn {
    background: linear-gradient(135deg, #f0c27b, #fc5c7d);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
}

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

/* --- Previsualización de respuesta --- */
#replyPreview {
    padding: 8px 12px;
    margin-bottom: 4px;
    background: rgba(240, 194, 123, 0.08);
    border-left: 3px solid #f0c27b;
    border-radius: 8px;
}

.reply-preview-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reply-arrow {
    color: #f0c27b;
    font-size: 1rem;
}

.reply-text {
    flex: 1;
    color: #8892a8;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reply-cancel {
    background: none;
    border: none;
    color: #5a6480;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
}

.reply-cancel:hover {
    color: #ff6b6b;
}

/* ============================================
   MENSAJES Y HOVER MENU - CORREGIDO
   ============================================ */

/* --- Contenedor de mensajes --- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* --- Cada mensaje --- */
.message {
    position: relative;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    max-width: 85%;
    padding: 2px 0;
}

.message.sent {
    align-self: flex-end;
    align-items: flex-end;
}

.message.received {
    align-self: flex-start;
    align-items: flex-start;
}

/* --- Burbuja del mensaje --- */
.message-bubble {
    padding: 8px 14px;
    border-radius: 18px;
    position: relative;
    word-break: break-word;
    max-width: 100%;
    cursor: default;
}

.message.sent .message-bubble {
    background: linear-gradient(135deg, #f0c27b, #fc5c7d);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
    background: rgba(255,255,255,0.06);
    color: #e0e6ed;
    border-bottom-left-radius: 4px;
}

.message-bubble p {
    margin: 0;
    line-height: 1.4;
    font-size: 0.95rem;
}

.message-bubble small {
    font-size: 0.65rem;
    opacity: 0.6;
    display: block;
    margin-top: 4px;
}

/* --- Mensaje respondido (dentro del bubble) --- */
.message-reply-preview {
    padding: 6px 10px;
    margin-bottom: 6px;
    background: rgba(255,255,255,0.05);
    border-left: 3px solid rgba(240, 194, 123, 0.6);
    border-radius: 6px;
    font-size: 0.75rem;
}

.message-reply-preview .reply-label {
    color: #f0c27b;
    font-size: 0.65rem;
    font-weight: bold;
}

.message-reply-preview .reply-text-preview {
    color: #8892a8;
    font-size: 0.75rem;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message.sent .message-reply-preview .reply-text-preview {
    color: rgba(255,255,255,0.7);
}

/* ============================================
   HOVER MENU - ESTILO FACEBOOK
   ============================================ */

/* --- El hover menu (oculto por defecto) --- */
.message-hover-menu {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    background: #1a1f2e;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 3px 5px;
    gap: 1px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    z-index: 50;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    white-space: nowrap;
}

/* --- Mostrar al hacer hover sobre el mensaje --- */
.message:hover .message-hover-menu {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* --- Posición según tipo de mensaje --- */
.message.sent .message-hover-menu {
    right: calc(100% + 8px);
}

.message.received .message-hover-menu {
    left: calc(100% + 8px);
}

/* --- Botones del hover menu --- */
.message-hover-menu button {
    background: none;
    border: none;
    color: #8892a8;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 5px;
    border-radius: 50%;
    transition: all 0.2s;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-hover-menu button:hover {
    background: rgba(255,255,255,0.06);
    color: #e0e6ed;
}

.message-hover-menu .react-btn:hover {
    color: #ff6b6b;
    background: rgba(255,107,107,0.1);
}

.message-hover-menu .reply-btn:hover {
    color: #f0c27b;
    background: rgba(240,194,123,0.1);
}

.message-hover-menu .more-btn:hover {
    color: #64b5f6;
    background: rgba(100,181,246,0.1);
}

/* ============================================
   REACCIONES
   ============================================ */

.message-reactions {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.message-reaction {
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 1px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 3px;
}

.message-reaction:hover {
    background: rgba(255,255,255,0.12);
    transform: scale(1.05);
}

.message-reaction .count {
    color: #8892a8;
    font-size: 0.7rem;
}

/* ============================================
   PANEL DE EMOJIS
   ============================================ */

#emojiPanel {
    background: #1a1f2e;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    position: absolute;
    bottom: 100%;
    right: 0;
    width: 280px;
    z-index: 1000;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.emoji {
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    text-align: center;
    border-radius: 8px;
    transition: all 0.15s;
    user-select: none;
}

.emoji:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.2);
}

/* --- Reaction picker flotante --- */
.reaction-picker {
    position: fixed;
    background: #1a1f2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 30px;
    padding: 6px 12px;
    display: flex;
    gap: 2px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    z-index: 9999;
}

.reaction-picker .reaction-emoji {
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 50%;
    transition: all 0.15s;
}

.reaction-picker .reaction-emoji:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.3);
}

/* ============================================
   MENÚ CONTEXTUAL (más opciones)
   ============================================ */

.message-context-menu {
    position: fixed;
    background: #1a1f2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 6px 0;
    min-width: 180px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    z-index: 10000;
    display: none;
}

.message-context-menu .menu-item {
    padding: 8px 16px;
    color: #e0e6ed;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.message-context-menu .menu-item:hover {
    background: rgba(255,255,255,0.06);
}

.message-context-menu .menu-item.danger {
    color: #ff6b6b;
}

.message-context-menu .menu-item.danger:hover {
    background: rgba(255,0,0,0.1);
}

/* ============================================
   PREVISUALIZACIÓN DE IMAGEN
   ============================================ */

#imagePreviewContainer {
    padding: 8px 4px;
    margin-bottom: 4px;
}

.image-preview-wrapper {
    position: relative;
    display: inline-block;
    max-width: 200px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.1);
}

.image-preview-wrapper img {
    width: 100%;
    height: auto;
    max-height: 150px;
    object-fit: cover;
    display: block;
}

.remove-image-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.remove-image-btn:hover {
    background: rgba(255,0,0,0.8);
    transform: scale(1.1);
}

/* --- Imagen en mensaje --- */
.chat-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-image:hover {
    opacity: 0.9;
}

.image-message .chat-image {
    display: block;
    margin-bottom: 4px;
}

/* --- Modal de previsualización de imagen --- */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    cursor: pointer;
}

.image-preview-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.image-preview-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
}

.image-preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

/* --- Empty state --- */
.empty-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #5a6480;
    text-align: center;
    padding: 40px;
}

.empty-chat p {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.empty-chat small {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* --- Typing indicator --- */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #5a6480;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

/* ============================================
   MENSAJES Y HOVER MENU - CORREGIDO
   ============================================ */

/* --- Contenedor de mensajes --- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* --- Cada mensaje - ahora ocupa todo el ancho --- */
.message {
    position: relative;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    padding: 4px 0;
    width: 100%;
    transition: background 0.15s ease;
    border-radius: 8px;
}

/* Pequeño indicador de hover en el fondo */
.message:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* --- Contenedor de la burbuja con alineación --- */
.message .message-row {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    position: relative;
}

.message.sent .message-row {
    align-self: flex-end;
    align-items: flex-end;
}

.message.received .message-row {
    align-self: flex-start;
    align-items: flex-start;
}

/* --- Burbuja del mensaje --- */
.message-bubble {
    padding: 8px 14px;
    border-radius: 18px;
    position: relative;
    word-break: break-word;
    max-width: 100%;
    cursor: default;
}

.message.sent .message-bubble {
    background: linear-gradient(135deg, #f0c27b, #fc5c7d);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
    background: rgba(255,255,255,0.06);
    color: #e0e6ed;
    border-bottom-left-radius: 4px;
}

.message-bubble p {
    margin: 0;
    line-height: 1.4;
    font-size: 0.95rem;
}

.message-bubble small {
    font-size: 0.65rem;
    opacity: 0.6;
    display: block;
    margin-top: 4px;
}

/* --- Mensaje respondido (dentro del bubble) --- */
.message-reply-preview {
    padding: 6px 10px;
    margin-bottom: 6px;
    background: rgba(255,255,255,0.05);
    border-left: 3px solid rgba(240, 194, 123, 0.6);
    border-radius: 6px;
    font-size: 0.75rem;
}

.message-reply-preview .reply-label {
    color: #f0c27b;
    font-size: 0.65rem;
    font-weight: bold;
}

.message-reply-preview .reply-text-preview {
    color: #8892a8;
    font-size: 0.75rem;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message.sent .message-reply-preview .reply-text-preview {
    color: rgba(255,255,255,0.7);
}

/* ============================================
   HOVER MENU - CORREGIDO
   ============================================ */

/* --- El hover menu --- */
.message-hover-menu {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    background: #1a1f2e;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 4px 6px;
    gap: 2px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    z-index: 50;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    white-space: nowrap;
}

/* --- Mostrar al hacer hover sobre el mensaje completo --- */
.message:hover .message-hover-menu {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* --- Posición según tipo de mensaje --- */
.message.sent .message-hover-menu {
    right: calc(100% + 8px);
}

.message.received .message-hover-menu {
    left: calc(100% + 8px);
}

/* --- Botones del hover menu --- */
.message-hover-menu button {
    background: none;
    border: none;
    color: #8892a8;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 5px;
    border-radius: 50%;
    transition: all 0.2s;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-hover-menu button:hover {
    background: rgba(255,255,255,0.06);
    color: #e0e6ed;
}

.message-hover-menu .react-btn:hover {
    color: #ff6b6b;
    background: rgba(255,107,107,0.1);
}

.message-hover-menu .reply-btn:hover {
    color: #f0c27b;
    background: rgba(240,194,123,0.1);
}

.message-hover-menu .more-btn:hover {
    color: #64b5f6;
    background: rgba(100,181,246,0.1);
}