
:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --whatsapp-green: #075e54;
    --whatsapp-light-green: #dcf8c6;
    --border-radius: 8px;
    --box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    margin: 0;
    padding: 0;
}


.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn {
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}


.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
}


.status-online {
    color: var(--success-color);
}

.status-offline {
    color: var(--dark-color);
}

.online-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}


.message {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    clear: both;
    transform-origin: bottom center;
    
    contain: layout;
    will-change: transform, opacity;
    
    animation: messageSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}


.message.history-message {
    animation: none;
    opacity: 1;
    transform: none;
}


.message.new-message {
    animation: agentMessageAppear 0.25s cubic-bezier(0.2, 0, 0.2, 1);
}

.message.message-fade-out {
    animation: messageFadeOut 0.25s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

@keyframes messageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes agentMessageAppear {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes messageFadeOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
}


@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.message.visitor-left,
.message.agent-left {
    align-items: flex-start;
}


.message.visitor-right,
.message.agent-right,
.message.welcome-right {
    align-items: flex-end;
}


.message.visitor {
    align-items: flex-start;
}

.message.agent {
    align-items: flex-end;
}

.message-bubble {
    max-width: 70%;
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
    line-height: 1.4;
    font-size: 14.2px;
    min-height: 20px;
    display: block;
    backface-visibility: hidden; 
    -webkit-backface-visibility: hidden;
    
    contain: layout style;
    transform: translateZ(0);
    will-change: auto;
}

.message-content {
    margin-right: 60px; 
    margin-bottom: -4px; 
}


.message.visitor-left .message-content,
.message.agent-left .message-content {
    margin-left: 0;
    margin-right: 60px;
}


.message-bubble::after {
    content: "";
    display: table;
    clear: both;
}


.message.visitor-left .message-bubble,
.message.visitor .message-bubble {
    background: #22bf58;
    color: #ffffff;
    border-bottom-left-radius: 3px;
    position: relative;
}


.message.visitor-left .message-bubble::after,
.message.visitor .message-bubble::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: -7px;
    width: 8px;
    height: 13px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 8 13' height='13' width='8' preserveAspectRatio='xMidYMid meet' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath opacity='0.13' d='M1.533,3.568L8,12.193V1H2.812C1.042,1,0.474,2.156,1.533,3.568z' fill='%23000'/%3E%3Cpath d='M1.533,2.568L8,11.193V0L2.812,0C1.042,0,0.474,1.156,1.533,2.568z' fill='%2322bf58'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    filter: drop-shadow(0 1px 0.5px rgba(0,0,0,0.13));
}

.message.visitor-right .message-bubble {
    background: #d9fdd3;
    color: #111b21;
    border-bottom-right-radius: 3px;
    position: relative;
}


.message.visitor-right .message-bubble::after {
    content: '';
    position: absolute;
    bottom: -1px; 
    right: -7px; 
    width: 8px;
    height: 13px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 8 13' height='13' width='8' preserveAspectRatio='xMidYMid meet' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath opacity='0.13' d='M5.188,1H0v11.193l6.467-8.625 C7.526,2.156,6.958,1,5.188,1z' fill='%23000'/%3E%3Cpath d='M5.188,0H0v11.193l6.467-8.625C7.526,1.156,6.958,0,5.188,0z' fill='%23d9fdd3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    filter: drop-shadow(0 1px 0.5px rgba(0,0,0,0.13)); 
}


.message.agent-left .message-bubble {
    background: #ffffff;
    color: #111b21;
    border-bottom-left-radius: 3px;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
    position: relative;
}

.message.agent-right .message-bubble,
.message.agent .message-bubble {
    background: #ffffff;
    color: #111b21;
    border-bottom-right-radius: 3px;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
    position: relative;
}


.message.agent-left .message-bubble::after {
    content: '';
    position: absolute;
    bottom: -1px; 
    left: -7px; 
    width: 8px;
    height: 13px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 8 13' height='13' width='8' preserveAspectRatio='xMidYMid meet' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath opacity='0.13' d='M1.533,3.568L8,12.193V1H2.812C1.042,1,0.474,2.156,1.533,3.568z' fill='%23000'/%3E%3Cpath d='M1.533,2.568L8,11.193V0L2.812,0C1.042,0,0.474,1.156,1.533,2.568z' fill='%23ffffff'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    
    filter: drop-shadow(0 1px 0.5px rgba(0,0,0,0.13)); 
}


