:root {
    --primary-color: #128C7E;
    --secondary-color: #e4e6eb;
    --background-color: #f0f2f5;
    --header-color: #043777;
    --text-color: #000000;
    --text-secondary: #65676b;
    --white: #ffffff;
    --own-message: #7fa2cd;
    --other-message: #e4e6eb;
    --online-status: #31a24c;
    --shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    --input-background: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
    touch-action: manipulation;
}

/* Estructura principal del chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Header estilo WhatsApp */
.chat-header {
    background-color: var(--header-color);
    color: var(--white);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 60px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chat-header h1 {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.online-status {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--online-status);
    border-radius: 50%;
    margin-right: 6px;
}

/* Contenedor principal del contenido */
.chat-content {
    position: absolute;
    top: 60px;
    bottom: 70px;
    left: 0;
    right: 0;
    overflow: hidden;
    background-color: var(--background-color);
    background-image: url('https://web.whatsapp.com/img/bg-chat-tile-light_a4be512e7195b6b733d9110b408f075d.png');
    background-repeat: repeat;
}

/* Área de mensajes con scroll */
.chat-box {
    height: 100%;
    overflow-y: auto;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
}

/* Formulario estilo WhatsApp */
.chat-form {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--input-background);
    padding: 8px 12px;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid #e9e9e9;
    height: 70px;
    box-sizing: border-box;
}

/* Estilos para los mensajes */
.mensaje {
    padding: 8px 12px;
    border-radius: 7.5px;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
    box-shadow: var(--shadow);
    animation: fadeIn 0.3s ease-out;
    font-size: 0.95rem;
    line-height: 1.4;
}

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

.mensaje-propio {
    background-color: var(--own-message);
    align-self: flex-end;
    border-bottom-right-radius: 0;
    margin-left: auto;
}

.mensaje-otro {
    background-color: var(--other-message);
    align-self: flex-start;
    border-bottom-left-radius: 0;
    margin-right: auto;
}

.usuario {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.8rem;
    color: var(--header-color);
}

.hora {
    font-size: 0.65rem;
    text-align: right;
    margin-top: 4px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.mensaje-propio .hora {
    color: var(--header-color);
}

/* Input y botones estilo WhatsApp */
.message-area {
    flex: 1;
    display: flex;
    background-color: var(--white);
    border-radius: 20px;
    padding: 5px;
    align-items: center;
}

.message-area textarea {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 20px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    font-size: 0.95rem;
    min-height: 40px;
    line-height: 1.4;
    outline: none;
    background-color: transparent;
}

.file-upload {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-label {
    background-color: transparent;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--header-color);
    width: 40px;
    height: 40px;
    border: none;
}

.send-btn {
    background-color: #5d8bc5;
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.send-btn:hover {
    background-color: var(--header-color); 
}

.send-btn i {
    font-size: 18px;
}

/* Media queries para móviles */
@media (max-width: 480px) {
    .chat-header {
        height: 56px;
        padding: 8px 12px;
    }
    
    .chat-content {
        top: 56px;
        bottom: 65px;
    }
    
    .chat-box {
        padding: 8px 12px;
        gap: 6px;
    }
    
    .mensaje {
        padding: 6px 10px;
        max-width: 85%;
        font-size: 0.9rem;
    }
    
    .chat-form {
        height: 65px;
        padding: 6px 10px;
    }
    
    .message-area textarea {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    
    .file-label, .send-btn {
        width: 36px;
        height: 36px;
    }
}

/* Estilos para imágenes en los mensajes */
.image-container {
    position: relative;
    margin-top: 8px;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mensaje-imagen {
    max-width: 100%;
    max-height: 250px;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: transform 0.2s;
}

.mensaje-imagen:hover {
    transform: scale(1.02);
}

/* Estilos para carga de imágenes */
.cargando-imagen {
    padding: 20px;
    background: #f0f0f0;
    border-radius: 8px;
    margin-top: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--header-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Elemento de audio oculto */
audio#notification-sound {
    position: absolute;
    left: -9999px;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Clases utilitarias */
.hidden {
    display: none !important;
}

.file-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.image-error {
    padding: 10px;
    background-color: #f8d7da;
    color: #721c24;
    border-radius: 5px;
    text-align: center;
    font-size: 0.8rem;
}

/* Estilos para los modales */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #000000; /* Color negro sólido */
    opacity: 0.98; /* Control de transparencia */
    z-index: 1001;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--white);
    border-radius: 10px;
    padding: 20px;
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background-color: var(--header-color);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.modal-btn i {
    font-size: 1.2rem;
}

.modal-btn.cancel {
    background-color: #f8d7da;
    color: #721c24;
}

.modal-btn:hover {
    background-color: #0a6e5d;
}

.modal-btn.cancel:hover {
    background-color: #f1b0b7;
}

/* Estilos para la vista previa de la cámara */
#camera-preview-modal .modal-content {
    padding: 0;
    background-color: black;
    max-width: 100%;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

#camera-view {
    width: 100%;
    height: calc(100% - 100px);
    object-fit: contain;
}

.camera-header {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    gap: 15px;
}

.camera-control-btn {
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 30px;
    z-index: 10;
}

.camera-action-btn {
    background-color: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-action-btn.cancel {
    color: #f8d7da;
}

#capture-btn {
    font-size: 3rem;
    color: white;
}

#flash-toggle-btn.active {
    color: yellow;
}

/* Estilos para el editor de imágenes */
.editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.editor-container {
    position: relative;
    width: 95%;
    max-width: 800px;
    height: 80vh;
    background-color: #222;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.editor-canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    background-color: #333;
}

#editor-canvas {
    max-width: 100%;
    max-height: 100%;
    background-color: white;
    cursor: crosshair;
}

.editor-tools {
    display: flex;
    padding: 10px;
    background-color: #333;
    border-top: 1px solid #444;
    flex-wrap: wrap;
    gap: 8px;
}

.tool-btn {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: none;
    background-color: #444;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn.active {
    background-color: var(--header-color);
}

.color-picker {
    width: 40px;
    height: 40px;
    border: none;
    padding: 0;
    cursor: pointer;
    background: transparent;
}

.brush-size {
    width: 80px;
    height: 40px;
    padding: 0 8px;
    border-radius: 4px;
    border: none;
    background-color: #444;
    color: white;
}

.editor-actions {
    display: flex;
    padding: 10px;
    background-color: #333;
    border-top: 1px solid #444;
    justify-content: space-between;
}

.action-btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    background-color: #444;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
}

