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

body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}

.container {
background: white;
border-radius: 20px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
width: 100%;
max-width: 800px;
height: 90vh;
max-height: 700px;
display: flex;
flex-direction: column;
overflow: hidden;
}

.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
}

.header-content h1 {
font-size: 24px;
font-weight: 600;
margin-bottom: 4px;
}

.subtitle {
font-size: 14px;
opacity: 0.9;
}

.built-with {
color: white;
text-decoration: none;
font-size: 12px;
opacity: 0.8;
transition: opacity 0.3s;
}

.built-with:hover {
opacity: 1;
text-decoration: underline;
}

.main-content {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}

.settings-panel {
background: #f8f9fa;
padding: 15px;
display: flex;
gap: 15px;
flex-wrap: wrap;
align-items: center;
border-bottom: 1px solid #e0e0e0;
}

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

.setting-group label {
font-size: 14px;
color: #666;
font-weight: 500;
}

.setting-group select {
padding: 6px 10px;
border: 1px solid #ddd;
border-radius: 6px;
background: white;
font-size: 14px;
cursor: pointer;
transition: border-color 0.3s;
}

.setting-group select:hover {
border-color: #667eea;
}

.clear-btn {
margin-left: auto;
padding: 6px 12px;
background: #dc3545;
color: white;
border: none;
border-radius: 6px;
font-size: 14px;
cursor: pointer;
transition: background-color 0.3s;
}

.clear-btn:hover {
background: #c82333;
}

.chat-container {
flex: 1;
overflow: hidden;
position: relative;
}

.messages {
height: 100%;
overflow-y: auto;
padding: 20px;
display: flex;
flex-direction: column;
gap: 15px;
}

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

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

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

.message-content {
padding: 12px 16px;
border-radius: 18px;
word-wrap: break-word;
}

.user-message .message-content {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-bottom-right-radius: 4px;
}

.bot-message .message-content {
background: #f1f3f5;
color: #333;
border-bottom-left-radius: 4px;
}

.message-content p {
margin: 0;
line-height: 1.4;
}

.message-time {
font-size: 12px;
color: #999;
margin-top: 4px;
padding: 0 8px;
}

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

.typing-indicator {
display: flex;
gap: 4px;
padding: 15px 20px;
}

.typing-indicator span {
width: 8px;
height: 8px;
border-radius: 50%;
background: #999;
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;
}

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

.input-container {
padding: 20px;
background: white;
border-top: 1px solid #e0e0e0;
}

.input-wrapper {
display: flex;
gap: 10px;
align-items: flex-end;
}

#message-input {
flex: 1;
padding: 12px 16px;
border: 2px solid #e0e0e0;
border-radius: 25px;
font-size: 16px;
resize: none;
font-family: inherit;
line-height: 1.4;
transition: border-color 0.3s;
min-height: 44px;
max-height: 120px;
}

#message-input:focus {
outline: none;
border-color: #667eea;
}

.send-button {
width: 44px;
height: 44px;
border-radius: 50%;
border: none;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.2s, opacity 0.2s;
}

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

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

.input-info {
display: flex;
justify-content: space-between;
margin-top: 8px;
font-size: 12px;
color: #999;
}

.loading-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;
}

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

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

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

.loading-content p {
font-size: 18px;
margin-bottom: 8px;
}

.loading-subtitle {
font-size: 14px;
opacity: 0.8;
}

.error-toast {
position: fixed;
top: 20px;
right: 20px;
background: #dc3545;
color: white;
border-radius: 8px;
padding: 0;
max-width: 350px;
z-index: 1001;
animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}

.error-content {
display: flex;
align-items: center;
padding: 12px 16px;
gap: 12px;
}

.error-icon {
background: white;
color: #dc3545;
width: 20px;
height: 20px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
flex-shrink: 0;
}

.error-message {
flex: 1;
font-size: 14px;
}

.dismiss-btn {
background: none;
border: none;
color: white;
font-size: 20px;
cursor: pointer;
padding: 0;
line-height: 1;
opacity: 0.8;
transition: opacity 0.2s;
}

.dismiss-btn:hover {
opacity: 1;
}

.hidden {
display: none !important;
}

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

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

.header {
padding: 15px;
}

.header-content h1 {
font-size: 20px;
}

.settings-panel {
padding: 10px;
gap: 10px;
}

.setting-group {
flex: 1;
min-width: 140px;
}

.clear-btn {
width: 100%;
margin-left: 0;
margin-top: 10px;
}

.message {
max-width: 85%;
}

.messages {
padding: 15px;
}

.input-container {
padding: 15px;
}

.error-toast {
right: 10px;
left: 10px;
max-width: none;
}
}