/* =========================================
   Premium AI Chatbot Styles - Amity Ranchi
   ========================================= */

:root {
    --cb-primary: #002e5e; /* Amity Blue */
    --cb-accent: #ffcb08;  /* Amity Gold */
    --cb-glass: rgba(255, 255, 255, 0.15);
    --cb-glass-dark: rgba(0, 46, 94, 0.85);
    --cb-text-light: #ffffff;
    --cb-text-dark: #333333;
    --cb-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Chat Toggle Button */
.cb-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 0 25px;
    height: 60px;
    background: linear-gradient(135deg, var(--cb-primary), #004080);
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: var(--cb-shadow);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid var(--cb-accent);
}

.cb-toggle:hover {
    transform: scale(1.1) rotate(5deg);
}

.cb-toggle i {
    transition: transform 0.3s ease;
}

.cb-toggle.active i {
    transform: rotate(90deg);
}

.cb-toggle-label {
    font-size: 15px;
    font-weight: 600;
    margin-left: 10px;
    white-space: nowrap;
}

/* Pulse Animation for Toggle */
.cb-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit; /* Matches parent's shape (pill or circle) */
    background: var(--cb-accent);
    opacity: 0;
    z-index: -1;
    animation: cbTogglePulse 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.cb-pulse-2 {
    animation-delay: 1s;
}

@keyframes cbTogglePulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* Chat Window */
.cb-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: var(--cb-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: var(--cb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.cb-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.cb-header {
    background: var(--cb-primary);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    border-radius: 20px 20px 0 0;
    position: relative; /* Added for close button positioning */
    border-bottom: 2px solid var(--cb-accent);
}

.cb-close {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.8;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cb-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.cb-bot-img {
    width: 45px;
    height: 45px;
    background: var(--cb-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    color: var(--cb-primary);
    font-size: 20px;
}

.cb-bot-img img {
    width: 100%;
    height: auto;
}

.cb-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.cb-status {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.cb-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 5px #4caf50;
    animation: cbStatusPulse 2s infinite;
}

@keyframes cbStatusPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Message Area */
.cb-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Scrollbar */
.cb-messages::-webkit-scrollbar {
    width: 5px;
}

.cb-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 46, 94, 0.2);
    border-radius: 10px;
}

/* Message Bubbles */
.cb-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.5;
    animation: cbFadeIn 0.3s ease forwards;
}

.cb-msg.bot {
    background: white;
    color: var(--cb-text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.cb-msg.user {
    background: var(--cb-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

/* Typing Indicator */
.cb-typing {
    display: none;
    align-self: flex-start;
    padding: 10px 15px;
    background: rgba(255,255,255,0.7);
    border-radius: 15px;
    gap: 5px;
}

.cb-typing span {
    width: 6px;
    height: 6px;
    background: var(--cb-primary);
    border-radius: 50%;
    animation: cbTyping 1.4s infinite;
}

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

@keyframes cbTyping {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
}

/* Suggestions */
.cb-suggestions {
    padding: 0 20px 15px;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    scrollbar-width: none;
}

.cb-suggestions::-webkit-scrollbar {
    display: none;
}

.cb-chip {
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--cb-primary);
    color: var(--cb-primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cb-chip:hover {
    background: var(--cb-primary);
    color: white;
    transform: translateY(-2px);
}

/* Input Area */
.cb-input-area {
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    gap: 10px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.cb-input-area input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 5px;
    outline: none;
    font-size: 14px;
}

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

.cb-send-btn:hover {
    background: var(--cb-accent);
    color: var(--cb-primary);
}

/* Markdown Formatting */
.cb-msg.bot ul, .cb-msg.bot ol {
    padding-left: 20px;
    margin: 10px 0;
}

.cb-msg.bot li {
    margin-bottom: 5px;
}

/* Responsive */
@media (max-width: 600px) {
    .cb-window {
        width: 100% !important;
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        border-radius: 0 !important;
        z-index: 10001 !important;
    }
    
    .cb-toggle {
        bottom: 140px !important; /* Higher to clear the sticky 'Apply Now' bar and its sub-text */
        right: 20px !important;
        width: 60px !important;
        height: 60px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        z-index: 10000 !important;
    }

    .cb-toggle-label {
        display: none !important; /* Force hide to prevent JS overrides */
    }
    
    .cb-header {
        border-radius: 0 !important;
    }
}
