html {
    display: flex;
    flex-direction: column;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    margin: 0;
    padding: 0;
    height: 100vh;
}

#contenedor_carga,
#contenedor_carga_modal {
    display: none;
}

#porcentaje {
    font-family: Arial, sans-serif;
    font-size: 18px;
    color: #333;
    text-align: center;
    position: absolute;
    bottom: 20px;
    width: 100%;
}

#container {
    display: flex;
    height: 100vh;
    flex-direction: row;
}

#client-list-container {
    border-top-left-radius: 20px;
    box-shadow: inset -5px 0px 10px 0px rgba(0, 0, 0, 0.1);
    margin-top: 65px;
    width: 380px;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: #ececec;
    flex-shrink: 0;
}

.client-list {
    flex-direction: column;
    display: flex;
    margin-top: -10px;
}

.client-item {
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
}

#client-info {
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    #client-list-container {
        width: 100%;
        border-radius: 0;
    }

    /* Ocultar chat por defecto en móvil */
    #chat-container {
        display: none;
    }

    .client-item {
        flex: 1 1 calc(50% - 20px);
        min-width: calc(50% - 20px);
    }

    /* Cuando hay chat activo, ocultar lista y mostrar chat con transición */
    #client-list-container,
    #chat-container {
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    body.chat-active #client-list-container {
        display: none;
    }

    body.chat-active #chat-container {
        display: flex;
        flex-direction: column;
        width: 100%;
        animation: slideInRight 0.25s ease-out;
    }

    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateX(30px);
        }

        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
}

@media (max-width: 480px) {
    .client-item {
        flex: 1 1 calc(100% - 20px);
        min-width: calc(100% - 20px);
    }

    #container {
        flex-direction: column;
    }
}

.client {
    font-size: 16px;
    padding: 12px;
    border-bottom: 1px solid #bababa;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border-radius: 5px;
    margin: 2px;
}

.unread-count {
    display: inline-block;
    background-color: #00a04b;
    color: white;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 50%;
    min-width: 20px;
    text-align: center;
    line-height: 18px;
    font-size: 12px;
    margin-left: 8px;
}

.client:hover {
    background-color: #e2e2e2;
}

#chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.logo {
    width: 50%;
    margin: 50px auto;
    display: block;
    max-width: 200px;
}

#chat-messages {
    background-color: #e5ddd5;
    margin-top: 65px;
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0px 5px 10px 2px rgba(0, 0, 0, 0.1);
}

.message {
    max-width: 70%;
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0px 2px 6px 1px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out;
}

