@import url('https://fonts.googleapis.com/css2?family=Manjari:wght@400;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* style.css - Ultra-Premium GenZ Aesthetic */
:root {
    /* Vibrant GenZ Palette */
    --accent-1: #FF3366;
    --accent-2: #FF7733;
    --accent-3: #8B33FF;
    --accent-4: #33CCFF;

    /* Glassmorphism Variables */
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);

    --text-main: #1a1a2e;
    --text-muted: #4a4e69;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Manjari', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    /* Mesmerizing Animated Gradient Background */
    background: linear-gradient(-45deg, #FFB7B2, #E284FF, #9DDEFA, #FFD1A9);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    font-family: var(--font-body);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ---------- MAIN CHAT CONTAINER ---------- */
.chat-container {
    width: 100%;
    max-width: 420px;
    height: 92vh;
    height: 92dvh;

    /* Glassmorphism Core */
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 36px;
    box-shadow: var(--glass-shadow);

    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

@media (max-width: 480px) {
    .chat-container {
        height: 100dvh;
        border-radius: 0;
        border: none;
        max-width: 100%;
    }
}

/* ---------- HEADER ---------- */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 10;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bot-avatar {
    width: 50px;
    height: 50px;
    border-radius: 18px;
    /* Squircle look */
    background: linear-gradient(135deg, var(--accent-3), var(--accent-4));
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.8rem;
    position: relative;
    box-shadow: 0 8px 16px rgba(139, 51, 255, 0.3);
}

.status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background-color: #00E676;
    border-radius: 50%;
    border: 3px solid white;
}

.bot-details h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0.1rem;
    background: linear-gradient(to right, #1a1a2e, #4a4e69);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.bot-details p {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.menu-btn {
    background: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    font-size: 1.25rem;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.menu-btn:hover {
    transform: rotate(15deg) scale(1.05);
}

/* ---------- CHAT BOX ---------- */
.chat-box {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    scroll-behavior: smooth;
}

.chat-box::-webkit-scrollbar {
    width: 4px;
}

.chat-box::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.message {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    max-width: 88%;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message .avatar {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.bot-message .avatar {
    background: linear-gradient(135deg, var(--accent-3), var(--accent-4));
    color: white;
}

.user-message .avatar {
    display: none;
}

.bubble {
    padding: 1rem 1.25rem;
    border-radius: 20px;
    font-size: 1rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.bot-message .bubble {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.user-message .bubble {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 20px rgba(255, 51, 102, 0.25);
}

/* ---------- INPUT AREA ---------- */
.chat-input-area {
    padding: 1rem 1.5rem 1.5rem;
    background: transparent;
    z-index: 10;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 28px;
    padding: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    box-shadow: 0 10px 30px rgba(139, 51, 255, 0.15);
    background: white;
}

textarea {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
    resize: none;
    outline: none;
    max-height: 120px;
    height: 44px;
    line-height: 1.4;
}

textarea::placeholder {
    color: #a0aec0;
    font-weight: 500;
}

.send-btn {
    background: linear-gradient(135deg, var(--accent-3), var(--accent-4));
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.1) rotate(-10deg);
    box-shadow: 0 8px 20px rgba(139, 51, 255, 0.3);
}

.send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* ---------- TYPING INDICATOR ---------- */
.typing-indicator .bubble {
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
}

.dots {
    display: flex;
    gap: 5px;
}

.dots span {
    width: 8px;
    height: 8px;
    background-color: var(--accent-3);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* ---------- MARKDOWN FORMATTING ---------- */
.bot-message .bubble p {
    margin-bottom: 0.75rem;
}

.bot-message .bubble p:last-child {
    margin-bottom: 0;
}

.bot-message .bubble strong {
    color: var(--accent-3);
    font-family: var(--font-heading);
    font-weight: 700;
}

.bot-message .bubble ul,
.bot-message .bubble ol {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
}

.bot-message .bubble li {
    margin-bottom: 0.4rem;
    padding-left: 0.25rem;
}

/* ---------- ONBOARDING / LOGIN OVERLAY ---------- */
.onboarding-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1.5rem;
}

.onboarding-card {
    background: rgba(255, 255, 255, 0.9);
    width: 100%;
    max-width: 360px;
    border-radius: 32px;
    padding: 3rem 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.bot-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    font-size: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 15px 30px rgba(255, 51, 102, 0.3);
}

.onboarding-header h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(to right, #1a1a2e, #4a4e69);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.onboarding-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 2.5rem;
}

.input-group {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 18px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.input-group:focus-within {
    border-color: var(--accent-3);
    box-shadow: 0 0 0 4px rgba(139, 51, 255, 0.1);
}

.input-group i {
    font-size: 1.25rem;
    color: var(--accent-3);
    margin-right: 0.75rem;
}

.input-group input {
    border: none;
    background: transparent;
    flex: 1;
    font-size: 1.05rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-main);
    outline: none;
    width: 100%;
}

.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-3), var(--accent-4));
    color: white;
    border: none;
    padding: 1.15rem;
    border-radius: 18px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-heading);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(139, 51, 255, 0.2);
    margin-top: 1.5rem;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(139, 51, 255, 0.3);
}

.primary-btn:active {
    transform: translateY(0);
}

.error-msg {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    font-weight: 600;
    min-height: 1.2rem;
}

.onboarding-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 10;
    border-radius: 32px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(139, 51, 255, 0.2);
    border-top-color: var(--accent-3);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}