.message.welcome-right .message-bubble {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-bottom-right-radius: 4px;
}


.message.system {
    align-items: center;
}

.message.system .message-bubble {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    text-align: center;
    font-size: 0.9em;
    border-radius: 10px;
    max-width: 80%;
}

.message-time {
    font-size: 11px;
    color: rgba(17, 27, 33, 0.6);
    margin-top: 2px;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    line-height: 1;
    float: right;
    clear: both;
    margin-left: 8px;
    position: relative;
    bottom: 0;
}


.message.visitor-left .message-time,
.message.agent-left .message-time {
    float: right;
    margin-left: 8px;
    margin-right: 0;
}


.message.visitor-left .message-time,
.message.visitor .message-time {
    color: #ffffff;
}


.message.visitor-right .message-time,
.message.agent-right .message-time,
.message.welcome-right .message-time,
.message.agent .message-time {
    float: right;
    margin-left: 8px;
}


.message.visitor-right .message-time {
    color: #111b21;
}


.message.visitor-right .message-time::after,
.message.visitor .message-time::after {
    content: '';
    width: 16px;
    height: 11px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 11' height='11' width='16' preserveAspectRatio='xMidYMid meet' xmlns='http://www.w3.org/2000/svg' fill='none'%3E%3Cpath d='M11.0714 0.652832C10.991 0.585124 10.8894 0.55127 10.7667 0.55127C10.6186 0.55127 10.4916 0.610514 10.3858 0.729004L4.19688 8.36523L1.79112 6.09277C1.7488 6.04622 1.69802 6.01025 1.63877 5.98486C1.57953 5.95947 1.51817 5.94678 1.45469 5.94678C1.32351 5.94678 1.20925 5.99544 1.11192 6.09277L0.800883 6.40381C0.707784 6.49268 0.661235 6.60482 0.661235 6.74023C0.661235 6.87565 0.707784 6.98991 0.800883 7.08301L3.79698 10.0791C3.94509 10.2145 4.11224 10.2822 4.29844 10.2822C4.40424 10.2822 4.5058 10.259 4.60313 10.2124C4.70046 10.1659 4.78086 10.1003 4.84434 10.0156L11.4903 1.59863C11.5623 1.5013 11.5982 1.40186 11.5982 1.30029C11.5982 1.14372 11.5348 1.01888 11.4078 0.925781L11.0714 0.652832ZM8.6212 8.32715C8.43077 8.20866 8.2488 8.09017 8.0753 7.97168C7.99489 7.89128 7.8891 7.85107 7.75791 7.85107C7.6098 7.85107 7.4892 7.90397 7.3961 8.00977L7.10411 8.33984C7.01947 8.43717 6.97715 8.54508 6.97715 8.66357C6.97715 8.79476 7.0237 8.90902 7.1168 9.00635L8.1959 10.0791C8.33132 10.2145 8.49636 10.2822 8.69102 10.2822C8.79681 10.2822 8.89838 10.259 8.99571 10.2124C9.09304 10.1659 9.17556 10.1003 9.24327 10.0156L15.8639 1.62402C15.9358 1.53939 15.9718 1.43994 15.9718 1.32568C15.9718 1.1818 15.9125 1.05697 15.794 0.951172L15.4386 0.678223C15.3582 0.610514 15.2587 0.57666 15.1402 0.57666C14.9964 0.57666 14.8715 0.635905 14.7657 0.754395L8.6212 8.32715Z' fill='rgba(17, 27, 33, 0.6)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    margin-left: 4px;
}


.message.system .message-time {
    float: none;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    display: block;
}


.chat-input {
    background: white;
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
}

.chat-input .form-control {
    border-radius: 25px;
    border: 1px solid #ddd;
    padding: 12px 20px;
    resize: none;
}

.chat-input .btn {
    border-radius: 50%;
    width: 45px;
    height: 45px;
    padding: 0;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}


