.chat-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
}

.chat-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1001;
    text-decoration: none;
    font-size: 20px;
    animation: callPulse 2s ease-in-out infinite;
}

@keyframes callPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    50% {
        box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 0 0 15px rgba(37, 211, 102, 0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(44, 62, 80, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(44, 62, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(44, 62, 80, 0);
    }
}

.chat-button:hover {
    transform: scale(1.15) rotate(15deg);
    background: linear-gradient(135deg, #2EE86E 0%, #15A589 100%);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.chat-button i {
    animation: phoneRing 1.5s ease-in-out infinite;
}

@keyframes phoneRing {
    0%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(-15deg); }
    20%, 40% { transform: rotate(15deg); }
    50% { transform: rotate(0deg); }
}

.chat-window {
    position: fixed;
    bottom: 100px;
    left: 30px;
    width: 450px;
    height: 650px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    transform: scale(0);
    transform-origin: bottom left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border: 1px solid rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: 80vh;
        bottom: 80px;
        max-height: 700px;
    }
}

.chat-window.active {
    transform: scale(1);
    animation: pulse 0.3s ease-out;
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.chat-header {
    padding: 25px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-size: 18px;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-title span {
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chat-logo {
    width: 35px;
    height: 35px;
    object-fit: contain;
    border-radius: 50%;
    background: white;
    padding: 3px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.chat-header-status {
    font-size: 14px;
    background: rgba(255,255,255,0.2);
    padding: 5px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-header-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    display: inline-block;
}

.chat-close {
    cursor: pointer;
    font-size: 20px;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: scroll;
    background-color: #f8f9fa;
    height: calc(100% - 120px);
    max-height: none;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f1f1f1;
}

.message {
    margin: 15px 0;
    padding: 16px 22px;
    border-radius: 20px;
    max-width: 85%;
    font-size: 16px;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease-out;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    line-height: 1.5;
}

.message a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.message a:hover {
    border-bottom-color: var(--primary-color);
}

.message.user a {
    color: white;
    border-bottom-color: rgba(255,255,255,0.3);
}

.message.user a:hover {
    border-bottom-color: white;
}

.user-message {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    margin-left: auto;
    border-radius: 18px 18px 0 18px;
    position: relative;
}

.user-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: inherit;
    border-radius: 50%;
    filter: blur(4px);
    opacity: 0.6;
}

.bot-message {
    background: #f0f2f5;
    color: #212529;
    margin-right: auto;
    border-radius: 18px 18px 18px 0;
    position: relative;
    border: 1px solid rgba(0,0,0,0.05);
}

.bot-message::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 10px;
    height: 10px;
    background: inherit;
    border-radius: 50%;
    filter: blur(4px);
    opacity: 0.6;
}

.quick-questions {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-question-btn {
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 20px;
    padding: 12px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.quick-question-btn:hover {
    background: #e4e6eb;
    transform: translateY(-1px);
}

/* Chat Input */
.chat-input {
    padding: 20px;
    background: linear-gradient(to top, #ffffff, #f8f9fa);
    border-top: 1px solid rgba(0,0,0,0.08);
    margin-top: auto;
    border-radius: 0 0 15px 15px;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
    position: relative;
    padding: 0 5px;
}

.image-upload {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 5px 0;
}

.image-upload label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: #2c3e50;
    font-size: 0.9em;
}

.image-upload label:hover {
    color: #3498db;
}

.image-upload input[type="file"] {
    display: none;
}

.image-preview {
    max-width: 100px;
    max-height: 100px;
    margin-left: 10px;
    border-radius: 5px;
    display: none;
}

.image-preview.active {
    display: block;
}

.chat-input input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.chat-input input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chat-input button {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.chat-input button:hover {
    background: #3498db;
}

.typing-indicator {
    display: none;
    margin-bottom: 10px;
}

.typing-indicator.active {
    display: block;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 3px;
    background: #90a4ae;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 15px 22px;
    background: #f0f2f5;
    border-radius: 20px;
    margin: 10px 0;
    width: fit-content;
    align-self: flex-start;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.typing-indicator.visible {
    opacity: 1;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typing-dot 1.4s infinite;
    display: inline-block;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-dot {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}
