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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.app-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-title i {
    font-size: 1.8rem;
    color: #fff;
}

.app-title h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-left: 0.5rem;
}

.settings-btn {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.settings-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Settings Panel */
.settings-panel {
    position: absolute;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.settings-panel.open {
    right: 0;
}

.settings-content {
    padding: 2rem 1.5rem;
}

.settings-content h3 {
    margin-bottom: 1.5rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.setting-group select,
.setting-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.setting-group select:focus,
.setting-group input:focus {
    outline: none;
    border-color: #4facfe;
}

.setting-group input[type="range"] {
    padding: 0;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Welcome Message */
.welcome-message {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.welcome-message .message-content {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex: 1;
}

.welcome-message h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

.welcome-message p {
    color: #666;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.welcome-message ul {
    margin: 0.5rem 0;
    padding-left: 1rem;
}

.welcome-message li {
    color: #666;
    margin-bottom: 0.25rem;
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 0.75rem;
    animation: fadeInUp 0.3s ease;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message.ai .message-avatar {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.message-bubble {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
}

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

.message.ai .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 6px;
}

.message-info {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.provider-badge {
    background: #4facfe;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
}

/* Input Container */
.input-container {
    background: white;
    border-top: 1px solid #e1e5e9;
    padding: 1rem 1.5rem;
}

.input-area {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    max-width: 800px;
    margin: 0 auto;
}

#messageInput {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    font-size: 0.9rem;
    max-height: 120px;
    transition: border-color 0.3s ease;
}

#messageInput:focus {
    outline: none;
    border-color: #4facfe;
}

#sendButton {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sendButton:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
}

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

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #666;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.status-indicator i {
    font-size: 0.6rem;
    color: #4caf50;
}

.model-info {
    font-style: italic;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.loading-spinner i {
    font-size: 2rem;
    color: #4facfe;
    margin-bottom: 1rem;
}

.loading-spinner p {
    margin: 0;
    color: #666;
}

/* Buttons */
.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        height: 100vh;
        border-radius: 0;
    }
    
    .chat-container {
        padding: 0.5rem;
    }
    
    .input-container {
        padding: 0.75rem 1rem;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .settings-panel {
        width: 280px;
        right: -300px;
    }
    
    .app-title h1 {
        font-size: 1.5rem;
    }
    
    .app-title i {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0.5rem 0;
    }
    
    .app-title {
        gap: 0.3rem;
    }
    
    .app-title h1 {
        font-size: 1.3rem;
    }
    
    .subtitle {
        display: none;
    }
}

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

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}