:root {
--primary-color: #007AFF;
--primary-hover: #0056CC;
--background: #FFFFFF;
--surface: #F8F9FA;
--border: #E5E5EA;
--text-primary: #1D1D1F;
--text-secondary: #8E8E93;
--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 40px rgba(0, 0, 0, 0.15);
--radius: 12px;
--radius-lg: 20px;
--transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.app-container {
height: 100vh;
display: flex;
flex-direction: column;
}

/* Header */
.header {
background: var(--background);
border-bottom: 1px solid var(--border);
padding: 16px 24px;
backdrop-filter: blur(20px);
background: rgba(255, 255, 255, 0.8);
z-index: 100;
}

.header-content {
display: flex;
justify-content: space-between;
align-items: center;
max-width: 1200px;
margin: 0 auto;
}

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

.app-icon {
width: 48px;
height: 48px;
background: linear-gradient(135deg, #007AFF, #5856D6);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
color: white;
}

.app-info h1 {
font-size: 20px;
font-weight: 600;
margin-bottom: 2px;
}

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

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

.btn-icon {
width: 40px;
height: 40px;
border: none;
background: var(--surface);
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: var(--text-secondary);
transition: var(--transition);
}

.btn-icon:hover {
background: var(--border);
color: var(--text-primary);
}

.built-with {
font-size: 12px;
color: var(--text-secondary);
text-decoration: none;
padding: 8px 12px;
border-radius: 8px;
transition: var(--transition);
}

.built-with:hover {
background: var(--surface);
color: var(--primary-color);
}

/* Chat Container */
.chat-container {
flex: 1;
overflow: hidden;
display: flex;
flex-direction: column;
}

.messages {
flex: 1;
overflow-y: auto;
padding: 24px;
scroll-behavior: smooth;
}

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

.messages::-webkit-scrollbar-track {
background: transparent;
}

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

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

.welcome-icon {
width: 80px;
height: 80px;
margin: 0 auto 24px;
background: var(--surface);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: var(--text-secondary);
}

.welcome-message h2 {
font-size: 28px;
font-weight: 600;
margin-bottom: 8px;
}

.welcome-message p {
color: var(--text-secondary);
margin-bottom: 32px;
}

.suggested-prompts {
display: flex;
flex-wrap: wrap;
gap: 12px;
justify-content: center;
}

.prompt-chip {
padding: 12px 20px;
border: 1px solid var(--border);
background: var(--background);
border-radius: 20px;
font-size: 14px;
color: var(--text-primary);
cursor: pointer;
transition: var(--transition);
}

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

/* Messages */
.message {
display: flex;
gap: 12px;
margin-bottom: 20px;
animation: slideUp 0.3s ease-out;
}

.message.user {
flex-direction: row-reverse;
}

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

.message.user .message-avatar {
background: var(--primary-color);
color: white;
}

.message-content {
max-width: 70%;
padding: 12px 16px;
background: var(--surface);
border-radius: var(--radius);
font-size: 15px;
line-height: 1.6;
}

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

/* Typing Indicator */
.typing-indicator {
display: flex;
gap: 4px;
padding: 16px 24px;
align-items: center;
}

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

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

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

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

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

.input-container {
max-width: 1200px;
margin: 0 auto;
}

.input-wrapper {
display: flex;
align-items: flex-end;
gap: 12px;
background: var(--surface);
border-radius: var(--radius-lg);
padding: 12px 16px;
border: 2px solid transparent;
transition: var(--transition);
}

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

#message-input {
flex: 1;
border: none;
background: transparent;
font-size: 15px;
font-family: inherit;
resize: none;
outline: none;
min-height: 20px;
max-height: 120px;
line-height: 1.5;
}

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

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

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

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

/* Loading Overlay */
.loading-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(20px);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}

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

.loading-content {
text-align: center;
max-width: 400px;
padding: 40px;
}

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

.loading-content h3 {
font-size: 24px;
font-weight: 600;
margin-bottom: 8px;
}

.loading-content p {
color: var(--text-secondary);
margin-bottom: 24px;
font-size: 14px;
}

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

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

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

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

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

@keyframes typing {
0%, 80%, 100% {
transform: scale(0.8);
opacity: 0.5;
}
40% {
transform: scale(1);
opacity: 1;
}
}

/* Responsive */
@media (max-width: 768px) {
.header {
padding: 12px 16px;
}

.messages {
padding: 16px;
}

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

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

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

.suggested-prompts {
flex-direction: column;
align-items: center;
}

.prompt-chip {
width: 100%;
max-width: 280px;
text-align: center;
}
}