:root {
    --primary-color: #2196F3;
    --primary-dark: #1976D2;
    --background-dark: #000000; /* AMOLED Black */
    --surface-dark: #1A1A1A; /* Slightly lighter surface */
    --surface-dark-hover: #282828; /* Darker hover state */
    --text-primary: #FFFFFF;
    --text-secondary: #B0B0B0;
    --text-disabled: #757575;
    --error-color: #CF6679;
    --success-color: #4CAF50;
    --border-color: #333333; /* Darker border for AMOLED */
}

body {
    background-color: var(--background-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.message {
    max-width: 70%;
    padding: 0.75rem;
    border-radius: 1rem;
    margin: 0.25rem 0;
}

.message.sent {
    background-color: #0084ff;
    margin-left: auto;
    border-bottom-right-radius: 0.25rem;
}

.message.received {
    background-color: #1E1E1E;
    margin-right: auto;
    border-bottom-left-radius: 0.25rem;
}

.message-info {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    opacity: 0.8;
    color: var(--text-secondary);
}

/* Animación para nuevos mensajes */
@keyframes slideIn {
    from {
        opacity: 1;
        transform: none;
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.message {
    animation: slideIn 0.3s ease-out;
}

/* Estilo para el scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--text-disabled);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Estilos de app nativa */
.native-card {
    background-color: var(--surface-dark);
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4); /* More pronounced shadow */
}

.native-input {
    background-color: #2D2D2D;
    border: none;
    color: white;
    outline: none;
}

.native-input::placeholder {
    color: #9CA3AF;
}

/* Asegurar que el textarea use el mismo estilo y preserve el formato */
textarea.native-input {
    resize: none; /* Ya añadido en HTML, pero buena práctica en CSS también */
    white-space: pre-wrap; /* Preservar espacios en blanco y saltos de línea */
    word-wrap: break-word; /* Romper palabras largas si es necesario */
    height: 42px; /* Altura fija similar a la de un input, ajusta según necesites */
    overflow-y: auto; /* Permitir scroll vertical si el contenido excede la altura */
    /* Opcional: Ocultar la barra de scroll por defecto si quieres un look más limpio */
    /* &::-webkit-scrollbar { display: none; } */
    /* & { -ms-overflow-style: none; scrollbar-width: none; } */

    /* Estilos del input de emoji en el modal de perfil */
    #edit-user-emoji {
        /* Hereda estilos de .native-input */
        text-align: center; /* Centrar el texto/emoji */
        font-size: 1.5rem; /* Tamaño más grande para el emoji */
        padding-top: 0.5rem; /* Ajustar padding si es necesario */
        padding-bottom: 0.5rem;
    }
}

.native-button {
    background-color: #0084ff;
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.native-button:hover {
    background-color: #0073e6;
}

/* Estilos para el botón de exportar/importar */
.export-import-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--primary-color);
    color: var(--text-primary);
    width: 3.5rem; /* Slightly larger FAB */
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4); /* More pronounced shadow */
    transition: transform 0.2s;
    cursor: pointer;
}

.export-import-btn:hover {
    transform: scale(1.1);
}

/* Estilos para el modal de importar */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7); /* Darker overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0; /* Start hidden for animation */
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--surface-dark);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 90%;
    width: 400px;
    transform: none;
    transition: none;
}

.modal.open .modal-content {
    transform: none;
}

.modal-header {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem; /* Slightly larger title */
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Close button for modal */
.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

/* Spinner for loading */
.spinner {
    display: none;
}

/* Responsive */
@media (max-width: 640px) {
    .message {
        max-width: 85%;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .export-import-btn {
        bottom: 1rem;
        right: 1rem;
    }
}

/* Selector de emoji */
.emoji-option {
    background-color: var(--surface-dark-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 1.8rem; /* Larger emoji */
    transition: all 0.2s;
    display: flex; /* Center emoji */
    justify-content: center;
    align-items: center;
}

.emoji-option:hover {
    background-color: var(--surface-dark);
    border-color: var(--primary-color);
}

.emoji-option.selected {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Estilos del chat */
.min-h-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header fijo */
header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
}

/* Contenedor de mensajes con scroll */
#messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 60px; /* Ajusta este valor según la altura real de tu área de input */
    
    /* Ocultar inicialmente para evitar ver el scroll desde arriba */
    opacity: 1;
    visibility: visible;
    transition: none;
}

/* Input fijo en la parte inferior */
.bg-\[\#1E1E1E\] {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* Estilos de los inputs nativos */
.native-input {
    background-color: #2D2D2D;
    border: none;
    color: white;
    outline: none;
}

.native-input::placeholder {
    color: #9CA3AF;
}

.native-button {
    background-color: #0084ff;
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.native-button:hover {
    background-color: #0073e6;
}

/* Estilos para el scroll */
#messages-container::-webkit-scrollbar {
    width: 6px;
}

#messages-container::-webkit-scrollbar-track {
    background: transparent;
}

#messages-container::-webkit-scrollbar-thumb {
    background-color: #4B4B4B;
    border-radius: 3px;
}

#messages-container::-webkit-scrollbar-thumb:hover {
    background-color: #5C5C5C;
}

