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

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --bg-gradient: linear-gradient(135deg, #1e1e2e 0%, #2d2d44 100%);
    --message-user: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --message-ai: #2a2a3e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Login Screen Styles */
.login-container {
    width: 100%;
    max-width: 450px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    width: 100%;
    background: rgba(30, 30, 46, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    padding: 48px;
    animation: fadeIn 0.6s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header svg {
    margin-bottom: 24px;
}

.login-header h1 {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

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

.login-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.input-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

.input-group input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group input::placeholder {
    color: var(--text-secondary);
}

.login-button {
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    padding: 14px 24px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    color: #f5576c;
    font-size: 14px;
    text-align: center;
    min-height: 20px;
    animation: slideIn 0.3s ease-out;
}

.login-footer {
    margin-top: 32px;
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-secondary);
    font-size: 13px;
}

.container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    background: rgba(30, 30, 46, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header Styles */
.chat-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo h1 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
}

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

.status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clear-chat-button,
.logout-button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.clear-chat-button:hover {
    background: rgba(245, 87, 108, 0.1);
    border-color: rgba(245, 87, 108, 0.3);
    color: #f5576c;
    transform: translateY(-2px);
}

.logout-button:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
    color: #667eea;
    transform: translateY(-2px);
}

.clear-chat-button:active,
.logout-button:active {
    transform: translateY(0);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    scroll-behavior: smooth;
}

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

.chat-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

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

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 60px 20px;
    animation: fadeIn 0.6s ease-out;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: wave 1s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(20deg);
    }
    75% {
        transform: rotate(-20deg);
    }
}

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

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

/* Message Styles */
.message {
    display: flex;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease-out;
}

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

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

.message-content {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
}

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

.message.ai .message-content {
    background: var(--message-ai);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.mode-badge {
    display: inline-block;
    font-size: 12px;
    margin-right: 8px;
    opacity: 0.8;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

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

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

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

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

/* Input Container */
.input-container {
    padding: 20px 30px 30px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border-color);
}

/* Uploaded Images Preview */
.uploaded-images {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    padding: 0 30px;
}

.image-preview {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview .remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(245, 87, 108, 0.9);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
}

.image-preview .remove-image:hover {
    background: rgba(245, 87, 108, 1);
    transform: scale(1.1);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.mode-selector {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    flex-shrink: 0;
}

.mode-selector:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #667eea;
}

.mode-selector:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.mode-selector option {
    background: #2a2a3e;
    color: var(--text-primary);
    padding: 8px;
}

.upload-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    color: var(--text-primary);
}

.upload-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #667eea;
    transform: translateY(-2px);
}

.upload-button:active {
    transform: translateY(0);
}

#userInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
}

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

.send-button {
    background: var(--primary-gradient);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-button:active {
    transform: translateY(0);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }

    .chat-header {
        padding: 16px 20px;
    }

    .logo h1 {
        font-size: 20px;
    }

    .chat-container {
        padding: 20px;
    }

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

    .welcome-message {
        padding: 40px 20px;
    }

    .welcome-icon {
        font-size: 48px;
    }

    .welcome-message h2 {
        font-size: 24px;
    }
}