@keyframes highlight {
    0% {
        background-color: transparent;
    }

    50% {
        background-color: #d5e6ff;
    }

    100% {
        background-color: transparent;
    }
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.highlight {
    animation: highlight 1s ease-in-out, slideIn 0.3s ease-out;
}

.highlight-client {
    background-color: #e7fff48f;
    transition: background-color 0.3s ease;
    border-radius: 5px;
    box-shadow: 0px 1px 1px 1px rgba(0, 0, 0, 0.2);
    border-bottom: solid 3px #007b33c9;
}

.message-img-container {
    margin: 10px 0;
    max-width: 300px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
    position: relative;
}

.message-img-container:hover {
    transform: scale(1.02);
}

.message-image {
    max-width: 100%;
    border-radius: 8px;
    display: block;
    transition: transform 0.2s ease;
}

.message-img-container:hover .message-image {
    transform: scale(1.05);
}

.message-image-indicator {
    font-style: italic;
    color: #666;
    font-size: 14px;
    margin: 5px 0;
    padding: 5px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.sent {
    background-color: #c7ffeb;
    align-self: flex-end;
    margin-left: auto;
}

/* Bot-sent messages — subtle visual distinction */
.sent.bot-message {
    background-color: #e0e7ff;
    border-left: 3px solid #7c8dff;
}

.message-sent-bot {
    color: #5a6acf;
    font-style: italic;
}

.received {
    background-color: #fff;
    align-self: flex-start;
    margin-right: auto;
}

.message-sent {
    font-weight: bold;
    display: flex;
    flex-direction: row-reverse;
    font-size: 14px;
    color: #2d6a4f;
    margin-bottom: 5px;
}

.message-received {
    font-weight: bold;
    display: flex;
    flex-direction: row;
    font-size: 14px;
    color: #1a1a1a;
    margin-bottom: 5px;
}

.message-text-received {
    word-wrap: break-word;
    margin-top: 8px;
    text-align: left;
    font-size: 15px;
    line-height: 1.4;
    color: #333;
}

.message-time-received {
    font-size: 11px;
    color: #757575;
    display: flex;
    margin-top: 5px;
    opacity: 0.8;
}

.message-text-sent {
    word-wrap: break-word;
    margin-top: 8px;
    text-align: left;
    font-size: 15px;
    line-height: 1.4;
    color: #333;
}

.message-time-sent {
    font-size: 11px;
    color: #757575;
    display: flex;
    flex-direction: row-reverse;
    margin-top: 5px;
    opacity: 0.8;
    align-items: center;
    gap: 4px;
}

/* Delivery status icons */
.delivery-status {
    font-size: 13px;
    font-weight: bold;
    letter-spacing: -2px;
}

.delivery-status.read {
    color: #53bdeb;
}

.delivery-status.delivered {
    color: #8696a0;
}

.delivery-status.sent-status {
    color: #8696a0;
}

.delivery-status.pending {
    color: #8696a0;
    font-size: 11px;
    letter-spacing: 0;
}

#message-form {
    background-color: #fff;
    padding: 15px;
    display: flex;
    align-items: center;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.input-container {
    display: flex;
    align-items: center;
    background-color: #f3f4f6;
    border-radius: 25px;
    padding: 10px 15px;
    flex: 1;
    margin: 0 10px;
}

#messageInput {
    flex: 1;
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    outline: none;
    background: transparent;
    font-size: 16px;
    resize: none;
    color: #333;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: auto;
}

#messageInput::placeholder {
    color: #aaa;
}

#send-button {
    background-color: #007bff;
    border: none;
    border-radius: 50%;
    padding: 12px;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    min-width: 45px;
    min-height: 45px;
}

#send-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

#send-button:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

#send-button:active {
    transform: scale(0.95);
}

.titulo_r {
    display: flex;
    font-size: 20px;
    font-family: 'Georgia', serif;
    justify-content: center;
    margin: 15px 0;
    color: #2c3e50;
    font-weight: bold;
}

.formulario_agregar_admin {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
}

.formulario_agregar_admin input,
.formulario_agregar_admin select {
    margin-top: 5px;
    font-size: 16px;
    font-family: 'Arial', sans-serif;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: border-color 0.3s ease;
}

.formulario_agregar_admin input:focus,
.formulario_agregar_admin select:focus {
    border-color: #007bff;
    outline: none;
}

.formulario_agregar_admin label {
    font-size: 14px;
    font-family: 'Arial', sans-serif;
    color: #555;
    font-weight: 500;
}

.user {
    text-align: center;
    font-family: 'Arial', sans-serif;
    padding: 10px;
    color: #666;
}

.opciones {
    text-align: center;
    font-family: 'Arial', sans-serif;
    padding: 10px;
    color: #666;
    font-style: italic;
}

.message-options-received,
.message-options-sent {
    display: flex;
    align-items: center;
    position: relative;
    margin: 0 5px;
}

.message-options-received i,
.message-options-sent i {
    cursor: pointer;
    font-size: 16px;
    color: #003d84;
    transition: all 0.3s ease;
    padding: 5px;
    border-radius: 3px;
}

.message-options-received i:hover,
.message-options-sent i:hover {
    transform: rotate(180deg);
    background-color: rgba(0, 61, 132, 0.1);
}