.action-btn.save {
    background-color: var(--header-color);
}

.action-btn.cancel {
    background-color: #dc3545;
}

.tool-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tool-label {
    color: white;
    font-size: 0.8rem;
    margin-right: 5px;
}

/* Estilos para el modal de vista previa */
#image-preview-modal .modal-content {
    background-color: transparent;
    border: none;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}

#preview-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.25s ease;
    cursor: grab;
    user-select: none;
}
#preview-image.grabbing {
    cursor: grabbing;
}

#image-preview-modal .action-btn {
    margin-top: 15px;
}
.preview-controls {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 15px;
    z-index: 10;
}
.preview-controls button {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.preview-controls button i {
    pointer-events: none;
}

@media (max-width: 600px) {
    .editor-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .tool-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .brush-size {
        width: 60px;
        height: 35px;
    }
    
    #image-preview-modal .modal-content {
        max-width: 95%;
    }
}

/* Estilos para el modal de vista previa con zoom */
        #image-preview-modal .modal-content {
            background-color: transparent;
            border: none;
            padding: 0;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            touch-action: none;
        }

        #preview-image {
            max-width: 100%;
            max-height: 80vh;
            object-fit: contain;
            transform-origin: center center;
            transition: transform 0.25s ease;
            cursor: grab;
            user-select: none;
        }

        #preview-image.grabbing {
            cursor: grabbing;
        }

        .preview-controls {
            position: fixed;
            bottom: 20px;
            left: 0;
            right: 0;
            display: flex;
            justify-content: center;
            gap: 15px;
            z-index: 10;
        }

        .preview-controls button {
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            border: none;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            font-size: 1rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .preview-controls button i {
            pointer-events: none;
        }

        .preview-controls .save {
            background-color: #128C7E;
        }

        .preview-controls .cancel {
            background-color: #dc3545;
        }
		
		
		/* ============================================= */
/* ESTILOS PARA EL MODAL DE CONFIRMACIÓN DE SALIDA */
/* ============================================= */

#exit-confirm-modal .modal-content {
    max-width: 320px;
    text-align: center;
    padding: 25px;
    background-color: var(--white);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#exit-confirm-modal h3 {
    color: var(--header-color);
    margin-bottom: 12px;
    font-size: 1.2rem;
    font-weight: 600;
}

#exit-confirm-modal p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.4;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

#cancel-exit-btn {
    background-color: var(--primary-color);
    color: white;
}

#confirm-exit-btn {
    background-color: #dc3545;
    color: white;
}

#cancel-exit-btn:hover {
    background-color: #0d7a6d;
}

#confirm-exit-btn:hover {
    background-color: #bb2d3b;
}

/* Ajustes para móviles */
@media (max-width: 480px) {
    #exit-confirm-modal .modal-content {
        width: 90%;
        max-width: none;
        padding: 20px 15px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions button {
        width: 100%;
        margin: 0;
    }
    
    #exit-confirm-modal h3 {
        font-size: 1.1rem;
    }
    
    #exit-confirm-modal p {
        font-size: 0.85rem;
    }
}