.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.quick-reply-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}


.conversation-list {
    padding: 0;
    margin: 0;
    list-style: none;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.conversation-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.conversation-item:hover {
    background: #f8f9fa;
}

.conversation-item.active {
    background: var(--primary-color);
    color: white;
}

.conversation-item.active .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.unread-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}


.sidebar {
    background: white;
    min-height: 100vh;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
}

.sidebar .nav-link {
    color: #495057;
    padding: 15px 20px;
    border-bottom: 1px solid #f8f9fa;
    transition: all 0.2s;
    border-radius: 0;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: var(--primary-color);
    color: white;
}


.stats-card {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    transition: transform 0.2s;
}

.stats-card:hover {
    transform: translateY(-5px);
}

.stats-card .stats-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}


.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}


.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    background: var(--light-color);
}


::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}


@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
    }
    
    .chat-window {
        height: 100vh;
        border-radius: 0;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .stats-card .stats-number {
        font-size: 2rem;
    }
    
    .conversation-item {
        padding: 12px;
    }
    
    .quick-reply-btn {
        font-size: 0.8em;
        padding: 5px 12px;
    }
}


.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    text-align: center;
    padding: 40px;
}

.empty-state i {
    opacity: 0.5;
    margin-bottom: 20px;
}


.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.badge {
    font-size: 0.75em;
    font-weight: 500;
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}


.typing-indicator {
    padding: 10px 20px;
    font-style: italic;
    color: #666;
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
    margin: 10px 15px;
}

.typing-indicator i {
    animation: typing 1.4s infinite;
}

@keyframes typing {
    0%, 60%, 100% { opacity: 1; }
    30% { opacity: 0.4; }
}


.online-indicator {
    font-size: 12px;
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    text-align: center;
    line-height: 16px;
    flex-shrink: 0;
}

.online-indicator.online {
    color: #28a745;
    animation: pulse 2s infinite;
}

.online-indicator.offline {
    color: #6c757d;
    opacity: 0.7;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}


.whatsapp-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 30% 20%, rgba(38, 211, 103, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(32, 185, 84, 0.15) 0%, transparent 50%),
        linear-gradient(135deg, #26d367 0%, #20b954 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 1;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.whatsapp-loader-overlay.fade-out {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.whatsapp-loader-container {
    text-align: center;
    color: white;
    transform: translateY(0);
    animation: containerFloat 3s ease-in-out infinite;
}

@keyframes containerFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.whatsapp-logo {
    margin-bottom: 40px;
    position: relative;
    animation: logoGlow 2.5s ease-in-out infinite;
}

.whatsapp-logo img {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.2));
}

@keyframes logoGlow {
    0%, 100% { 
        filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.2)) drop-shadow(0 0 20px rgba(255, 255, 255, 0.1));
    }
    50% { 
        filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 30px rgba(255, 255, 255, 0.2));
    }
}

.whatsapp-loader-dots {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    gap: 8px;
}

.whatsapp-loader-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6));
    position: relative;
    animation: dotWave 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.whatsapp-loader-dots .dot::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    animation: dotRipple 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.whatsapp-loader-dots .dot:nth-child(1) { animation-delay: -0.6s; }
.whatsapp-loader-dots .dot:nth-child(1)::before { animation-delay: -0.6s; }
.whatsapp-loader-dots .dot:nth-child(2) { animation-delay: -0.3s; }
.whatsapp-loader-dots .dot:nth-child(2)::before { animation-delay: -0.3s; }
.whatsapp-loader-dots .dot:nth-child(3) { animation-delay: 0s; }
.whatsapp-loader-dots .dot:nth-child(3)::before { animation-delay: 0s; }

@keyframes dotWave {
    0%, 60%, 100% {
        transform: scale(0.8) translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: scale(1.4) translateY(-12px);
        opacity: 1;
    }
}

@keyframes dotRipple {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0;
    }
    30% {
        transform: scale(2);
        opacity: 0.4;
    }
}