.options-list-received,
.options-list-sent {
    display: none;
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    list-style: none;
    margin: 0;
    padding: 5px 0;
    border: none;
    border-radius: 8px;
    position: absolute;
    z-index: 100;
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    top: 100%;
    left: 0;
    transform: translateY(5px);
    opacity: 0;
    transition: all 0.3s ease;
}

.options-list-received.show,
.options-list-sent.show {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

.options-list-received li,
.options-list-sent li {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.options-list-received li:not(:last-child),
.options-list-sent li:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.options-list-received li:hover,
.options-list-sent li:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.options-list-received li a,
.options-list-sent li a {
    text-decoration: none;
    color: #fff;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
}

.options-list-received li a i,
.options-list-sent li a i {
    margin-left: 8px;
    font-size: 14px;
    color: #fff;
    transition: transform 0.3s ease;
}

.options-list-received li:hover a i,
.options-list-sent li:hover a i {
    transform: translateX(3px);
}

/* ===== LIGHTBOX CON ZOOM MEJORADO ===== */
.image-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
    align-items: center;
    justify-content: center;
}

.image-lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 80%;
    transition: transform 0.3s ease;
    transform-origin: center center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    cursor: grab;
    transition: transform 0.3s ease;
}

.lightbox-image:active {
    cursor: grabbing;
}

.lightbox-image.zoomed {
    cursor: move;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.lightbox-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 24px;
    border-radius: 25px;
    z-index: 10001;
}

.zoom-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.zoom-reset {
    background: #007bff;
}

.zoom-reset:hover {
    background: #0056b3;
}

.zoom-indicator {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 10001;
    min-width: 60px;
    text-align: center;
}

/* Responsive para lightbox */
@media (max-width: 768px) {
    .lightbox-controls {
        bottom: 20px;
        padding: 10px 20px;
    }

    .zoom-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .lightbox-close {
        top: 15px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 35px;
    }

    .zoom-indicator {
        bottom: 70px;
        font-size: 13px;
    }

    .lightbox-content {
        max-width: 95%;
        max-height: 70%;
    }
}

@media (max-width: 480px) {
    .lightbox-controls {
        bottom: 15px;
        padding: 8px 16px;
        gap: 10px;
    }

    .zoom-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }

    .lightbox-close {
        top: 10px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 30px;
    }

    .zoom-indicator {
        bottom: 60px;
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Tooltip para imágenes en el chat */
.message-img-container::after {
    content: "Haz clic para ampliar";
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.message-img-container:hover::after {
    opacity: 1;
}

/* Botón OCR inline sobre imágenes del chat */
.ocr-inline-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(40, 167, 69, 0.9) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 4px 10px !important;
    font-size: 11px !important;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 5;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.message-img-container:hover .ocr-inline-btn {
    opacity: 1;
}
.ocr-inline-btn:hover {
    transform: scale(1.08);
    background: rgba(32, 134, 55, 0.95) !important;
}

/* Estados de carga */
.lightbox-image.loading {
    opacity: 0.7;
    filter: blur(2px);
}

/* Animaciones */
@keyframes lightboxFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-lightbox.active .lightbox-content {
    animation: lightboxFadeIn 0.3s ease-out;
}

/* Mejoras para scroll */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

#client-list-container::-webkit-scrollbar {
    width: 4px;
}

#client-list-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#client-list-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.client-list-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 8px;
    color: #5f6368;
    font-size: 13px;
}

.client-list-loading .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #d0d4d9;
    border-top-color: #5f6368;
    border-radius: 50%;
    animation: spin-loader 0.8s linear infinite;
}

@keyframes spin-loader {
    to {
        transform: rotate(360deg);
    }
}


/* Utilidades */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

.p-10 {
    padding: 10px;
}

