/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: var(--z-50);
}

.chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #ffffff; /* Ensure white icon color for visibility */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.chat-button::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.3s ease;
}

.chat-button:hover::before {
    transform: scale(1);
}

.chat-button:hover {
    transform: scale(1.05) rotate(5deg);
    background-color: var(--primary-light);
}

.chat-button.active {
    transform: scale(0.95);
    background-color: var(--primary-dark);
}

.chat-button i {
    font-size: 1.8rem; /* Larger icon for better visibility */
    transition: transform 0.3s ease;
}

.chat-button:hover i {
    transform: scale(1.1);
}

.chat-box {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    width: 350px;
    height: 500px;
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chat-box.chat-box-open {
    opacity: 1;
    transform: translateY(0);
}

.chat-header {
    background-color: var(--primary);
    color: var(--white);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chat-header span {
    display: flex;
    align-items: center;
    font-weight: 600;
}

.chat-header i {
    margin-right: 0.5rem;
}

.close-chat {
    background: none;
    border: none;
    color: var(--white);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-chat:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.chat-body {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
    background-color: #ffffff; /* White background for maximum contrast */
}

.message {
    max-width: 85%;
    padding: 0.85rem 1.1rem;
    border-radius: 1rem;
    line-height: 1.5;
    position: relative;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
    font-size: 1rem; /* Increased font size for better readability */
    font-weight: 400;
}

.message.show {
    opacity: 1;
    transform: translateY(0);
}

.message-content {
    margin-bottom: 0.3rem;
}

.message-timestamp {
    font-size: 0.8rem; /* Slightly larger timestamp */
    opacity: 0.75;
    margin-top: 0.3rem;
    text-align: right; /* Align timestamp to right for better flow */
}

.bot-message {
    background-color: #f0f0f0; /* Light gray background */
    color: #000000; /* Black text for high contrast */
    align-self: flex-start;
    border-top-left-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.user-message {
    background-color: var(--primary);
    color: #ffffff; /* Ensure white text on primary background */
    align-self: flex-end;
    border-top-right-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Typing indicator */
.typing-indicator {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.3rem; /* Slightly larger gap */
}

.typing-indicator span {
    width: 9px; /* Larger dots */
    height: 9px;
    background-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); } /* Smoother bounce */
}

.chat-footer {
    padding: 1.2rem; /* More padding for better touch targets */
    background-color: var(--white);
    border-top: 1px solid var(--light-2);
}

.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: var(--light-1);
    border-radius: var(--radius-full);
    padding: 0.6rem; /* Slightly more padding */
    transition: all 0.3s ease;
}

.input-group:focus-within {
    background: var(--white);
    box-shadow: 0 0 0 2px var(--primary);
}

.chat-input {
    flex: 1;
    padding: 0.6rem 1.1rem; /* Better padding */
    border: none;
    background: transparent;
    outline: none;
    font-size: 1rem; /* Larger input text */
}

.send-button {
    background: var(--primary);
    color: var(--white);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-button:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}

.send-button:active {
    transform: scale(0.95);
}

/* Mobile responsive styles */
@media (max-width: 576px) {
    .chat-box {
        width: calc(100% - 2rem);
        height: calc(100vh - 8rem);
        right: 1rem;
        bottom: 5rem;
    }
    
    .chat-widget {
        right: 1rem;
        bottom: 1rem;
    }
    
    .message {
        max-width: 90%;
        font-size: 1.05rem; /* Larger text on mobile */
    }

    .chat-input {
        font-size: 1.05rem;
    }
}

/* Scrollbar styling */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-full);
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

/* Scrollbar Styling */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: var(--light-1);
}

.chat-body::-webkit-scrollbar-thumb {
    background-color: var(--medium-1);
    border-radius: var(--radius-full);
}

/* Mobile Responsive Styles */
@media (max-width: 576px) {
    .chat-box {
        width: calc(100% - 2rem);
        height: calc(100vh - 8rem);
        right: 1rem;
        bottom: 5rem;
    }
    
    .chat-widget {
        right: 1rem;
        bottom: 1rem;
    }
}
