/* Elegant Wedding Chatbot Styles */
@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@300;400;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&display=swap');

:root {
    --chat-primary-color: #4A5C4D; /* Deep Forest Green */
    --chat-secondary-color: #D4AF37; /* Gold Accent */
    --chat-bg-color: #FDFDFD; /* Off-white */
    --chat-user-msg-bg: #E3F2FD; /* Light Blue */
    --chat-bot-msg-bg: #F1F8E9; /* Light Green */
    --chat-text-color: #333;
    --chat-font: 'Assistant', sans-serif;
}

#chat-bubble-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: linear-gradient(45deg, var(--chat-primary-color), #6a8270);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

#chat-bubble-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    animation-play-state: paused;
}

#chat-widget {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 370px;
    height: 550px;
    /* --- New Background Image --- */
    background-image: url('https://www.toptal.com/designers/subtlepatterns/uploads/double-bubble-outline.png');
    background-size: cover;
    background-position: center;
    border: 1px solid #e0e0e0;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: none; /* Initially hidden */
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#chat-widget.open {
    display: flex;
    transform: scale(1);
    opacity: 1;
}

#chat-header {
    padding: 15px 20px;
    background: var(--chat-primary-color);
    color: white;
    font-weight: 600;
    font-size: 1.1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--chat-secondary-color);
}

#close-chat-btn {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    transition: transform 0.2s;
}

#close-chat-btn:hover {
    transform: rotate(90deg);
}

#chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    /* --- Translucent background to see the image behind --- */
    background-color: rgba(253, 253, 253, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-bubble {
    min-width: 50px; /* Prevent bubble from getting too narrow */
    padding: 10px 15px;
    border-radius: 20px;

    line-height: 1.5;
    word-wrap: break-word;
    font-family: 'Noto Color Emoji', var(--chat-font);
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.4s forwards;
}

.chat-message {
    display: flex;
    align-items: flex-start; /* Top-aligns avatar with content */
    gap: 10px;
    max-width: 100%;
}

.message-content {
    display: flex;
    flex-direction: column;
    max-width: 75%; /* Prevent overlapping the opposite avatar */
}

/* --- New Avatar Styles --- */
.chat-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

/* Bot messages stay on the left (default) */
.chat-message.bot .message-content {
    align-items: flex-start;
}

.chat-message.bot .message-bubble {
    background: linear-gradient(135deg, #E9F5E3, #D8F0CE);
    color: var(--chat-text-color);
    border-bottom-left-radius: 5px;
}

/* User messages go to the right */
.chat-message.user {
    justify-content: flex-end; /* Pushes the content to the right */
}

.chat-message.user .message-content {
    align-items: flex-end; /* Aligns bubble to the right of its container */
}

.chat-message.user .chat-avatar {
    order: 1; /* Visually moves the avatar to the right */
}

.chat-message.user .message-bubble {
    /* --- New Gradient Background --- */
    background: linear-gradient(135deg, var(--chat-primary-color), #6a8270);
    color: #fff;
    border-bottom-right-radius: 5px;
}

.message-bubble a {
    color: inherit; /* Inherit color from parent (white for user, dark for bot) */
    text-decoration: underline;
}

#chat-input-container {
    display: flex;
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

#chat-input {
    flex-grow: 1;
    padding: 12px 18px;
    border: 1px solid #ccc;
    border-radius: 25px;
    margin-right: 10px;
    font-family: var(--chat-font);
    font-size: 1em;
    transition: border-color 0.2s, height 0.2s ease;
    resize: none; /* Disable manual resizing by user */
    overflow-y: auto; /* Show scrollbar only when needed */
    line-height: 1.4;
    max-height: 100px; /* Limit growth to about 5 lines */
}

#chat-input:focus {
    outline: none;
    border-color: var(--chat-primary-color);
}

#chat-send-btn {
    width: 50px;
    height: 50px;
    background-color: var(--chat-primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
}

#chat-send-btn:hover {
    background-color: #6a8270;
}

.typing-indicator {
    /* This is now a container, styled like a message */
    display: none; 
    align-items: flex-start;
    gap: 10px;
    padding: 0 20px; /* Match chat-messages padding */
    opacity: 0;
    animation: fadeIn 0.4s forwards;
}

.typing-bubble {
    /* Removed background for a cleaner, floating-dots look */
    background: transparent;
    padding: 10px 15px;
    display: flex;
    align-items: center;
}

.typing-bubble span {
    height: 9px;
    width: 9px;
    background-color: #aaa;
    border-radius: 50%;
    display: inline-block;
    margin: 0 3px;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

/* Animations */
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Action Buttons for Calendar/WhatsApp */
.chat-action-buttons {
    display: flex;
    gap: 10px; /* Adds space between buttons */
    margin-top: 10px;
    width: 100%; /* Ensures the container takes up the full available width */
}

.chat-action-btn {
    flex: 1; /* Makes buttons share space equally */
    display: inline-block;
    padding: 8px 15px;
    border-radius: 20px;
    background-color: var(--chat-primary-color);
    color: white;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 600;
    transition: transform 0.2s ease, background-color 0.2s ease;
    border: 1px solid transparent;
}

.chat-action-btn:hover {
    transform: translateY(-2px);
    background-color: #6a8270; /* Slightly lighter green on hover */
}

/* This rule is no longer needed as the default flex behavior is correct */


/* Responsive Design */
@media (max-width: 480px) {
    #chat-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        border: none;
    }

    #chat-bubble-btn {
        width: 55px;
        height: 55px;
        font-size: 24px;
        bottom: 15px;
        right: 15px;
    }
}
