/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark Theme (Default) */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3d3d3d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #888888;
    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-hover: #4f46e5;
    --border-color: #404040;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 8px;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-hover: #4f46e5;
    --border-color: #cbd5e1;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

[data-theme="neon"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #00ff88;
    --text-secondary: #00cc6a;
    --text-muted: #00994d;
    --accent-primary: #00ff88;
    --accent-secondary: #00cc6a;
    --accent-hover: #00b36b;
    --border-color: #00ff88;
    --shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Auth Pages */
.auth-page {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--border-color);
}

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

.auth-header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-primary);
    margin-bottom: 15px;
}

.auth-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: 500;
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-full {
    width: 100%;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

.alert {
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.forgot-password {
    color: var(--accent-primary);
    text-decoration: none;
}

.forgot-password:hover {
    text-decoration: underline;
}

.terms {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

.terms a {
    color: var(--accent-primary);
    text-decoration: none;
}

.terms a:hover {
    text-decoration: underline;
}

.auth-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 14px;
}

/* Main App Layout */
.app-container {
    display: flex;
    height: 100vh;
    background: var(--bg-primary);
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
    color: var(--accent-primary);
}

.close-sidebar {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-sidebar:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.new-chat-btn {
    width: 100%;
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.new-chat-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.recent-stories,
.advanced-settings {
    margin-bottom: 30px;
}

.recent-stories h3,
.advanced-settings h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.stories-list {
    max-height: 300px;
    overflow-y: auto;
}

.story-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.story-item:hover {
    background: var(--bg-tertiary);
}

.story-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.story-info i {
    color: var(--text-muted);
}

.story-title {
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-actions {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.story-item:hover .story-actions {
    opacity: 1;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.no-stories {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 20px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.setting-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

.narrative-techniques h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.support-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 30px;
}

.support-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.support-btn:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: none;
}

.menu-toggle:hover {
    background: var(--bg-tertiary);
}

.current-story h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* AI Agent Selector */
.ai-agent-selector {
    position: relative;
}

.selected-agent {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
}

.selected-agent:hover {
    border-color: var(--accent-primary);
}

.selected-agent img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.selected-agent span {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.agents-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.agents-dropdown.show {
    display: block;
}

.agent-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border-color);
}

.agent-option:last-child {
    border-bottom: none;
}

.agent-option:hover {
    background: var(--bg-secondary);
}

.agent-option img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.agent-option span {
    flex: 1;
    font-size: 14px;
}

.agent-option i {
    color: var(--accent-primary);
}

.add-agent-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    cursor: pointer;
    color: var(--accent-primary);
    font-weight: 500;
    transition: all 0.3s ease;
    border-top: 1px solid var(--border-color);
}

.add-agent-btn:hover {
    background: var(--bg-secondary);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.user-avatar:hover {
    border-color: var(--accent-primary);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 200px;
    z-index: 1000;
    display: none;
}

.user-dropdown.show {
    display: block;
}

.user-info {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.user-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.user-email {
    font-size: 14px;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-item.logout {
    color: var(--error-color);
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-primary);
}

.welcome-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.welcome-content h1 {
    font-size: 32px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.welcome-content p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 600px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    max-width: 800px;
}

.suggestion {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.suggestion:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.suggestion i {
    font-size: 24px;
    color: var(--accent-primary);
    margin-bottom: 12px;
    display: block;
}

.suggestion span {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Messages */
.messages {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.message {
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease;
}

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

.user-message {
    display: flex;
    justify-content: flex-end;
}

.ai-message {
    display: flex;
    gap: 12px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    max-width: 85%;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px;
    position: relative;
    border: 1px solid var(--border-color);
}

.user-message .message-content {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.message-header {
    margin-bottom: 8px;
}

.message-sender {
    font-weight: 600;
    font-size: 14px;
    color: var(--accent-primary);
}

.user-message .message-sender {
    color: rgba(255, 255, 255, 0.9);
}

.message-text {
    line-height: 1.6;
    white-space: pre-wrap;
}

.formatted-content h1,
.formatted-content h2,
.formatted-content h3 {
    margin: 16px 0 8px 0;
    color: var(--text-primary);
}

.formatted-content h1 {
    font-size: 24px;
    border-bottom: 2px solid var(--accent-primary);
    padding-bottom: 8px;
}

.formatted-content h2 {
    font-size: 20px;
}

.formatted-content h3 {
    font-size: 18px;
}

.formatted-content p {
    margin-bottom: 12px;
}

.formatted-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

.formatted-content em {
    font-style: italic;
}

.formatted-content ul,
.formatted-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.formatted-content li {
    margin-bottom: 4px;
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.message-content:hover .message-actions {
    opacity: 1;
}

.message-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: right;
}

.ai-message .message-time {
    text-align: left;
    margin-left: 44px;
}

/* Input Area */
.input-area {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 20px 24px;
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    max-width: 800px;
    margin: 0 auto;
}

.word-count-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0 12px;
    height: 48px;
    min-width: 140px;
}

#wordCount {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 60px;
    text-align: right;
}

#wordCount:focus {
    outline: none;
}

.word-count-label {
    font-size: 14px;
    color: var(--text-muted);
}

.text-input-container {
    flex: 1;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    transition: all 0.3s ease;
}

.text-input-container:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    resize: none;
    max-height: 120px;
    min-height: 24px;
    line-height: 1.5;
}

#messageInput:focus {
    outline: none;
}

#messageInput::placeholder {
    color: var(--text-muted);
}

.send-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.input-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 12px auto 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.option-group {
    display: flex;
    gap: 20px;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

.option-checkmark {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.option-label input[type="checkbox"]:checked + .option-checkmark {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.option-label input[type="checkbox"]:checked + .option-checkmark::after {
    content: '✓';
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.streaming-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
}

.streaming-controls select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    color: var(--text-primary);
    font-size: 14px;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-modal:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

.avatar-selection {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-selection img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

#generateAvatar,
#generateProfileAvatar {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#generateAvatar:hover,
#generateProfileAvatar:hover {
    background: var(--bg-secondary);
}

.api-key-container p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.api-key-input {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.api-key-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
}

.api-key-info {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.api-key-info i {
    color: var(--accent-primary);
    margin-right: 8px;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.theme-option {
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 16px;
    border-radius: var(--radius);
    border: 2px solid transparent;
}

.theme-option:hover {
    background: var(--bg-tertiary);
}

.theme-option.active {
    border-color: var(--accent-primary);
}

.theme-preview {
    width: 80px;
    height: 60px;
    border-radius: 8px;
    margin: 0 auto 8px;
    border: 2px solid var(--border-color);
}

.dark-theme {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.light-theme {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.neon-theme {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    border-color: #00ff88 !important;
}

/* Notification Popup */
.notification-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 350px;
    z-index: 3000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification-popup.show {
    transform: translateX(0);
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.notification-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-notification {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-notification:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.notification-body {
    padding: 20px;
    color: var(--text-primary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    font-size: 16px;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .menu-toggle {
        display: block;
    }
    
    .header-right {
        gap: 12px;
    }
    
    .selected-agent {
        min-width: auto;
        padding: 8px;
    }
    
    .selected-agent span {
        display: none;
    }
    
    .auth-container {
        padding: 30px 20px;
    }
    
    .suggestions {
        grid-template-columns: 1fr;
    }
    
    .input-container {
        flex-direction: column;
        gap: 12px;
    }
    
    .word-count-container {
        width: 100%;
        justify-content: space-between;
    }
    
    .input-options {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .option-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .theme-options {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .notification-popup {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
    }
}

@media (max-width: 480px) {
    .chat-container {
        padding: 16px;
    }
    
    .input-area {
        padding: 16px;
    }
    
    .message-content {
        max-width: 95%;
    }
    
    .welcome-content h1 {
        font-size: 24px;
    }
    
    .welcome-content p {
        font-size: 16px;
    }
}

/* Print Styles for Export */
@media print {
    .sidebar,
    .header,
    .input-area,
    .message-actions {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
    
    .chat-container {
        padding: 0;
        overflow: visible;
    }
    
    .messages {
        max-width: 100%;
    }
    
    .message-content {
        max-width: 100%;
        border: none;
        background: white !important;
        color: black !important;
    }
    
    .formatted-content::after {
        content: "Created with Quillfy AI Story Writer";
        display: block;
        text-align: center;
        font-style: italic;
        margin-top: 40px;
        padding-top: 20px;
        border-top: 1px solid #ccc;
        font-family: 'Georgia', serif;
        font-size: 12px;
        color: #666;
    }
}