/* ==========================================================================
   APSDMA Reservoir Chatbot Widget — Dark Theme
   Matches reservoir-theme.css variables
   ========================================================================== */

/* Floating Action Button */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--water, #1565c0) 0%, var(--water-light, #42a5f5) 100%);
    border: 2px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.5em;
    cursor: pointer;
    z-index: 9990;
    box-shadow: 0 4px 20px rgba(21, 101, 192, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(21, 101, 192, 0.6);
}
.chat-fab.active {
    background: rgba(255,255,255,0.15);
    border-color: var(--water-light, #42a5f5);
}

/* Chat Panel */
.chat-panel {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 370px;
    height: 530px;
    background: rgba(9, 21, 32, 0.97);
    border: 1px solid rgba(66, 165, 245, 0.25);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 9991;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.chat-panel.open {
    display: flex;
    animation: chatSlideUp 0.25s ease-out;
}
@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.chat-header {
    padding: 14px 16px;
    background: linear-gradient(90deg,
        rgba(13, 71, 161, 0.95) 0%,
        rgba(0, 60, 100, 0.95) 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-header-icon {
    font-size: 1.3em;
}
.chat-header-title {
    font-size: 0.92em;
    font-weight: 600;
    color: #fff;
}
.chat-header-subtitle {
    font-size: 0.65em;
    color: rgba(255,255,255,0.55);
    margin-top: 1px;
}
.chat-header-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #69f0ae;
    display: inline-block;
    margin-right: 4px;
    animation: chatPulse 2s infinite;
}
@keyframes chatPulse {
    0%,100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.chat-close-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.4em;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: all 0.2s;
}
.chat-close-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* Message Bubbles */
.chat-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.8em;
    line-height: 1.55;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.chat-msg.user {
    align-self: flex-end;
    background: rgba(33, 150, 243, 0.22);
    border: 1px solid rgba(33, 150, 243, 0.3);
    color: #e0e0e0;
    border-bottom-right-radius: 4px;
}
.chat-msg.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: #c8c8c8;
    border-bottom-left-radius: 4px;
}
.chat-msg.bot strong,
.chat-msg.bot b {
    color: var(--water-light, #42a5f5);
    font-weight: 600;
}

/* Typing Indicator */
.chat-typing {
    align-self: flex-start;
    display: none;
    padding: 10px 16px;
    background: rgba(255,255,255,0.04);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    gap: 5px;
    margin-bottom: 4px;
}
.chat-typing.active {
    display: flex;
}
.chat-typing span {
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,0.35);
    border-radius: 50%;
    animation: typingDot 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* Suggestion Buttons */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 12px 8px;
    flex-shrink: 0;
    max-height: 80px;
    overflow-y: auto;
}
.chat-suggest-btn {
    padding: 5px 12px;
    border: 1px solid rgba(66, 165, 245, 0.25);
    border-radius: 16px;
    background: rgba(66, 165, 245, 0.07);
    color: var(--water-light, #42a5f5);
    font-size: 0.7em;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.chat-suggest-btn:hover {
    background: rgba(66, 165, 245, 0.2);
    border-color: var(--water-light, #42a5f5);
}

/* Input Area */
.chat-input-area {
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,0.07);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    background: rgba(0,0,0,0.2);
}
.chat-input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 8px 16px;
    color: #fff;
    font-size: 0.82em;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.chat-input:focus {
    border-color: rgba(66, 165, 245, 0.4);
}
.chat-input::placeholder {
    color: rgba(255,255,255,0.28);
}
.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--water, #1565c0);
    border: none;
    color: #fff;
    font-size: 1.1em;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-send-btn:hover {
    background: var(--water-light, #42a5f5);
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .chat-panel {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        right: 10px;
        bottom: 80px;
        border-radius: 12px;
    }
    .chat-fab {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 1.3em;
    }
}