/* ===== MODO OSCURO COMPLETO ===== */
@media (prefers-color-scheme: dark) {

    /* Base */
    body {
        background-color: #0d1117;
        color: #c9d1d9;
    }

    /* Navbar */
    .navbar,
    .bg-body-tertiary {
        background-color: #161b22 !important;
        border-bottom: 1px solid #30363d;
    }

    .navbar-toggler-icon {
        filter: invert(1);
    }

    .offcanvas {
        background-color: #161b22;
        color: #c9d1d9;
    }

    .offcanvas-header {
        border-bottom: 1px solid #30363d;
    }

    .nav-link {
        color: #c9d1d9 !important;
    }

    .nav-link:hover {
        color: #58a6ff !important;
    }

    .dropdown-menu {
        background-color: #21262d;
        border: 1px solid #30363d;
    }

    .dropdown-item {
        color: #c9d1d9;
    }

    .dropdown-item:hover {
        background-color: #30363d;
        color: #fff;
    }

    /* Buscador */
    .form-control {
        background-color: #21262d;
        border: 1px solid #30363d;
        color: #c9d1d9;
    }

    .form-control:focus {
        background-color: #21262d;
        border-color: #58a6ff;
        color: #c9d1d9;
        box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.3);
    }

    .form-control::placeholder {
        color: #6e7681;
    }

    /* Lista de clientes */
    #client-list-container {
        background-color: #161b22;
        box-shadow: inset -5px 0px 10px 0px rgba(0, 0, 0, 0.3);
    }

    .client {
        background-color: #21262d;
        color: #c9d1d9;
        border-bottom: 1px solid #30363d;
    }

    .client:hover {
        background-color: #30363d;
    }

    .highlight-client {
        background-color: #1c3a2a !important;
        border-bottom: solid 3px #238636;
    }

    /* Área de chat */
    #chat-messages {
        background-color: #0d1117;
        box-shadow: inset 0px 5px 10px 2px rgba(0, 0, 0, 0.3);
    }

    /* Mensajes recibidos */
    .received {
        background-color: #21262d;
        color: #c9d1d9;
        box-shadow: 0px 2px 6px 1px rgba(0, 0, 0, 0.3);
    }

    .message-text-received {
        color: #c9d1d9;
    }

    .message-received {
        color: #58a6ff;
    }

    /* Mensajes enviados */
    .sent {
        background-color: #1f4a3d;
        color: #c9d1d9;
    }

    .message-text-sent {
        color: #c9d1d9;
    }

    .message-sent {
        color: #3fb950;
    }

    .message-time-received,
    .message-time-sent {
        color: #6e7681;
    }

    /* Formulario de mensaje */
    #message-form {
        background-color: #161b22;
        border-top: 1px solid #30363d;
    }

    .input-container {
        background-color: #21262d;
    }

    #messageInput {
        color: #c9d1d9;
    }

    #messageInput::placeholder {
        color: #6e7681;
    }

    /* Botones */
    #send-button {
        background-color: #238636;
    }

    #send-button:hover {
        background-color: #2ea043;
    }

    .btn-outline-secondary {
        color: #c9d1d9;
        border-color: #30363d;
    }

    .btn-outline-secondary:hover {
        background-color: #30363d;
        color: #fff;
    }

    .btn-outline-info {
        color: #58a6ff;
        border-color: #58a6ff;
    }

    /* Modales */
    .modal-content {
        background-color: #161b22;
        border: 1px solid #30363d;
        color: #c9d1d9;
    }

    .modal-header {
        border-bottom: 1px solid #30363d;
    }

    .modal-footer {
        border-top: 1px solid #30363d;
    }

    .titulo_r {
        color: #c9d1d9;
    }

    /* Tablas */
    .table {
        color: #c9d1d9;
    }

    .table-light {
        background-color: #21262d !important;
        color: #c9d1d9;
    }

    .table-light th {
        background-color: #21262d;
        color: #c9d1d9;
        border-color: #30363d;
    }

    /* Respuestas rápidas - dark mode */
    .quick-replies-menu {
        background-color: #1c2128 !important;
        border: 1px solid #30363d !important;
    }

    .quick-reply-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .quick-reply-item:hover {
        background: linear-gradient(90deg, rgba(88, 166, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 100%);
    }

    .quick-reply-dynamic {
        background: linear-gradient(135deg, #1a3a2a 0%, #1a3320 100%) !important;
        border-left: 4px solid #3fb950 !important;
    }

    .quick-reply-dynamic:hover {
        background: linear-gradient(135deg, #1f4a3a 0%, #1f4430 100%) !important;
        box-shadow: 0 2px 8px rgba(63, 185, 80, 0.2);
    }

    .quick-reply-dynamic .quick-reply-title {
        color: #3fb950 !important;
    }

    .quick-reply-dynamic .quick-reply-preview {
        color: #57ab5a !important;
    }

    .quick-reply-title {
        color: #c9d1d9;
    }

    .quick-reply-preview {
        color: #6e7681;
    }

    .quick-reply-category {
        color: #a5b4fc;
    }

    .quick-reply-category::before {
        background: #a5b4fc;
    }

    .dropdown-header {
        background-color: #21262d !important;
        color: #c9d1d9;
    }

    #quickRepliesBtn {
        border-color: #a5b4fc !important;
        color: #a5b4fc !important;
    }

    #quickRepliesBtn:hover {
        background: #667eea !important;
        border-color: #667eea !important;
        color: #fff !important;
    }

    .quick-replies-menu .dropdown-divider {
        border-color: #30363d;
    }

    /* Scrollbars */
    #chat-messages::-webkit-scrollbar-track,
    #client-list-container::-webkit-scrollbar-track {
        background: #21262d;
    }

    #chat-messages::-webkit-scrollbar-thumb,
    #client-list-container::-webkit-scrollbar-thumb {
        background: #30363d;
    }

    #chat-messages::-webkit-scrollbar-thumb:hover,
    #client-list-container::-webkit-scrollbar-thumb:hover {
        background: #484f58;
    }

    /* Lightbox */
    .image-lightbox {
        background-color: rgba(0, 0, 0, 0.98);
    }

    /* Loading indicator */
    #load-more-indicator {
        color: #c9d1d9;
    }

    /* Badges */
    .badge.bg-secondary {
        background-color: #30363d !important;
    }

    /* Links */
    a {
        color: #58a6ff;
    }

    a:hover {
        color: #79c0ff;
    }
}


