/* static/css/messaging.css */

#id_content {
    resize: vertical;
    min-height: 50px;
    max-height: 280px;
}

#id_content::placeholder {
    color: #6c757d;
    font-style: italic;
}

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

.chat-container {
    height: 60vh;
    min-height: 400px;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    scroll-behavior: smooth;
    line-height: 1.2;
}

/* Personalizar scrollbar */
.chat-container::-webkit-scrollbar {
    width: 10px;
}

.chat-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #c9c7c7;
}

.message {
    /*position: relative;*/
    margin-bottom: 0.3rem;
    background-color: var(--color-ffffff);
    padding: 0.4rem 0.6rem;
    border-radius: 0.9rem;
    max-width: 60%;
    animation: fadeInUp 0.3s ease-out;
    line-height: 1.2;
}

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

.message.own {    
    font-weight: bold;
    border: 1px solid #dee2e6;
    color: rgb(21, 21, 21);
    margin-left: auto;
    text-align: right;
}

.message.other {
    font-weight: bold;
    color: rgb(21, 21, 21);
    border: 1px solid #dee2e6;
}

.message-sender {
    font-weight: bold;
    font-size: 1.275rem;
    margin-bottom: 0.1rem;
    line-height: 1.2;
}

.message-time {
    font-size: 1.15rem;
    opacity: 0.7;
    color: rgb(106, 108, 108);
    margin-top: 0.1rem;
    line-height: 1.1;
}

.room-list-item {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.2rem;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.2s ease;
    line-height: 1.2;
}

.room-list-item:hover {    
    background-color: var(--color-ffffff);
    text-decoration: none;
    color: inherit;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.room-list-item.active {
    background-color: var(--color-ffffff);
    border-color: #2196f3;
}

.unread-badge {
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 0.15rem 0.3rem;
    font-size: 0.7rem;
    font-weight: bold;
    animation: pulse 1s infinite;
    line-height: 1;
}

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

.message-input {
    position: sticky;
    bottom: 0;    
    background-color: var(--color-ffffff);
    padding: 0.6rem;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

/* Botón flotante para scroll */
#scrollToBottomBtn {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 1000;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: bounceIn 0.3s ease-out;
}

@keyframes bounceIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Estados de carga */
.message-sending {
    opacity: 0.6;
    background-color: #f8f9fa !important;
    border: 2px dashed #dee2e6 !important;
}

.message-sending::after {
    content: " ⏳";
}


/* Mejoras para dispositivos móviles */
@media (max-width: 768px) {
    .chat-container {
        height: 50vh;
        min-height: 300px;
        padding: 0.3rem;
    }
    
    .message {
        max-width: 85%;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.2rem;
    }
    
    .sidebar {
        height: auto;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        margin-bottom: 0.5rem;
        padding: 0.3rem;
    }
    
    #scrollToBottomBtn {
        bottom: 80px;
        right: 20px;
        width: 35px;
        height: 35px;
    }
    
    .message-input {
        padding: 0.4rem;
    }
    
    .room-list-item {
        padding: 0.4rem 0.6rem;
        margin-bottom: 0.1rem;
    }
}

/* Estilos para archivos adjuntos */
.file-attachment {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.15rem 0.3rem;
    margin: 0.1rem 0;
    display: inline-block;
    line-height: 1.2;
}

.file-attachment:hover {
    background-color: #e9ecef;
    text-decoration: none;
}

.image-attachment {
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
    margin: 0.1rem 0;
}

.image-attachment:hover {
    transform: scale(1.02);
    cursor: pointer;
}

/* Indicador de escritura (para futuras mejoras) */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 0.3rem 0.6rem;
    color: #6c757d;
    font-style: italic;
    line-height: 1.2;
}

.typing-indicator .dot {
    height: 6px;
    width: 6px;
    border-radius: 50%;
    background-color: #6c757d;
    display: inline-block;
    margin: 0 1px;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Estados especiales para mensajes */
.message-system {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    text-align: center;
    font-style: italic;
    margin: 0.2rem auto;
    max-width: 60%;
    padding: 0.3rem 0.5rem;
    line-height: 1.2;
}

.message-deleted {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    opacity: 0.7;
    line-height: 1.2;
}

.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.2s ease;
    margin-bottom: 0.5rem;
    padding: 0.75rem;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.navbar-brand {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    line-height: 1.2;
}

/* Reducción general de espaciado */
* {
    margin-block-start: 0;
    margin-block-end: 0;
}

p, h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.3rem;
    line-height: 1.2;
}

ul, ol {
    margin-top: 0;
    margin-bottom: 0.3rem;
    padding-left: 1.2rem;
}

li {
    margin-bottom: 0.1rem;
    line-height: 1.2;
}