/* Botón de scroll al final */
.scroll-to-bottom {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.scroll-to-bottom.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-to-bottom:hover {
    background-color: var(--primary-dark);
}

.scroll-to-bottom svg {
    width: 24px;
    height: 24px;
    fill: white;
}

/* Animación para nuevos mensajes */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: none;
    }
    40% {
        transform: none;
    }
    60% {
        transform: none;
    }
}

.scroll-to-bottom.new-message {
    animation: bounce 1s ease infinite;
}

/* Estilo para mensaje informativo (ej. Cifrado) */
.info-message {
    text-align: center;
    font-size: 0.85rem; /* Ligeramente más grande */
    color: var(--text-secondary); /* Color secundario */
    margin: 0.5rem auto 1.5rem auto; /* Centrar horizontalmente y mayor margen inferior */
    padding: 0.5rem 1rem; /* Añadir padding */
    font-style: italic;
    max-width: 80%; /* Ancho máximo para que no ocupe todo el ancho en pantallas grandes */
    border: 1px solid var(--border-color); /* Borde sutil */
    border-radius: 12px; /* Bordes redondeados */
    background-color: var(--surface-dark-hover); /* Fondo ligeramente diferente */
    
    /* Eliminamos estilos para layout interno con icono */
    /* display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem; */
}

/* Estilo para enlaces dentro de los mensajes */
.message a {
    color: var(--primary-color); /* Color de enlace */
    text-decoration: underline; /* Subrayado */
}

.info-message-icon-container {
    text-align: center; /* Centrar el icono */
    margin: 1.5rem auto 0.5rem auto; /* Margen superior e inferior, centrar */
}

.info-message-icon-container svg {
    width: 1.5rem; /* Tamaño del icono ligeramente más grande */
    height: 1.5rem;
    fill: var(--text-secondary); /* Color del icono */
}

/* Estilo para el botón de menú en la cabecera */
#menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem; /* Padding para el área de clic */
    transition: opacity 0.2s;
}

#menu-btn:hover {
    opacity: 0.8;
}

/* Estilo para la barra de acciones de selección */
/* Esto ya no se necesita */
/* #selection-actions.visible {
    transform: translateY(0);
} */

/* Estilo para mensajes seleccionados */
.message.selected {
    background-color: #0056b3; /* Un azul más oscuro para indicar selección */
    /* Puedes ajustar el color según tu tema */
    border: 1px solid var(--primary-color); /* Mantener el borde sutil */
    /* Opcional: añadir una sombra sutil */
    /* box-shadow: 0 0 8px rgba(0, 123, 255, 0.5); */
}

/* Estilo para el contenedor del checkbox dentro del mensaje */
/* Esto ya no se necesita, el contenedor estará siempre oculto */
/* .message-container.selected .message-checkbox-container {
     display: flex;
} */

/* Estilo básico para el checkbox */
/* Esto ya no se necesita */
/* .message-checkbox {
// ... existing code ...
} */

/* Estilo para el checkbox (aunque usaremos un indicador visual por ahora) */
/* .message .selection-checkbox {
// ... existing code ...
} */

/* Estilo para el panel lateral */
.modal-content.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px; /* Ancho del panel lateral */
    max-width: 90%; /* Ancho máximo en pantallas pequeñas */
    background-color: var(--surface-dark); /* Fondo */
    border-radius: 0; /* Sin bordes redondeados */
    transform: none;
    transition: none;
    padding: 1rem; /* Reducir padding */
    display: flex; /* Layout interno */
    flex-direction: column;
}

.modal.open .modal-content.side-panel {
    transform: none;
}

/* Estilo para el botón de copiar dentro del modal de opciones */
#copy-messages-btn {
    /* Asegurarse de que el estilo base del botón sea adecuado */
    /* Puedes añadir estilos adicionales si necesitas que se vea diferente al native-button */
    margin-top: 1rem; /* Margen superior para separarlo de otras opciones */
}

