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

:root {
    --primary: #7B68EE;        /* Purple from logo */
    --primary-dark: #5B48CE;
    --secondary: #4A90E2;      /* Blue from logo */
    --background: #0a0b1e;
    --surface: #151729;
    --surface-light: #1f2137;
    --text-primary: #ffffff;
    --text-secondary: #a0a8c9;
    --border: #2d3150;
    --user-bg: linear-gradient(135deg, #7B68EE, #4A90E2);
    --assistant-bg: #1f2137;
    --accent-purple: #9D7FEA;
    --accent-blue: #5EA3E8;
}

/* Light mode variables */
:root.light-mode {
    --primary: #5B48CE;
    --primary-dark: #4A38BE;
    --secondary: #3A80D2;
    --background: #f5f5f5;
    --surface: #ffffff;
    --surface-light: #f0f0f0;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border: #e0e0e0;
    --user-bg: linear-gradient(135deg, #7B68EE, #4A90E2);
    --assistant-bg: #f8f8f8;
    --accent-purple: #9D7FEA;
    --accent-blue: #5EA3E8;
}

/* Theme toggle button */
.theme-toggle {
    padding: 0.5rem 0.75rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    margin-left: 1rem;
}

.theme-toggle:hover {
    background: var(--surface);
    border-color: var(--primary);
    transform: scale(1.1);
}

/* Light mode specific adjustments */
.light-mode .assistant-message .message-avatar {
    background: var(--surface-light);
    color: var(--primary);
    border: 2px solid var(--border);
}

.light-mode .assistant-message .message-content {
    background: var(--assistant-bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.light-mode .message-content code {
    background: rgba(123, 104, 238, 0.1);
    color: var(--primary-dark);
}

.light-mode .message-content pre {
    background: rgba(123, 104, 238, 0.05);
    border: 1px solid var(--border);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

/* Controls group */
.controls-group {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Temperature control */
.temperature-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-light);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.temperature-control label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.temp-icon {
    font-size: 1rem;
}

#temperature {
    width: 100px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

#temperature::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#temperature::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#tempValue {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 30px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .controls-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .temperature-control {
        order: 3;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    #temperature {
        flex: 1;
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2rem;
}

.logo-image {
    height: 50px;
    width: auto;
    display: block;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.model-selector select {
    padding: 0.5rem 1rem;
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.chat-messages {
    max-width: 900px;
    margin: 0 auto;
}

/* Welcome Screen */
.welcome-screen {
    text-align: center;
    padding: 4rem 2rem;
}

.welcome-screen h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.welcome-screen p {
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

.quick-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.prompt-btn {
    padding: 1rem 1.5rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    text-align: left;
}

.prompt-btn:hover {
    background: var(--surface);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Messages */
.message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #7B68EE, #4A90E2);
}

.assistant-message .message-avatar {
    background: var(--assistant-bg);
}

.message-content {
    flex: 1;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    line-height: 1.6;
}

.user-message .message-content {
    background: var(--user-bg);
}

.assistant-message .message-content {
    background: var(--assistant-bg);
}

.message-content p {
    margin-bottom: 0.75rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.message-content pre code {
    background: none;
    padding: 0;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* Input Container */
.input-container {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem 2rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    align-items: flex-end;
}

.control-btn {
    padding: 0.75rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.control-btn:hover {
    background: var(--surface);
    border-color: var(--primary);
}

#userInput {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    line-height: 1.5;
}

#userInput:focus {
    outline: none;
    border-color: var(--primary);
}

.send-btn {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #7B68EE, #4A90E2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.send-btn:hover {
    background: linear-gradient(135deg, #6B58DE, #3A80D2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(123, 104, 238, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 2rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Scrollbar */
.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: var(--surface);
}

.chat-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
/* Mobile Responsive Fixes */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }
    
    .logo h1 {
        font-size: 1.2rem;
    }
    
    .logo-image {
        height: 35px;
    }
    
    .model-selector {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .model-selector select {
        width: 100%;
    }
    
    .chat-container {
        padding: 1rem;
        height: calc(100vh - 200px);
    }
    
    .welcome-screen {
        padding: 2rem 1rem;
    }
    
    .welcome-screen h2 {
        font-size: 1.5rem;
    }
    
    .quick-prompts {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .input-container {
        padding: 1rem;
        gap: 0.5rem;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        z-index: 100;
    }
    
    .control-btn {
        padding: 0.6rem;
        font-size: 1rem;
    }
    
    #userInput {
        padding: 0.6rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .send-btn {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .status-bar {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
        position: fixed;
        bottom: 70px;
        left: 0;
        right: 0;
        z-index: 99;
    }
    
    .message-content {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .container {
        height: 100vh;
        height: -webkit-fill-available;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .send-btn {
        padding: 0.6rem 1rem;
    }
    
    .logo h1 {
        font-size: 1rem;
    }
}

/* ========================================
   NEW: User Engagement Enhancements
   ======================================== */

/* 1. Animated Welcome Screen */
.welcome-screen {
    animation: fadeInUp 0.8s ease-out;
}

.welcome-screen h2 {
    animation: fadeIn 1s ease-out 0.2s both;
}

.welcome-screen p {
    animation: fadeIn 1s ease-out 0.4s both;
}

.welcome-screen .quick-prompts {
    animation: fadeIn 1s ease-out 0.6s both;
}

.logo-image {
    animation: logoPulse 2s ease-in-out infinite;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* 2. Typing Animation Container */
.typing-text {
    display: inline;
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--primary);
    margin-left: 2px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

/* 3. Confetti Container */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary);
    animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* 4. Message Reactions */
.message-reactions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.reaction-btn {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.reaction-btn:hover {
    background: var(--surface-light);
    transform: scale(1.1);
}

.reaction-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

.reaction-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* 5. Sound Toggle Button */
.sound-toggle {
    padding: 0.5rem 0.75rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.sound-toggle:hover {
    background: var(--surface);
    border-color: var(--primary);
}

.sound-toggle.muted {
    opacity: 0.5;
}

/* Copy button styling */
.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0;
    transition: all 0.2s;
}

.message-content {
    position: relative;
}

.message-content:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Light mode adjustments */
.light-mode .reaction-btn {
    background: white;
}

.light-mode .reaction-btn:hover {
    background: var(--surface-light);
}

/* ========================================
   Message Reactions
   ======================================== */

.message-reactions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.reaction-btn {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.reaction-btn:hover {
    background: var(--surface-light);
    transform: scale(1.1);
}

.reaction-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

.reaction-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.light-mode .reaction-btn {
    background: white;
}

.light-mode .reaction-btn:hover {
    background: var(--surface-light);
}