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

:root {
--primary-color: #007AFF;
--primary-hover: #0056CC;
--background: #F2F2F7;
--surface: #FFFFFF;
--text-primary: #000000;
--text-secondary: #8E8E93;
--border-color: #C6C6C8;
--user-message: #007AFF;
--ai-message: #E5E5EA;
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
--shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
--shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

.app-container {
display: flex;
flex-direction: column;
height: 100vh;
max-width: 900px;
margin: 0 auto;
background: var(--surface);
box-shadow: var(--shadow-lg);
}

/* Header */
.header {
background: var(--surface);
border-bottom: 1px solid var(--border-color);
padding: 16px 20px;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
}

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

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

.ai-icon {
width: 40px;
height: 40px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
color: white;
}

.header-text h1 {
font-size: 18px;
font-weight: 600;
margin-bottom: 2px;
}

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

.built-with {
font-size: 12px;
color: var(--text-secondary);
text-decoration: none;
padding: 6px 12px;
border-radius: 20px;
background: var(--background);
transition: all 0.3s ease;
}

.built-with:hover {
background: var(--primary-color);
color: white;
transform: translateY(-1px);
}

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

.chat-messages {
display: flex;
flex-direction: column;
gap: 16px;
}

/* Messages */
.welcome-message,
.message {
display: flex;
gap: 12px;
animation: fadeInUp 0.3s ease;
}

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

.ai-avatar {
width: 32px;
height: 32px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
flex-shrink: 0;
}

.user-avatar {
width: 32px;
height: 32px;
background: var(--user-message);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
flex-shrink: 0;
}

.message-content {
flex: 1;
max-width: 70%;
}

.message-bubble {
padding: 12px 16px;
border-radius: 18px;
background: var(--ai-message);
color: var(--text-primary);
font-size: 15px;
line-height: 1.4;
word-wrap: break-word;
position: relative;
box-shadow: var(--shadow-sm);
}

.message.user .message-bubble {
background: var(--user-message);
color: white;
margin-left: auto;
}

.message.ai .message-bubble {
background: var(--surface);
}

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

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

.typing-dot {
width: 8px;
height: 8px;
background: var(--text-secondary);
border-radius: 50%;
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% {
transform: translateY(0);
opacity: 0.5;
}
30% {
transform: translateY(-10px);
opacity: 1;
}
}

/* Loading Indicator */
.loading-indicator {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
padding: 40px;
background: var(--surface);
border-radius: 16px;
margin: 20px;
box-shadow: var(--shadow-md);
}

.loading-indicator.hidden {
display: none;
}

.loading-spinner {
width: 32px;
height: 32px;
border: 3px solid var(--border-color);
border-top-color: var(--primary-color);
border-radius: 50%;
animation: spin 1s linear infinite;
}

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

.progress-bar {
width: 200px;
height: 4px;
background: var(--border-color);
border-radius: 2px;
overflow: hidden;
}

.progress-fill {
height: 100%;
background: var(--primary-color);
width: 0%;
transition: width 0.3s ease;
}

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

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

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

.input-container:focus-within {
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.message-input {
flex: 1;
border: none;
background: transparent;
font-size: 15px;
font-family: inherit;
resize: none;
outline: none;
max-height: 120px;
line-height: 1.4;
padding: 8px 0;
}

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

.message-input:disabled {
opacity: 0.5;
cursor: not-allowed;
}

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

.send-button:hover:not(:disabled) {
background: var(--primary-hover);
transform: scale(1.05);
}

.send-button:disabled {
background: var(--border-color);
cursor: not-allowed;
transform: none;
}

.input-footer {
display: flex;
justify-content: space-between;
margin-top: 8px;
padding: 0 8px;
}

.input-footer small {
font-size: 12px;
color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
.app-container {
max-width: 100%;
box-shadow: none;
}

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

.header {
padding: 12px 16px;
}

.chat-container {
padding: 16px;
}

.input-area {
padding: 12px 16px;
}
}

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

.chat-container::-webkit-scrollbar-track {
background: transparent;
}

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

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