/* RESET GENERAL */
*, *:before, *:after { box-sizing: inherit; }

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input, textarea, select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

html, body { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    height: 100% !important;
    height: 100dvh !important; 
    width: 100%;
    overflow: hidden !important;
    position: fixed; 
}

body { 
    font-family: "Roboto", sans-serif; 
    transition: background 0.3s ease;
    /* Esto es para que el contenido se vea */
    display: block; 
}

/* TEMAS */
body.light-theme { background-color: #e2e2e2; }
body.dark-theme { background-color: #0b141a; }

.actions {
    position: relative;
    display: flex;
    align-items: center;
}

.welcome-guide {
    position: absolute;
    right: 35px; 
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    pointer-events: none;
    animation: fadeOut 0.5s ease forwards 5s;
}

.guide-arrow {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #00a884;
}

.guide-arrow span {
    background: #00a884;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: bounceLeft 1.2s infinite;
}

.guide-arrow i {
    font-size: 18px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    animation: bounceLeft 1.2s infinite;
}

/* Animación (hacia los puntos) */
@keyframes bounceLeft {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(8px); }
}

@keyframes fadeOut {
    0% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

.main-wrapper { 
    display: flex;
    width: 100%; 
    height: 100%; 
    justify-content: center; 
    align-items: center;
    background-color: #d1d7db;
}

body.light-theme .main-wrapper { 
    background: linear-gradient(135deg, #d1d7db 0%, #e2e2e2 100%); 
}

body.dark-theme .main-wrapper { 
    background: linear-gradient(135deg, #0b141a 0%, #111b21 100%); 
}

/* PANEL CONFIGURACIÓN */
.config-panel {
    position: fixed;
    left: -400px; 
    top: 0;
    width: 350px; 
    max-width: 85%; 
    height: 100%;
    background: #f0f2f5; 
    border-right: 1px solid #d1d7db; 
    padding: 20px; 
    overflow-y: auto; 
    z-index: 1000;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.config-panel.open { left: 0; }

.config-section { 
    background: #fff; 
    padding: 15px; 
    border-radius: 8px; 
    margin-bottom: 15px; 
    display: flex; 
    flex-direction: column; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Ajuste de botones en el panel */
.btn-main { 
    background: #00A884; 
    color: #fff; 
    border: none; 
    padding: 12px; 
    width: 100%; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: bold; 
    font-size: 14px; 
    transition: 0.2s;
}

.btn-main:active { background: #008f71; transform: scale(0.98); }

.btn-close { 
    width: 100%; 
    padding: 10px; 
    background: #fff; 
    border: 1px solid #d1d7db; 
    border-radius: 6px; 
    cursor: pointer; 
    margin-top: 10px; 
    color: #54656f; 
    font-weight: 500;
}

/* ETIQUETA DE RESPUESTA (REPLY) */
.reply-box { 
    background: rgba(0,0,0,0.05); 
    border-left: 4px solid #06cf9c; 
    padding: 5px 8px; 
    border-radius: 4px; 
    margin-bottom: 6px; 
    font-size: 13px;
    display: block;
}

.reply-box .reply-author { color: #06cf9c; display: block; font-size: 12px; margin-bottom: 2px; }
.reply-box p { margin: 0; color: #667781; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* MODIFICACIONES PARA MODO OSCURO EN EL PANEL */
body.dark-theme .config-panel { background: #111b21; border-color: #222e35; }
body.dark-theme .config-section { background: #202c33; box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
body.dark-theme .config-section label { color: #8696a0; }
body.dark-theme .config-section input, 
body.dark-theme .config-section textarea, 
body.dark-theme .config-section select { 
    background: #2a3942; color: #e9edef; border-color: #3b4a54; 
}
body.dark-theme .btn-close { background: #202c33; border-color: #3b4a54; color: #aebac1; }
body.dark-theme .reply-box { background: rgba(255,255,255,0.05); }

.config-section input, .config-section textarea, .config-section select { 
    width: 100%; 
    padding: 12px; 
    border: 1px solid #e1e1e1; 
    border-radius: 6px; 
    margin-bottom: 10px; 
}

/* PREVISUALIZACIÓN */
.preview-area { 
    width: 100%; 
    max-width: 450px; 
    height: 100%;
    display: flex; 
    flex-direction: column;
    background: #fff;
    position: relative;
    overflow: hidden;
}

@media (max-width: 450px) {
    .preview-area {
        max-width: 100%;
        height: 100%;
    }
}

.screen-container { 
    width: 100%; 
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    background: #fff;
    overflow: hidden; 
    background-color: #efeae2;
}

body.dark-theme .screen-container {
    background-color: #0b141a;
}

/* BOTÓN DE DESCARGA */
.btn-download {
    width: 100%;
    padding: 12px;
    background-color: #00a884;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

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

.btn-download:hover {
    background-color: #008f6f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,168,132,0.3);
}

.btn-download:active {
    transform: translateY(0);
}

/* Ajuste para Modo Oscuro */
body.dark-theme .btn-download {
    background-color: #00a884;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

body.dark-theme .btn-download:hover {
    background-color: #01c398;
    box-shadow: 0 4px 15px rgba(0,168,132,0.2);
}

/* ESTILO BOTÓN DE CONTACTO */
.btn-contact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #25d366;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.2);
}

.btn-contact:hover {
    background-color: #128c7e;
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(37, 211, 102, 0.3);
}

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

body.dark-theme .config-footer {
    border-top-color: #3b4a54 !important;
}

body.dark-theme .copyright {
    color: #8696a0 !important;
}

/* CABECERA (USER BAR) */
.user-bar { 
    height: 60px; 
    background: #ffffff; 
    color: #000000; 
    padding: 0 5px; 
    display: flex; 
    align-items: center; 
    flex-shrink: 0;
    z-index: 10;
}

.user-bar .back { width: 35px; display: flex; justify-content: center; flex-shrink: 0; cursor: pointer; }
.user-bar .back img { width: 22px; height: 22px; }

.user-bar .avatar { width: 40px; height: 40px; flex-shrink: 0; }
.user-bar .avatar img { border-radius: 50%; width: 100%; height: 100%; object-fit: cover; }

.user-bar .name { flex: 1; margin-left: 10px; overflow: hidden; }
.user-bar .name span { display: block; font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-bar .name .status { font-size: 12px; opacity: 0.9; }

.user-bar .actions { 
    width: 42px; height: 100%; display: flex; 
    align-items: center; justify-content: center; flex-shrink: 0; 
}

.user-bar .actions img { width: 22px; height: 22px; }

/* CHAT */
.conversation {
    flex: 1;
    background-color: #efe7dd;
    background-image: url("images/default_wallpaper_l.png");
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    position: relative;
}

.conversation-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
}
/* BURBUJAS */
.message {
    max-width: 85%;
    padding: 6px 7px 3px 9px;
    font-size: 14.5px;
    position: relative;
    word-wrap: break-word;
    margin-bottom: 2px;
    width: fit-content;
    min-width: 80px;
    display: block; 
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
}

.metadata {
    display: inline-flex;
    float: right;
    margin: 4px 0 -1px 8px;
    position: relative;
    bottom: -2px;
    font-size: 11px;
    color: rgba(102, 119, 129, 0.7);
    align-items: center;
}

body.dark-theme .metadata {
    color: rgba(233, 237, 239, 0.6);
}

.tick {
    display: inline-flex;
    margin-left: 3px;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.tick svg {
    width: 16px;
    height: 15px;
    overflow: visible;
}

body.dark-theme .tick svg path {
    opacity: 0.8;
}

.reply-box {
    background: rgba(0,0,0,0.05); 
    border-left: 4px solid #00a884;
    padding: 5px 8px; 
    border-radius: 4px; 
    margin-bottom: 5px; 
    font-size: 13px;
    display: block;
}

body.dark-theme .reply-box {
    background: rgba(255,255,255,0.05);
}

.message-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    width: 100%;
    position: relative;
}

.message.sent-first, .message.sent-after { align-self: flex-end; background: #d9fdd3; border-radius: 8px; }
.message.received-first, .message.received-after { align-self: flex-start; background: #fff; border-radius: 8px; }

.sent-first.message-wrapper, .sent-after.message-wrapper { flex-direction: row-reverse; }

.message-actions {
    display: none;
    gap: 8px;
    margin: 0 10px;
}

.message-wrapper:hover .message-actions { display: flex; }

.action-icon {
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0.6;
    transition: 0.2s;
}

.action-icon:hover { opacity: 1; transform: scale(1.1); }

.custom-modal {
    display: none; 
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 15px;
    width: 300px;
    z-index: 3001;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

#date-modal {
    z-index: 3005; 
}

.modal-overlay {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: none;
    z-index: 3000;
}

body.dark-theme .custom-modal {
    background: #3b4a54;
    color: #e9edef;
}

/* Botones y Campos */
.modal-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn-cancel { background: transparent; color: #00a884; border: none; font-weight: bold; cursor: pointer; }
.btn-delete-confirm, .btn-save { background: #00a884; color: white; border: none; padding: 8px 15px; border-radius: 5px; cursor: pointer; }

.edit-field { margin-bottom: 15px; }
.edit-field label { display: block; font-size: 12px; color: #8696a0; margin-bottom: 5px; }
.edit-field textarea, .edit-field input, .edit-field select {
    width: 100%; 
    background: #f0f2f5; 
    border: none; 
    padding: 8px; 
    border-radius: 5px;
}

body.dark-theme .edit-field textarea, body.dark-theme .edit-field input, body.dark-theme .edit-field select {
    background: #2a3942; color: white;
}

/* COLITAS */
.message.received-first { border-top-left-radius: 0; }
.message.received-first:after { 
    content: ""; position: absolute; left: -10px; top: 0; 
    border-style: solid; border-width: 0 11px 10px 0; border-color: transparent #fff transparent transparent; 
}
.message.sent-first { border-top-right-radius: 0; }
.message.sent-first:after { 
    content: ""; position: absolute; right: -10px; top: 0; 
    border-style: solid; border-width: 0 0 10px 11px; border-color: transparent transparent transparent #d9fdd3; 
}

.conversation-compose { 
    display: flex; 
    align-items: flex-end; 
    padding: 8px; 
    background: transparent; 
    flex-shrink: 0;
    width: 100%;
}

.input-box { 
    background: #fff; 
    border-radius: 24px; 
    flex: 1; 
    display: flex; 
    align-items: center; 
    min-height: 48px; 
    padding: 0 5px; 
}

.input-msg { 
    flex: 1; 
    border: none; 
    outline: none; 
    padding: 10px 5px; 
    font-size: 16px; 
    background: transparent; 
}

.icon-btn { 
    width: 38px; 
    height: 42px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    flex-shrink: 0; 
}

.icon-btn img { width: 24px; height: 24px; opacity: 0.6; }

.send-btn { 
    background: #00a884; 
    border: none; 
    width: 48px; 
    height: 48px; 
    border-radius: 50%; 
    margin-left: 5px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    flex-shrink: 0;
}

.send-btn img { width: 24px; height: 24px; }

.chat-date {
    align-self: center;
    background-color: #fff;
    padding: 5px 12px;
    border-radius: 7px;
    font-size: 12.5px;
    color: #54656f;
    text-transform: uppercase;
    margin: 15px 0 10px 0;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
    width: fit-content;
    text-transform: none !important;
    position: relative;
    cursor: pointer;
    transition: 0.3s;
}

.chat-date:hover {
    background-color: #f0f2f5;
    transform: scale(1.05);
}

body.dark-theme .chat-date {
    background-color: #182229 !important;
    color: #e9edef !important;
}

body.dark-theme .chat-date:hover {
    background-color: #2a3942;
}

/* MODO OSCURO */
body.dark-theme #theme-icon {
    color: #ffbd00 !important;
}

#config-panel h2 {
    margin: 0;
    color: inherit;
}

.file-upload-wrapper {
    width: 100%;
    margin-top: 5px;
}

#file-input {
    display: none;
}

select, input[type="datetime-local"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    background-color: #fff;
    font-family: inherit;
    font-size: 14px;
    color: #54656f;
    outline: none;
    margin-bottom: 10px;
}

body.dark-theme select, 
body.dark-theme input[type="datetime-local"] {
    background-color: #2a3942;
    border-color: #3b4a54;
    color: #e9edef;
}

#status-text {
    transition: all 0.2s ease;
}

.custom-file-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background-color: #f0f2f5;
    color: #54656f;
    border: 2px dashed #d1d7db;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.custom-file-upload i {
    font-size: 18px;
}

.custom-file-upload:hover {
    background-color: #e9edef;
    border-color: #00a884;
    color: #00a884;
}

.emoji {
    display: inline-block;
    height: 20px;
    width: 20px;
    vertical-align: middle;
    margin: -3px 2px 0 2px;
    background-size: contain;
    background-repeat: no-repeat;
}

.chat-link {
    color: #027eb5;
    text-decoration: none;
    cursor: pointer;
}

.chat-link:hover {
    text-decoration: underline;
}

.text-content {
    display: inline;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.read-more {
    color: #027eb5;
    cursor: pointer;
    font-weight: 500;
    margin-left: 5px;
}

.read-more:hover {
    text-decoration: underline;
}

body.dark-theme .read-more {
    color: #53bdeb;
}

body.dark-theme .chat-link {
    color: #53bdeb;
}

#msg-preview {
    white-space: pre-wrap;
    word-break: break-word;
}

#msg-preview-bubble:after {
    display: none;
}

code {
    font-family: "Courier New", Courier, monospace;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 13px;
}

.conversation-container {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.conversation-container::-webkit-scrollbar {
    display: none;
}

body.dark-theme code {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme #msg-preview {
    background: #2a3942 !important;
    color: #e9edef;
}   

body.dark-theme .custom-file-upload {
    background-color: #2a3942;
    color: #aebac1;
    border-color: #3b4a54;
}

body.dark-theme .custom-file-upload:hover {
    background-color: #3b4a54;
    border-color: #00a884;
    color: #00a884;
}

body.dark-theme .config-panel { background: #111b21; color: #fff; }
body.dark-theme .user-bar { background: #202c33; color: #ffffff;}
body.dark-theme .conversation { background-color: #0b141a; background-image: url("images/default_wallpaper.png"); }
body.dark-theme .input-box { background: #2a3942; }
body.dark-theme .input-msg { color: #e9edef; }
body.dark-theme .message.received-first, body.dark-theme .message.received-after { background: #202c33; color: #e9edef; }
body.dark-theme .message.sent-first, body.dark-theme .message.sent-after { background: #005c4b; color: #e9edef; }
body.dark-theme .message.received-first:after { border-color: transparent #202c33 transparent transparent; }
body.dark-theme .message.sent-first:after { border-color: transparent transparent transparent #005c4b; }
