/**
 * Chinmayaranyam - Chatbot Widget Styles
 */

/* --- Toggle Button --- */
.chatbot-toggle {
    position: fixed;
    bottom: 5.5rem;
    right: 2rem;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-saffron), var(--color-maroon));
    color: var(--color-cream);
    border: 2px solid var(--color-gold);
    box-shadow: var(--shadow-md), 0 0 15px rgba(230, 126, 34, 0.25);
    z-index: 1045;
    cursor: pointer;
    transition: var(--transition-base);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(201, 162, 39, 0.4);
}

.chatbot-toggle .chatbot-icon-close { display: none; }
.chatbot-toggle.active .chatbot-icon-open { display: none; }
.chatbot-toggle.active .chatbot-icon-close { display: inline; }

/* --- Notification Badge --- */
.chatbot-badge {
    position: fixed;
    bottom: 9.2rem;
    right: 2rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-saffron);
    color: white;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1046;
    font-weight: 600;
    pointer-events: none;
    animation: chatbotBadgePulse 2s ease-in-out infinite;
}

.chatbot-badge.hidden { display: none; }

@keyframes chatbotBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* --- Chat Panel --- */
.chatbot-panel {
    position: fixed;
    bottom: 7.5rem;
    right: 2rem;
    width: 370px;
    max-height: 500px;
    border-radius: 16px;
    background: var(--color-white);
    border: 1px solid rgba(201, 162, 39, 0.3);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 0 20px rgba(201, 162, 39, 0.1);
    z-index: 1045;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s ease;
}

.chatbot-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* --- Panel Header --- */
.chatbot-header {
    background: linear-gradient(135deg, var(--color-maroon), var(--color-maroon-dark));
    color: var(--color-cream);
    padding: 0.9rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--color-gold);
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.chatbot-header-om {
    color: var(--color-gold);
    font-size: 1.5rem;
    line-height: 1;
}

.chatbot-header-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    display: block;
    color: var(--color-cream);
}

.chatbot-header-subtitle {
    font-size: 0.72rem;
    opacity: 0.8;
    display: block;
}

.chatbot-close {
    background: none;
    border: none;
    color: var(--color-cream);
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    padding: 0.25rem;
}

.chatbot-close:hover {
    opacity: 1;
}

/* --- Messages Area --- */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--color-cream);
    min-height: 200px;
    max-height: 340px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(201, 162, 39, 0.3);
    border-radius: 10px;
}

/* --- Bot Message Bubble --- */
.chatbot-msg-bot {
    background: var(--color-white);
    border: 1px solid rgba(201, 162, 39, 0.2);
    border-radius: 2px 12px 12px 12px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.7rem;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--color-black);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    animation: chatMsgAppear 0.4s ease-out forwards;
}

/* --- User Message Bubble --- */
.chatbot-msg-user {
    background: linear-gradient(135deg, var(--color-saffron), var(--color-saffron-dark));
    color: var(--color-white);
    border-radius: 12px 2px 12px 12px;
    padding: 0.55rem 0.9rem;
    margin-bottom: 0.7rem;
    font-size: 0.85rem;
    text-align: right;
    margin-left: auto;
    max-width: 80%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    animation: chatMsgAppear 0.3s ease-out forwards;
}

/* --- Option Buttons --- */
.chatbot-options {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.6rem;
    animation: chatMsgAppear 0.5s ease-out 0.15s both;
}

.chatbot-option-btn {
    background: var(--color-white);
    border: 1.5px solid var(--color-gold);
    color: var(--color-maroon);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.83rem;
    padding: 0.5rem 0.9rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    display: flex;
    align-items: center;
}

.chatbot-option-btn i {
    flex-shrink: 0;
}

.chatbot-option-btn:hover {
    background: var(--color-saffron);
    border-color: var(--color-saffron);
    color: var(--color-white);
    transform: translateX(4px);
    box-shadow: 0 2px 10px rgba(230, 126, 34, 0.3);
}

/* --- Footer --- */
.chatbot-footer {
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(201, 162, 39, 0.15);
    background: var(--color-white);
    text-align: center;
    flex-shrink: 0;
}

.chatbot-restart {
    background: none;
    border: none;
    color: #999;
    font-size: 0.78rem;
    cursor: pointer;
    transition: color 0.2s ease;
    font-family: var(--font-body);
}

.chatbot-restart:hover {
    color: var(--color-saffron);
}

/* --- Animations --- */
@keyframes chatMsgAppear {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Mobile Responsive --- */
@media (max-width: 575.98px) {
    .chatbot-panel {
        width: calc(100vw - 1.5rem);
        right: 0.75rem;
        bottom: 6rem;
        max-height: 65vh;
    }

    .chatbot-toggle {
        bottom: 4.5rem;
        right: 1rem;
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .chatbot-badge {
        bottom: 8rem;
        right: 1rem;
    }

    .chatbot-messages {
        max-height: calc(65vh - 120px);
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .chatbot-panel {
        transition-duration: 0.01ms !important;
    }

    .chatbot-msg-bot,
    .chatbot-msg-user,
    .chatbot-options {
        animation: none !important;
    }

    .chatbot-badge {
        animation: none;
    }
}
