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

:root {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --accent: #3B82F6;
    --accent-hover: #2563EB;
    --success: #10B981;
    --error: #EF4444;
    --border: #334155;
}

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

.screen {
    display: none;
    height: 100vh;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-logo {
    margin-bottom: 30px;
}

.auth-logo h1 {
    font-size: 24px;
    margin-top: 16px;
    color: var(--text-primary);
}

.auth-logo p {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 14px;
}

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

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--accent);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.error-msg {
    color: var(--error);
    margin-top: 12px;
    font-size: 14px;
    min-height: 20px;
}

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

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

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

.header-left h2 {
    font-size: 18px;
    font-weight: 600;
}

.status {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

.status.offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.status.online {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status.processing {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.welcome-message h3 {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 12px;
}

.welcome-message p {
    font-size: 15px;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto 30px;
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 300px;
    margin: 0 auto;
}

.feature {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 14px;
}

.feature-icon {
    font-size: 20px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

.message.user .message-content {
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 0 4px;
}

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

.video-download {
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.video-download a {
    color: var(--success);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-download a:hover {
    text-decoration: underline;
}

.file-preview {
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.file-preview.hidden {
    display: none;
}

.file-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 13px;
}

.file-item .remove-file {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 16px;
}

.file-item .remove-file:hover {
    color: var(--error);
}

.chat-input-area {
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 12px;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
}

.attach-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.attach-btn:hover {
    color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

#message-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    outline: none;
    max-height: 150px;
    line-height: 1.5;
    padding: 8px 0;
}

#message-input::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    background: var(--accent);
    border: none;
    color: white;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover:not(:disabled) {
    background: var(--accent-hover);
}

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

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    padding: 40px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.overlay-content h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.overlay-content p {
    color: var(--text-secondary);
    font-size: 14px;
}

.hidden {
    display: none !important;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