@media (max-width: 640px) {
    .message {
        max-width: 85%;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .export-import-btn {
        bottom: 1rem;
        right: 1rem;
    }
}

.native-input:focus {
    border-color: #007AFF;
    box-shadow: 0 0 0 0.1rem rgba(0, 122, 255, 0.25);
}

/* New styles for tab content and bottom navigation */

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 80px; /* Add padding at the bottom equal to the nav height */
    overflow-y: auto; /* Enable scrolling for the main content area */
    padding-top: 64px; /* Approximate height of header */
    padding-bottom: 64px; /* Approximate height of nav */
    padding-left: 1rem;
    padding-right: 1rem;
}

.tab-content {
    flex: 1;
    overflow-y: auto; /* Ensure individual tabs can scroll if their content is long */
    /* padding-bottom: 20px; */ /* Add some padding at the bottom of each tab content */
    display: none; /* Ocultar por defecto */
}

.tab-content.active {
    display: flex; /* Mostrar y usar flexbox para el layout cuando está activo */
    flex-direction: column;
    padding: 0 1rem; /* Add horizontal padding back */
}

.tab-content.hidden {
    display: none;
}

nav {
    z-index: 10;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #1A1A1A;
    height: 64px;
}

nav button {
    flex: 1;
    padding: 10px 0;
    transition: color 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

nav button.active {
     color: #ffffff;
     opacity: 1;
}

nav button:not(.active) {
     color: #a0a0a0; /* Gray color for inactive tabs */
     opacity: 0.7;
}

nav button svg {
    margin-bottom: 4px;
}

/* Styles for new profile elements */
#profile-content .modal-body .native-input {
    margin-top: 4px; /* Space above inputs */
}

#profile-content .modal-footer.mt-6 {
    margin-top: 1.5rem;
}

#profile-content .modal-body > div {
    margin-bottom: 1rem;
}

#profile-content .modal-body > div:last-child {
    margin-bottom: 0;
}

/* Adjust spacing around sections within profile */
#profile-content .modal-body > div {
    margin-bottom: 1.5rem; /* Increased spacing */
}

#profile-content .modal-body > div:last-child {
    margin-bottom: 0;
}

#profile-content .mt-6 {
    margin-top: 1.5rem; /* Standardize top margin */
}

#profile-content .pt-6 {
    padding-top: 1.5rem; /* Standardize top padding */
}

#profile-content .border-t {
    border-top-width: 1px;
    border-color: #333333;
}

#profile-content .space-y-4 > *:not(:first-child) {
    margin-top: 1rem; /* Space between elements in spaced divs */
}

/* New styles for buttons that open modals */
.native-button.justify-start {
    justify-content: flex-start; /* Align icon and text to the start */
}

/* Ensure modal content has appropriate padding */
.modal-content .modal-body {
    padding: 0 1.5rem 1.5rem 1.5rem; /* Add padding around modal body content */
}

.modal-content .modal-header {
    padding: 1.5rem 1.5rem 1rem 1.5rem; /* Add padding to modal header */
}

.modal-content .modal-footer {
    padding: 0 1.5rem 1.5rem 1.5rem; /* Add padding to modal footer */
}


/* Adjust spacing within modal bodies */
#add-chat-modal .modal-body > div,
#edit-profile-modal .modal-body > div,
#change-password-modal .modal-body > div {
    margin-bottom: 1rem; /* Standard spacing between sections/inputs */
}

#add-chat-modal .modal-body > div:last-child,
#edit-profile-modal .modal-body > div:last-child,
#change-password-modal .modal-body > div:last-child {
    margin-bottom: 0; /* No bottom margin for the last element */
}

/* Adjust margin for the search result div in add chat modal */
#add-chat-modal #search-result-modal.mt-4 {
    margin-top: 1rem; /* Standard margin top */
}

#add-chat-modal #search-result-modal .p-4 {
    padding: 1rem; /* Standard padding within result card */
}

/* Styles for chat search input */
#search-chats-input {
    /* Inherits styles from .native-input */
    margin-bottom: 1rem; /* Add some space below the search bar */
}

/* Eliminar animaciones de carga */
.loading-animation {
    display: none;
}

/* Ajustar estilos de la lista de chats */
#chats-list {
    opacity: 1;
    visibility: visible;
    transition: none;
}

/* Ajustar estilos del contenedor de mensajes */
#messages-container {
    opacity: 1;
    visibility: visible;
    transition: none;
}

/* Eliminar animaciones de pulso */
@keyframes pulse-animation {
    0%, 100% {
        transform: none;
        opacity: 1;
    }
    50% {
        transform: none;
        opacity: 1;
    }
} 