/* ===== RESPUESTAS RÁPIDAS - REDESIGN ===== */
.quick-replies-container {
    display: flex;
    gap: 8px;
    padding: 0 10px;
}

.quick-replies-menu {
    max-height: 450px;
    overflow-y: auto;
    min-width: 340px;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    padding: 0 !important;
}

.quick-replies-menu .dropdown-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 16px;
    border-radius: 12px 12px 0 0;
    letter-spacing: 0.3px;
}

.quick-replies-menu .dropdown-header i {
    margin-right: 6px;
}

/* Botón dinámico destacado */
.quick-reply-dynamic {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%) !important;
    border-left: 4px solid #43a047 !important;
    margin: 8px !important;
    border-radius: 8px !important;
    transition: all 0.2s ease;
}

.quick-reply-dynamic:hover {
    background: linear-gradient(135deg, #c8e6c9 0%, #dcedc8 100%) !important;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(67, 160, 71, 0.25);
}

.quick-reply-dynamic .quick-reply-title {
    color: #2e7d32 !important;
    font-size: 14px !important;
    font-weight: 700;
}

.quick-reply-dynamic .quick-reply-title i {
    font-size: 16px;
    margin-right: 4px;
}

.quick-reply-dynamic .quick-reply-preview {
    color: #558b2f !important;
    font-size: 11px;
    font-style: italic;
}

.quick-replies-menu .dropdown-divider {
    margin: 0 12px;
    border-color: rgba(0, 0, 0, 0.06);
}

.quick-reply-item {
    white-space: normal;
    word-wrap: break-word;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease;
}

.quick-reply-item:last-child {
    border-bottom: none;
}

.quick-reply-item:hover {
    background: linear-gradient(90deg, #e3f2fd 0%, #f5f5f5 100%);
    padding-left: 20px;
}

.quick-reply-title {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 13px;
    line-height: 1.4;
}

.quick-reply-preview {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
    max-height: 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.quick-reply-category {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    color: #667eea;
    padding: 8px 16px 4px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-reply-category::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
}

/* Scrollbar del menú */
.quick-replies-menu::-webkit-scrollbar {
    width: 4px;
}

.quick-replies-menu::-webkit-scrollbar-track {
    background: transparent;
}

.quick-replies-menu::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* Botón activador más visible */
#quickRepliesBtn {
    border-radius: 50% !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 2px solid #667eea !important;
    color: #667eea !important;
    transition: all 0.2s ease;
}

#quickRepliesBtn:hover {
    background: #667eea !important;
    color: #fff !important;
    transform: scale(1.1);
}

#quickRepliesBtn i {
    font-size: 16px;
}

