* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-image: url('../images/background.png');
    background-size: auto;
    background-position: top left;
    background-repeat: repeat;
    background-attachment: fixed;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Background overlay for better readability */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 1;
}

.none {
    display: none !important;   /* usa !important si pudiera haber reglas que lo sobre-escriban */
}

/* Header */
.user-bar {
    width: 100%;
    height: 60px;
    background: #202c33;
    color: #fff;
    position: fixed;
    top: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.back-btn {
    color: white;
    font-size: 20px;
    margin-right: 16px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.back-btn:hover {
    opacity: 0.7;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
}

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

.user-info {
    flex: 1;
}

.user-name {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.verified {
    color: #25d366;
    font-size: 14px;
}

.user-status {
    font-size: 13px;
    font-weight: 400;
    color: #8696a0;
    margin-top: 2px;
}

.more-options {
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    transition: opacity 0.2s;
}

.more-options:hover {
    opacity: 0.7;
}

/* Chat container */
.chat-container {
    height: 100vh;
    padding-top: 60px;
    padding-bottom: 102px; /* Espacio para input-area (70px) + footer (32px) */
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

.messages-area {
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Security notice */
.security-notice {
    background: #d5f4f0;
    color: #666460;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin: .5rem 0 .7rem;
    backdrop-filter: blur(10px);
}

.security-notice i {
    color: #8696a0;
}

/* Messages */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message.bot .message-bubble {
    background: rgba(42, 57, 66, 0.8);
    color: #e9edef;
    border-bottom-left-radius: 4px;
}

.message.user .message-bubble {
    background: rgba(0, 92, 75, 0.8);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #8696a0;
    margin-top: 4px;
    text-align: right;
}

.message.bot .message-time {
    text-align: left;
}

.message-content {
    line-height: 1.4;
}

.message-content a {
    color: #53bdeb;
    text-decoration: underline;
}

/* Input area */
.input-area {
    position: fixed;
    bottom: 32px; /* Espacio para el footer */
    left: 0;
    right: 0;
    background: #202c33;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
    z-index: 99998;
}

.input-container {
    flex: 1;
    position: relative;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 24px;
    background: #2a3942;
    color: #e9edef;
    font-size: 15px;
    outline: none;
    font-family: inherit;
}

.input-field::placeholder {
    color: #8696a0;
}

.send-btn {
    background: #00a884;
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 18px;
}

.send-btn:hover {
    background: #017561;
}

/* Floating button */
.floating-btn {
    position: fixed;
    bottom: 112px; /* Ajustado para estar sobre el input-area + footer */
    right: 16px;
    background: #00a884;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    z-index: 1000;
}

.floating-btn:hover {
    background: #017561;
    transform: translateY(-2px);
}

/* Avatar placeholder */
.avatar-placeholder {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 480px) {
    .user-bar {
        padding: 0 12px;
    }

    .messages-area {
        padding: 16px 12px;
    }

    .input-area {
        padding: 8px 12px;
    }

    .message {
        max-width: 90%;
    }
}

/* Scrollbar */
.messages-area::-webkit-scrollbar {
    width: 6px;
}

.messages-area::-webkit-scrollbar-track {
    background: transparent;
}

.messages-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Footer fixed */
.footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #111b21;
    color: #8696a0;
    text-align: center;
    padding: 8px 16px;
    font-size: 11px;
    border-top: 1px solid #2a3942;
    z-index: 99997; /* Menos que input-area para que quede debajo */
}

.footer-fixed a {
    color: #00a884;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-fixed a:hover {
    color: #017561;
    text-decoration: underline;
}

/* Modal para zoom de imágenes */
.image-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.image-modal-content {
    position: relative;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100001;
    transition: color 0.3s;
}

.image-modal-close:hover {
    color: #00a884;
}

.modal-image {
    max-width: 95%;
    max-height: 85%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.image-modal-controls {
    position: absolute;
    bottom: 30px;
    display: flex;
    gap: 15px;
}

.download-btn {
    background: #00a884;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-btn:hover {
    background: #017561;
    transform: translateY(-2px);
}

/* Estilo para imágenes en mensajes con zoom */
.message-content img {
    max-width: 100%;
    max-height: 300px;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: block;
    margin: 5px 0;
    object-fit: cover;
}

.message-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

/* Indicador de zoom en las imágenes */
.message-content {
    position: relative;
}

.message-content img::before {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="white" viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>');
    background-size: 14px;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10;
}

.message-content:hover img::before {
    opacity: 1;
}

/* Animaciones para el modal */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from { 
        opacity: 0;
        transform: scale(0.8);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

.image-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.image-modal.show .modal-image {
    animation: zoomIn 0.3s ease;
}

/* Responsive para dispositivos móviles */
@media (max-width: 768px) {
    .image-modal-close {
        top: 15px;
        right: 20px;
        font-size: 30px;
    }
    
    .modal-image {
        max-width: 98%;
        max-height: 80%;
    }
    
    .image-modal-controls {
        bottom: 20px;
        flex-direction: column;
        align-items: center;
    }
    
    .download-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .message-content img {
        max-height: 200px;
    }
}

/* Para pantallas muy pequeñas */
@media (max-width: 480px) {
    .modal-image {
        max-width: 95%;
        max-height: 75%;
    }
    
    .image-modal-close {
        font-size: 25px;
        top: 10px;
        right: 15px;
    }
    
    .download-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}
