/* CSS Reset & Variable Definitions */
:root {
    --bg-dark: #101010;
    --bg-card: #1e1e1e;
    --bg-input: #2d2d2d;
    --accent: #fdd02e;
    /* Gold */
    --accent-hover: #e0aa00;
    --text-main: #ffffff;
    --text-secondary: #aaaaaa;
    --danger: #ff4d4f;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    --transition-speed: 0.4s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-family);
    height: 100dvh;
    /* Mobile Optimization: dvh */
    overflow: hidden;
    /* Prevent body scroll, handle in components */
    display: flex;
    flex-direction: column;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 194, 2, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 194, 2, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 194, 2, 0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* App Container */
#root {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Typography Utilities */
.text-accent {
    color: var(--accent);
}

.text-dim {
    color: var(--text-secondary);
}

/* Layout Transitions */
.layout-transition {
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

/* Welcome Screen Styling */
.welcome-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.welcome-logo {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: linear-gradient(90deg, #fff, #ccc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

.welcome-logo span {
    color: var(--accent);
    -webkit-text-fill-color: var(--accent);
}

/* Logo Zoom Effect */
.welcome-container img {
    transition: transform 0.3s ease-in;
    cursor: pointer;
}

.welcome-container img:hover {
    transform: scale(1.05);
}

/* Input Area Styling (Shared between states) */
.input-wrapper {
    width: 100%;
    max-width: 800px;
    position: relative;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.input-box {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid #333;
    border-radius: 24px;
    padding: 16px 50px 16px 20px;
    color: #fff;
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.3s;
    resize: none;
    overflow: hidden;
    min-height: 56px;
    max-height: 200px;
}

.input-box:focus {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
}

.send-btn {
    position: absolute;
    right: 12px;
    bottom: 12px;
    /* Aligned to bottom for multiline */
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.3s, transform 0.2s;
    padding: 5px;
}

.send-btn.active {
    color: var(--accent);
}

.send-btn:hover {
    transform: scale(1.1);
}

/* Chat Screen Styling */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.5s ease;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #222;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-logo {
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
    text-decoration: none;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    max-width: 100%;
}

.message-row {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: slideUpFade 0.4s ease-out forwards;
    opacity: 0;
    /* Start hidden for animation */
}

.message-row.user-msg {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-row.bot-msg {
    align-self: flex-start;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.avatar.user {
    background: #333;
    color: #fff;
}

.avatar.bot {
    background: var(--accent);
    color: #000;
}

.bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.5;
    white-space: pre-wrap;
    /* Preserve newlines */
    word-wrap: break-word;
}

.user-msg .bubble {
    background: #333;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bot-msg .bubble {
    background: var(--accent);
    color: #000;
    border-bottom-left-radius: 4px;
}

/* Loading / Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px;
    align-items: center;
}

.dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Bottom Input Area in Chat Mode */
.chat-input-container {
    padding: 20px;
    background: var(--bg-dark);
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Cookie Bar */
.cookie-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-top: 1px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 1000;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    animation: slideUpFade 0.5s ease;
}

.cookie-text {
    font-size: 0.9rem;
    color: #ccc;
}

.cookie-text a {
    color: var(--accent);
    text-decoration: none;
}

.btn-accept {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-accept:hover {
    background: var(--accent-hover);
}

/* Support Button */
.support-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: #000;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    z-index: 900;
    /* Below Cookie bar if expanded */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    text-decoration: none;
}

.support-btn:hover {
    transform: scale(1.1);
    background: #444;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .welcome-logo {
        font-size: 2rem;
    }

    .chat-header {
        padding: 10px 15px;
        /* Reduced padding */
    }

    .cookie-bar {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .support-btn {
        bottom: 80px;
        /* If cookie bar is present */
    }

    body.cookies-accepted .support-btn {
        bottom: 20px;
    }

    .input-box {
        padding: 12px 45px 12px 15px;
        /* Reduced padding */
    }

    .chat-input-container {
        padding: 10px;
        /* Reduced padding */
    }

    .message-row {
        max-width: 90%;
        /* Increased for mobile */
    }
}