#message-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}


/* ===== VISTA MÓVIL - OCULTAR LISTA AL SELECCIONAR CHAT ===== */
@media (max-width: 768px) {

    /* Cuando hay chat activo, ocultar lista */
    body.chat-active #client-list-container {
        display: none !important;
    }

    /* Chat ocupa todo el ancho */
    body.chat-active #chat-container {
        width: 100% !important;
    }

    /* Botón volver visible solo en móvil con chat activo */
    .btn-back-to-list {
        display: none;
    }

    body.chat-active .btn-back-to-list {
        display: flex !important;
        align-items: center;
        gap: 5px;
        background: #007bff;
        color: white;
        border: none;
        padding: 8px 15px;
        border-radius: 20px;
        font-size: 14px;
        cursor: pointer;
        position: fixed;
        top: 75px;
        left: 10px;
        z-index: 1000;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        transition: all 0.3s ease;
    }

    body.chat-active .btn-back-to-list:hover {
        background: #0056b3;
        transform: scale(1.05);
    }

    /* Ajustar chat-messages para no tapar botón */
    body.chat-active #chat-messages {
        margin-top: 110px;
    }

}

/* Desktop: botón oculto */
@media (min-width: 769px) {
    .btn-back-to-list {
        display: none !important;
    }
}

/* Dark mode para botón volver */
@media (prefers-color-scheme: dark) {
    .btn-back-to-list {
        background: #238636;
    }

    .btn-back-to-list:hover {
        background: #2ea043;
    }
}

/* ===== LISTA DE CHATS ESTILO TELEGRAM ===== */
.client {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: background-color 0.2s ease;
    gap: 12px;
}

.client:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.client-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 500;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
}

.client-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.client-name {
    font-weight: 600;
    font-size: 16px;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.client-time {
    font-size: 13px;
    color: #8e8e93;
    flex-shrink: 0;
}

.client-time.has-unread {
    color: #31a24c;
    font-weight: 600;
}

.client-expiry {
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 210px;
}

.client-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.client-preview {
    font-size: 14px;
    color: #8e8e93;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.client-badge {
    background-color: #31a24c;
    color: white;
    font-size: 12px;
    font-weight: 600;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    flex-shrink: 0;
}

/* Ocultar contador antiguo */
.unread-count {
    display: none !important;
}

/* Dark mode para lista Telegram */
@media (prefers-color-scheme: dark) {
    .client {
        border-bottom: 1px solid #30363d;
    }

    .client:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }

    .client-name {
        color: #e4e6eb;
    }

    .client-preview {
        color: #8b949e;
    }

    .client-time {
        color: #8b949e;
    }

    .client-time.has-unread {
        color: #3fb950;
    }

    .client-badge {
        background-color: #238636;
    }
}