.whatsapp-loader-text {
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    letter-spacing: 0.5px;
    animation: textBreath 3s ease-in-out infinite;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

@keyframes textBreath {
    0%, 100% { 
        opacity: 0.8;
        transform: scale(1);
    }
    50% { 
        opacity: 1;
        transform: scale(1.02);
    }
}


.whatsapp-loader-progress {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.whatsapp-loader-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    animation: progressSlide 2s linear infinite;
}

@keyframes progressSlide {
    0% { left: -100%; }
    100% { left: 100%; }
}


.rich-text-content {
    margin-bottom: 8px;
}

.rich-images {
    margin: 8px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    
    contain: layout;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.rich-image {
    
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    will-change: transform;
}


.rich-image[style*="width"],
.rich-image[style*="height"] {
    max-width: none !important;
    max-height: none !important;
}

.rich-image:hover {
    transform: scale(1.02);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.rich-buttons {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rich-button {
    padding: 6px 12px;
    border: none;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rich-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.rich-button.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.rich-button.btn-primary:hover {
    background-color: #0056b3;
}

.rich-button.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.rich-button.btn-secondary:hover {
    background-color: #545b62;
}

.rich-button.btn-success {
    background-color: var(--success-color);
    color: white;
}

.rich-button.btn-success:hover {
    background-color: #1e7e34;
}

.rich-button.btn-warning {
    background-color: var(--warning-color);
    color: #212529;
}

.rich-button.btn-warning:hover {
    background-color: #e0a800;
}

.rich-button.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.rich-button.btn-danger:hover {
    background-color: #c82333;
}


.message-bubble .rich-button {
    font-size: 12px;
    padding: 5px 10px;
}

.message-bubble .rich-image {
    max-width: 150px;
    max-height: 100px;
}


.message-bubble .rich-image[style*="width"],
.message-bubble .rich-image[style*="height"] {
    max-width: none !important;
    max-height: none !important;
}


.whatsapp-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 8px;
    margin-bottom: 8px !important;
}

.whatsapp-header h6 {
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.whatsapp-avatar {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.whatsapp-avatar img {
    border: 1px solid rgba(0, 0, 0, 0.1);
}


.text-message-content,
.rich-message-content {
    line-height: 1.4;
}

.rich-message-content .rich-text-content {
    margin-bottom: 4px;
}


.message.agent-left .whatsapp-header,
.message.agent-right .whatsapp-header,
.message.welcome-right .whatsapp-header {
    opacity: 0.95;
}

.message.visitor-left .whatsapp-header,
.message.visitor-right .whatsapp-header {
    display: none; 
}


.rich-inputs {
    margin: 12px 0;
}

.rich-input-container {
    background: transparent;
    border-radius: 16px;
    padding: 16px 0;
    margin-bottom: 16px;
    position: relative;
}

.rich-input-label {
    display: block;
    font-weight: 500;
    color: #26d367;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.4;
    letter-spacing: 0.2px;
    text-align: left;
    padding-left: 16px;
}

.rich-input {
    width: 100%;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 16px;
    background: white;
    box-shadow: 0 2px 12px rgba(38, 211, 103, 0.08);
    color: #333;
    font-weight: 400;
    height: 44px;
}

.rich-input:focus {
    outline: none;
    border-color: #26d367;
    box-shadow: none;
}

.rich-input::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

.rich-input:focus::placeholder {
    color: #c0c0c0;
}


.rich-input:hover:not(:focus) {
    border-color: #26d367;
}


.rich-input:disabled {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}


.rich-input-container:hover .rich-input-label {
    color: #22c55e;
}


.rich-input:focus + .rich-input-label,
.rich-input-container:focus-within .rich-input-label {
    color: #22c55e;
}


.rich-input-container {
    opacity: 1;
    transform: none;
}


.phone-validation-message {
    margin-top: 8px !important;
    margin-bottom: 4px !important;
    padding: 6px 0 6px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.3;
    background: transparent;
    border: 1px solid transparent;
    text-align: left;
}

.phone-validation-message.text-success {
    background: transparent;
    border-color: transparent;
    color: #868e96 !important;
    font-weight: 400;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}


.phone-validation-message.text-success.fade-in {
    opacity: 0.7;
}


@media (max-width: 768px) {
    .rich-input {
        font-size: 16px; 
        padding: 10px 14px;
        height: 42px;
    }
    
    .rich-input-container {
        padding: 12px 0;
        margin-bottom: 12px;
    }
    
    .rich-input-label {
        font-size: 13px;
        padding-left: 14px;
    }
    
    .phone-validation-message {
        font-size: 12px;
        padding: 5px 0 5px 14px;
        margin-top: 6px !important;
    }
}

.rich-input-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    min-height: 44px;
    min-width: 120px;
    text-align: center;
    line-height: 1.3;
    overflow: hidden;
    
    
    opacity: 0;
    transform: translateY(15px) scale(0.9);
    animation: submitButtonFadeIn 0.5s ease-out forwards;
}


.rich-input-submit::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
    z-index: 1;
}

.rich-input-submit:active::before {
    width: 200px;
    height: 200px;
}


.rich-input-submit span,
.rich-input-submit {
    position: relative;
    z-index: 2;
}


@keyframes submitButtonFadeIn {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.rich-input-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.rich-input-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}


.rich-input-submit.btn-primary {
    background: linear-gradient(135deg, #26d367 0%, #20b954 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rich-input-submit.btn-primary:hover {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.rich-input-submit.btn-success {
    background: linear-gradient(135deg, #26d367 0%, #20b954 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rich-input-submit.btn-success:hover {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.rich-input-submit.btn-warning {
    background: linear-gradient(135deg, #26d367 0%, #20b954 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rich-input-submit.btn-warning:hover {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.rich-input-submit.btn-danger {
    background: linear-gradient(135deg, #26d367 0%, #20b954 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rich-input-submit.btn-danger:hover {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.rich-input-submit.btn-secondary {
    background: linear-gradient(135deg, #26d367 0%, #20b954 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rich-input-submit.btn-secondary:hover {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}


.rich-input-submit.loading {
    pointer-events: none;
    opacity: 0.8;
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rich-input-submit.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-right-color: currentColor;
    border-radius: 50%;
    animation: spinPulse 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    z-index: 3;
}


.rich-input-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}


@media (max-width: 768px) {
    .rich-input-submit {
        padding: 10px 20px;
        min-height: 40px;
        font-size: 13px;
        min-width: 100px;
    }
}




.rich-buttons {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 280px;
    animation: buttonsSlideIn 0.4s ease-out;
}


@keyframes buttonsSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.rich-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 44px;
    text-align: center;
    line-height: 1.3;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
    
    
    opacity: 0;
    transform: translateY(15px) scale(0.9);
    animation: buttonFadeIn 0.5s ease-out forwards;
}


@keyframes buttonFadeIn {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


.rich-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18);
    filter: brightness(1.05);
}

.rich-button:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}


.rich-button:focus {
    outline: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), 0 0 0 3px rgba(38, 211, 103, 0.2);
}


.rich-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
    z-index: 1;
}

.rich-button:active::before {
    width: 200px;
    height: 200px;
}


.rich-button span,
.rich-button {
    position: relative;
    z-index: 2;
}


.rich-button.btn-primary {
    background: linear-gradient(135deg, #26d367 0%, #20b954 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rich-button.btn-primary:hover {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.rich-button.btn-success {
    background: linear-gradient(135deg, #26d367 0%, #20b954 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rich-button.btn-success:hover {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.rich-button.btn-warning {
    background: linear-gradient(135deg, #26d367 0%, #20b954 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rich-button.btn-warning:hover {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.rich-button.btn-danger {
    background: linear-gradient(135deg, #26d367 0%, #20b954 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rich-button.btn-danger:hover {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.rich-button.btn-secondary {
    background: linear-gradient(135deg, #26d367 0%, #20b954 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rich-button.btn-secondary:hover {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}


#chatMessages {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}


#chatMessages::-webkit-scrollbar {
    width: 6px;
}

#chatMessages::-webkit-scrollbar-track {
    background: transparent;
}

#chatMessages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    transition: background 0.3s ease;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}


.chat-container {
    transition: all 0.25s cubic-bezier(0.2, 0, 0.2, 1);
}


.conversation-switching {
    opacity: 0.7;
    transform: scale(0.98);
    transition: all 0.2s cubic-bezier(0.2, 0, 0.2, 1);
}

.conversation-loaded {
    opacity: 1;
    transform: scale(1);
}


.page-transition {
    opacity: 0;
    transform: translateY(12px);
    animation: pageEnter 0.3s cubic-bezier(0.2, 0, 0.2, 1) forwards;
}

@keyframes pageEnter {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}


.agent-workspace {
    transition: all 0.25s cubic-bezier(0.2, 0, 0.2, 1);
}

.agent-workspace.loading {
    opacity: 0.8;
    pointer-events: none;
}


.chat-messages-container {
    transition: opacity 0.2s cubic-bezier(0.2, 0, 0.2, 1);
}

.chat-messages-container.loading {
    opacity: 0.6;
}


.admin-intervention-banner {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 8px 0;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    animation: adminBannerSlideDown 0.3s cubic-bezier(0.2, 0, 0.2, 1);
    z-index: 1000;
    position: relative;
}

.admin-intervention-banner i {
    color: rgba(255, 255, 255, 0.9);
}

.admin-intervention-banner strong {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

@keyframes adminBannerSlideDown {
    0% {
        opacity: 0;
        transform: translateY(-100%);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}


.workspace.admin-intervention {
    padding-top: 0;
}

.workspace.admin-intervention .row {
    height: calc(100vh - 40px); 
}


.copy-message-container {
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
}

.copy-message-btn {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 70px;
    justify-content: center;
}

.copy-message-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.copy-message-btn:active {
    transform: translateY(0);
}

.copy-message-btn i {
    font-size: 11px;
}


.copy-message-btn.btn-success {
    animation: copySuccess 0.3s ease-out;
}

@keyframes copySuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}


.rich-button.whatsapp-call {
    background: linear-gradient(135deg, #26d367 0%, #20b954 100%);
    color: white;
    position: relative;
}

.rich-button.whatsapp-call::after {
    content: '📞';
    margin-left: 8px;
    font-size: 16px;
    animation: phoneRing 2s ease-in-out infinite;
}

@keyframes phoneRing {
    0%, 20%, 50%, 80%, 100% {
        transform: rotate(0deg);
    }
    10% {
        transform: rotate(-10deg);
    }
    30% {
        transform: rotate(10deg);
    }
    60% {
        transform: rotate(-5deg);
    }
    90% {
        transform: rotate(5deg);
    }
}

.rich-button.whatsapp-link {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
    position: relative;
}

.rich-button.whatsapp-link::after {
    content: '🔗';
    margin-left: 8px;
    font-size: 14px;
    animation: linkPulse 1.5s ease-in-out infinite;
}

@keyframes linkPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}


.rich-button.whatsapp-reply::before {
    content: '💬';
    margin-right: 6px;
    font-size: 14px;
}


.rich-button.whatsapp-location {
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A52 100%);
    color: white;
}

.rich-button.whatsapp-location::after {
    content: '📍';
    margin-left: 8px;
    font-size: 16px;
}


.rich-button.whatsapp-download {
    background: linear-gradient(135deg, #9B59B6 0%, #8E44AD 100%);
    color: white;
}

.rich-button.whatsapp-download::after {
    content: '📄';
    margin-left: 8px;
    font-size: 14px;
}


@media (max-width: 768px) {
    .rich-buttons {
        max-width: 100%;
        margin-top: 8px;
    }
    
    .rich-button {
        padding: 10px 16px;
        min-height: 40px;
        font-size: 13px;
    }
}


.message-bubble .rich-buttons {
    margin-top: 8px;
    gap: 6px;
}

.message-bubble .rich-button {
    padding: 8px 16px;
    min-height: 36px;
    font-size: 12px;
    border-radius: 20px;
}


.rich-button.loading {
    pointer-events: none;
    opacity: 0.8;
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rich-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-right-color: currentColor;
    border-radius: 50%;
    animation: spinPulse 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    z-index: 3;
}


@keyframes spinPulse {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotate(180deg) scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: rotate(360deg) scale(1);
        opacity: 1;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


.rich-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}


.rich-buttons.horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.rich-buttons.horizontal .rich-button {
    flex: 1;
    min-width: 120px;
    max-width: 160px;
}


.rich-button {
    white-space: normal;
    text-overflow: ellipsis;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 2.6em;
}


@media (prefers-color-scheme: dark) {
    .rich-button.btn-secondary {
        background: linear-gradient(135deg, #495057 0%, #343A40 100%);
        color: #F8F9FA;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .rich-button.btn-secondary:hover {
        background: linear-gradient(135deg, #343A40 0%, #212529 100%);
    }
}


.phone-input-message {
    background: linear-gradient(135deg, #f8fffe 0%, #e8f8f5 100%);
    border: 1px solid #d1f2eb;
    border-radius: 12px;
    padding: 16px;
    margin: 8px 0;
}

.phone-message-header {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #155724;
    margin-bottom: 8px;
}

.phone-number-container {
    background: white;
    border: 2px solid #28a745;
    border-radius: 8px;
    padding: 12px;
    position: relative;
}

.phone-number-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.phone-number {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    color: #155724;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    flex: 1;
    text-align: center;
    letter-spacing: 1px;
    user-select: all; 
}

.copy-phone-btn {
    background: #28a745;
    color: white;
    border: 1px solid #28a745;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
}

.copy-phone-btn:hover {
    background: #218838;
    border-color: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.copy-phone-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(40, 167, 69, 0.2);
}

.copy-phone-btn i {
    font-size: 16px;
}

.copy-success-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #d4edda;
    color: #155724;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    border: 1px solid #c3e6cb;
    animation: fadeInScale 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    z-index: 10;
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}


@media (max-width: 768px) {
    .phone-input-message {
        padding: 12px;
        margin: 6px 0;
    }
    
    .phone-number {
        font-size: 16px;
        padding: 6px 10px;
    }
    
    .copy-phone-btn {
        min-width: 40px;
        height: 40px;
        padding: 6px 10px;
    }
    
    .copy-success-indicator {
        font-size: 11px;
        padding: 3px 6px;
    }
}


@media (prefers-contrast: high) {
    .phone-number-container {
        border-width: 3px;
    }
    
    .phone-number {
        border-width: 2px;
        color: #000;
        background: #fff;
    }
    
    .copy-phone-btn {
        border-width: 2px;
    }
}


.image-message {
    padding: 0;
    background: transparent;
}

.image-message-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 300px;
    transition: transform 0.2s ease;
}


.message.visitor-right .image-message-container {
    background: transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-width: none; 
    width: auto; 
}

.message.visitor-right .message-image {
    border-radius: 12px;
    max-width: 90vw; 
    width: auto; 
    height: auto; 
    max-height: 80vh; 
}

.image-message-container:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.message-image {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    cursor: pointer;
    display: block;
    transition: opacity 0.2s ease;
}

.message-image:hover {
    opacity: 0.9;
}

.image-message-caption {
    padding: 8px 12px;
    background: #f8f9fa;
    font-size: 13px;
    color: #6c757d;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
}


.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.image-modal.show {
    opacity: 1;
    visibility: visible;
}

.image-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.image-modal-content {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px 20px 20px; 
    box-sizing: border-box;
}

.image-modal-close {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.2s ease;
    font-size: 18px;
}

.image-modal-close:hover {
    background: rgba(0, 0, 0, 1);
    transform: scale(1.1);
}

.image-modal-img {
    max-width: 100%; 
    max-height: 100%; 
    width: auto;
    height: auto;
    object-fit: contain; 
    display: block;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    cursor: zoom-in; 
    transition: transform 0.2s ease;
}

.image-modal-img:hover {
    transform: scale(1.02); 
}


@media (max-width: 768px) {
    .image-message-container {
        max-width: 250px;
    }
    
    .message-image {
        max-height: 150px;
    }
    
    
    .message.visitor-right .image-message-container {
        max-width: none;
    }
    
    .message.visitor-right .message-image {
        max-width: 85vw; 
        max-height: 70vh; 
    }
    
    .image-modal-content {
        padding: 60px 15px 15px 15px; 
    }
    
    .image-modal-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .image-modal-img {
        border-radius: 4px; 
    }
}