﻿/* ============================================================
   HISTORY360° — Enterprise Heritage Chatbot
   Final Version (White UI + Victorian Accents + Always On Top)
   ============================================================*/

/* ---------------------------------------
   Floating Chat Toggle (Compass Button)
---------------------------------------- */
.chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 64px;
    height: 64px;
    background: radial-gradient(circle at 30% 30%, #111 0%, #000 92%);
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 26px;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 14px 34px rgba(0,0,0,0.55), inset 0 1px 1px rgba(255,255,255,0.18);
    transition: transform .25s ease, background .25s ease;
    z-index: 9998 !important;
}

    .chat-toggle:hover {
        transform: translateY(-2px) scale(1.05);
        background: radial-gradient(circle at 30% 30%, #1b1b1b 0%, #000 96%);
    }

.notification-badge {
    position: absolute;
    top: 7px;
    right: 7px;
    background: #c04b2b;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ---------------------------------------
   Chat Container
---------------------------------------- */
.chat-container {
    position: fixed;
    bottom: 96px;
    right: 20px;
    width: 420px;
    max-width: 100%;
    background: #ffffff !important;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 14px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.35), inset 0 0 30px rgba(0,0,0,0.03);
    opacity: 0;
    display: none;
    animation: fadeInPanel .35s ease-out forwards;
    z-index: 9999 !important;
    overflow: hidden;
}

@keyframes fadeInPanel {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------------------------------------
   Header
---------------------------------------- */
.chat-header {
    background: linear-gradient(#111, #222);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
    border-radius: 14px 14px 0 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.chat-title-group h2 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 1.24rem;
    letter-spacing: 1px;
    margin: 0;
}

.chat-title-group .subtitle {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.75);
    margin-top: 2px;
}

.hide-btn {
    background: none;
    border: none;
    color: #eee;
    font-size: 1.4rem;
    cursor: pointer;
    transition: .2s;
}

    .hide-btn:hover {
        transform: scale(1.15);
        color: #ffccb8;
    }

/* ---------------------------------------
   Output Area
---------------------------------------- */
.chat-output {
    height: 300px;
    padding: 16px;
    background: #ffffff !important;
    overflow-y: auto;
    border-top: 1px solid rgba(0,0,0,0.1);
}

    .chat-output::-webkit-scrollbar {
        width: 8px;
    }

    .chat-output::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,0.25);
        border-radius: 4px;
    }

/* ---------------------------------------
   Messages
---------------------------------------- */
@keyframes msgFade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.bot-response,
.user-message {
    padding: 14px 16px;
    border-radius: 12px;
    margin: 10px 0;
    max-width: 85%;
    animation: msgFade .22s ease-out;
    color: #000 !important;
}

/* USER bubble */
.user-message {
    margin-left: auto;
    background: #f2f2f2 !important;
    border: 1px solid #d6d6d6;
    font-style: italic;
}

/* BOT bubble */
.bot-response {
    background: #ffffff !important;
    border: 1px solid #d8ccb8;
    border-left: 4px solid #c04b2b;
}

/* Typing / Thinking */
.bot-typing,
.typing-text {
    color: #000 !important;
}

/* ---------------------------------------
   Input Section
---------------------------------------- */
.chat-input {
    display: flex;
    gap: 10px;
    padding: 14px;
    background: #fafafa !important;
    border-top: 1px solid rgba(0,0,0,0.1);
}

    .chat-input input {
        flex: 1;
        padding: 12px;
        border-radius: 10px;
        border: 1px solid #b4b4b4;
        font-size: 15px;
        color: #000 !important;
    }

        .chat-input input:focus {
            border-color: #c04b2b;
            box-shadow: 0 0 0 3px rgba(192,75,43,0.2);
        }

    .chat-input button {
        padding: 12px 18px;
        background: linear-gradient(135deg, #c04b2b, #9f3924);
        border: none;
        border-radius: 10px;
        color: #fff;
        font-weight: 600;
        cursor: pointer;
        transition: .18s ease;
    }

        .chat-input button:hover {
            background: linear-gradient(135deg, #e06a4a, #a63f23);
            transform: translateY(-1px);
        }

#sendBtn:disabled {
    background: #ccc;
    color: #666;
}

/* ---------------------------------------
   Footer
---------------------------------------- */
.chat-footer {
    background: #fafafa;
    text-align: center;
    padding: 8px 12px 14px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.chat-note {
    font-size: 0.78rem;
    color: #444;
    margin-bottom: 4px;
}

.heritage-brand {
    font-size: 0.75rem;
    color: #6a594a;
    opacity: 0.85;
    font-style: italic;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.brand-dot {
    width: 8px;
    height: 8px;
    background: #c04b2b;
    border-radius: 50%;
}

/* ============================================================
   📱 MOBILE — FULLSCREEN CHAT (True 100% width/height)
   ============================================================*/
@media (max-width: 700px) {

    .chat-container {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        display: none !important;
        flex-direction: column;
        overflow: hidden !important;
        z-index: 999999 !important;
    }

    /* When chat is opened, this class re-enables flex */
    body.chat-open .chat-container {
        display: flex !important;
    }

    /* Scrollable chat area */
    .chat-output {
        flex: 1 1 auto;
        height: auto !important;
        max-height: none !important;
        padding: 12px !important;
        overflow-y: auto !important;
    }

    /* Full-width messages */
    .user-message,
    .bot-response {
        margin: 8px 6px !important;
        padding: 10px 12px !important;
        font-size: 0.95rem !important;
        max-width: 90% !important;
    }

    /* Input bar sticks to bottom even with keyboard */
    .chat-input {
        flex-shrink: 0;
        padding: 10px !important;
        gap: 6px !important;
        position: sticky !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: #fafafa !important;
        z-index: 999999 !important;
    }

        .chat-input input {
            padding: 10px !important;
            font-size: 1rem !important;
        }

        .chat-input button {
            padding: 10px 14px !important;
            font-size: 1rem !important;
        }

    /* Footer shrinks, always visible */
/*    .chat-footer {
        flex-shrink: 0;
        padding: 6px 8px !important;
        font-size: 0.7rem !important;
    }*/

    /* Hide floating button while chat open */
    body.chat-open .chat-toggle {
        display: none !important;
    }
}