/* Ajustes responsive */
@media (max-width: 768px) {
    .client-name {
        max-width: 140px;
    }

    .client-preview {
        max-width: 160px;
    }

    .client-avatar {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* ===== DIFERENCIACIÓN LEÍDOS vs NO LEÍDOS ===== */

/* Chat con mensajes no leídos */
.client.has-unread {
    background-color: rgba(49, 162, 76, 0.08);
}

.client.has-unread:hover {
    background-color: rgba(49, 162, 76, 0.15);
}

.client.has-unread .client-name {
    font-weight: 700;
}

.client.has-unread .client-preview {
    color: #000;
    font-weight: 500;
}

/* Ampliar espacio para nombres */
.client-name {
    max-width: 65% !important;
    font-size: 15px;
}

.client-preview {
    max-width: 70% !important;
}

/* Dark mode - no leídos */
@media (prefers-color-scheme: dark) {
    .client.has-unread {
        background-color: rgba(35, 134, 54, 0.15);
    }

    .client.has-unread:hover {
        background-color: rgba(35, 134, 54, 0.25);
    }

    .client.has-unread .client-preview {
        color: #e4e6eb;
    }
}

/* Asegurar que el badge se muestre */
.client-footer {
    position: relative;
}

.client-badge {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* ===== Payment Panel Cards ===== */
.pp-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    transition: all 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.pp-card:hover { border-color: #198754; box-shadow: 0 2px 8px rgba(25,135,84,0.15); }
.pp-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}
.pp-banco { font-size: 11px; color: #6c757d; background: #f0f0f0; padding: 1px 6px; border-radius: 4px; }
.pp-card-mid {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}
.pp-monto { font-size: 16px; font-weight: 700; color: #198754; }
.pp-ref { font-size: 11px; color: #999; }
.pp-card-bot {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pp-fecha { font-size: 11px; color: #888; }
.pp-btns { display: flex; gap: 4px; }
.pp-link-btn { font-size: 12px !important; }

/* ===== Active Client Highlight ===== */
.client.active {
    background: rgba(25, 135, 84, 0.18) !important;
    border-left: 3px solid #198754;
    transition: all 0.2s ease;
}
.client.active .client-name { color: #4ade80 !important; }

/* ===== MOBILE IMPROVEMENTS ===== */
@media (max-width: 768px) {
    /* Ocultar nav-injector floating buttons en chatWEB */
    .nav-floating, .floating-nav, [class*="nav-inject"], #universal-nav {
        display: none !important;
    }

    /* Navbar más compacto */
    .navbar.fixed-top {
        padding: 6px 10px;
        min-height: 50px;
    }
    .navbar .form-control {
        font-size: 14px;
        padding: 6px 10px;
        height: 36px;
    }
    .navbar .navbar-toggler {
        padding: 4px 8px;
        font-size: 14px;
    }

    /* Quick replies bar más compacta */
    .quick-replies-container {
        padding: 4px 8px !important;
    }
    .quick-replies-container .btn-sm {
        padding: 3px 8px !important;
        font-size: 12px !important;
    }

    /* Message form más compacto */
    #message-form {
        padding: 8px 10px;
    }
    .input-container {
        padding: 6px 12px;
        margin: 0 6px;
    }
    #messageInput {
        font-size: 14px;
        padding: 6px 10px;
    }
    #send-button {
        min-width: 38px;
        min-height: 38px;
        padding: 8px;
        margin-left: 6px;
    }

    /* Client list items más compactos */
    .client {
        padding: 10px 12px;
        font-size: 14px;
    }

    /* Chat messages margin top ajustado */
    #chat-messages {
        margin-top: 50px;
        padding: 10px;
    }

    /* Offcanvas pagos full width en mobile */
    #paymentsOffcanvas {
        width: 100% !important;
    }

    /* Burbujas de mensaje más anchas */
    .message {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .message {
        max-width: 90%;
        padding: 8px 10px;
    }
    #client-list-container {
        margin-top: 50px;
    }
}

/* Ocultar navegación rápida en chatWEB móvil - evita solapamiento con input */
@media (max-width: 768px) {
    .ctnet-quick-nav {
        display: none !important;
    }
}

/* Payment card - already registered */
.pp-card-dup {
    opacity: 0.6;
    border-color: #dc3545 !important;
    background: #fff5f5 !important;
}
