* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    overflow: hidden;
}

.message-content a {
    color: #FBAC18;
    text-decoration: none;
    font-weight: 500;
}
.message-content a:hover {
    text-decoration: underline;
}

.message-content img.embedded-image,
.message-content video.embedded-video {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 12px;
    margin-top: 10px;
    display: block;
}

.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    z-index: -2;
}

.glass-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(20px);
    background: rgba(10, 10, 10, 0.8);
    z-index: -1;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

@font-face {
    font-family: "Papyrus";
    src: url("papyrus.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

.logo {
    font-family: 'Papyrus', cursive;
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(45deg, #ff006e, #8338ec, #3a86ff, #06ffa5);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 4s ease infinite;
    margin-bottom: 10px;
}

.tagline {
    color: #888;
    font-size: 1rem;
    font-weight: 400;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(20, 20, 20, 0.4);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.chat-messages {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.message {
    margin-bottom: 25px;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.message.user {
    text-align: right;
}

.message.ai {
    text-align: left;
}

.message-content {
    display: inline-block;
    max-width: 80%;
    padding: 15px 20px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.ai .message-content {
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    position: relative;
    overflow: hidden;
}

.ai .message-content.generating::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.message-time {
    font-size: 0.75rem;
    color: #666;
    margin-top: 5px;
}

.input-container {
    padding: 25px 30px;
    background: rgba(30, 30, 30, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* Chat Navbar above input */
.chat-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: rgba(50, 50, 50, 0.5);
    border-radius: 20px 20px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

/* Make mode toggle smaller for navbar */
.chat-navbar .mode-toggle {
    position: static;
    gap: 8px;
}

/* Relocate Clear Chat button */
.chat-navbar .clear-btn {
    position: static;
    background: rgba(40, 40, 40, 0.8);
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    transition: background 0.3s ease, color 0.3s ease;
}
.chat-navbar .clear-btn:hover {
    background: rgba(60, 60, 60, 0.9);
    color: white;
}

.input-wrapper {
    display: flex;
    gap: 15px;
    align-items: center;
    background: rgba(50, 50, 50, 0.5);
    border-radius: 0 0 25px 25px;
    border-top: none;
    padding: 15px 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.1);
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    outline: none;
}

#messageInput::placeholder {
    color: #888;
}

.action-btn {
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.send-btn {
    background: linear-gradient(135deg, #ff006e, #8338ec);
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(255, 0, 110, 0.4);
}

.stop-btn {
    background: linear-gradient(135deg, #ff4757, #ff3742);
}

.stop-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(255, 71, 87, 0.4);
}

.action-btn:active {
    transform: scale(0.95);
}

.typing-indicator {
    display: none;
    margin-bottom: 10px;
    margin-left: 10px;
    text-align: left;
}

.typing-indicator .message-content {
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #888;
    animation: typing 1.4s infinite;
}

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

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

.clear-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    background: rgba(40, 40, 40, 0.8);
    color: #888;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: rgba(60, 60, 60, 0.8);
    color: white;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .logo {
        font-size: 2rem;
    }

    .message-content {
        max-width: 90%;
    }

    .input-container {
        padding: 20px;
    }
}
/* === Toggle Switch Cool Animation === */
.mode-toggle {
    position: absolute;
    top: 20px;
    left: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
}

.toggle-label {
    font-size: 0.85rem;
    color: white;
    font-weight: bold;
}

.toggle-wrapper {
    position: relative;
    width: 70px;
    height: 34px;
    background: linear-gradient(90deg, #28397F, #5068C1);
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.5s ease-in-out, box-shadow 0.3s ease-in-out;
    box-shadow: none; /* no glow by default */
}

.toggle-wrapper:hover {
    box-shadow: 0 0 12px rgba(58, 134, 255, 0.8); /* glow on hover */
}

.toggle-ball {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), box-shadow 0.3s ease-in-out;
    box-shadow: none; /* no glow by default */
}

.toggle-wrapper:hover .toggle-ball {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.6); /* ball glow on hover */
}

/* T-mode colors */
.t-mode .toggle-wrapper {
    background: linear-gradient(90deg, #FBAC18, #F2730C);
    box-shadow: none; /* no glow by default */
}

.t-mode .toggle-wrapper:hover {
    box-shadow: 0 0 12px rgba(251, 172, 24, 0.7); /* glow on hover */
}

/* Slide animation */
.t-mode .toggle-ball {
    transform: translateX(36px) rotate(360deg);
    box-shadow: none; /* no glow by default */
}

.t-mode .toggle-wrapper:hover .toggle-ball {
    box-shadow: 0 0 15px rgba(251, 172, 24, 0.9); /* ball glow on hover */
}