/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #00E4BA 0%, #00B894 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

/* Header styles */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.5rem;
    color: #00E4BA;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, #00E4BA, #00B894);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 300;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 228, 186, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid rgba(0, 228, 186, 0.3);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff4757;
}

.status-dot.active {
    background: #2ed573;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.status-text {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Chat container */
.chat-container {
    display: flex;
    flex: 1;
    min-height: 600px;
}

/* Sidebar styles */
.sidebar {
    width: 280px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.sidebar-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: #495057;
    margin-bottom: 15px;
}

.sidebar-header h3 i {
    color: #00E4BA;
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #00E4BA 0%, #00B894 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 228, 186, 0.4);
}

.chat-history {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

.chat-item {
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    color: #495057;
}

.chat-item:hover {
    background: #e9ecef;
}

.chat-item.active {
    background: linear-gradient(135deg, rgba(0, 228, 186, 0.1) 0%, rgba(0, 184, 148, 0.1) 100%);
    color: #00E4BA;
    border-left: 3px solid #00E4BA;
}

.chat-item i {
    font-size: 0.9rem;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: white;
}

.model-info, .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.model-info i {
    color: #00E4BA;
}

.user-info i {
    color: #00B894;
}

/* Main chat area */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.chat-messages {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
}

.message {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message .avatar {
    background: linear-gradient(135deg, #00E4BA 0%, #00B894 100%);
    color: white;
}

.user-message .avatar {
    background: linear-gradient(135deg, #00E4BA 0%, #00B894 100%);
}

.message-content {
    flex: 1;
    max-width: calc(100% - 55px);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.sender {
    font-weight: 600;
    color: #1a1a2e;
}

.timestamp {
    font-size: 0.8rem;
    color: #6c757d;
}

.message-text {
    background: white;
    padding: 15px;
    border-radius: 15px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    line-height: 1.6;
}

.user-message .message-text {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #90caf9;
}

.message-text p {
    margin-bottom: 10px;
}

.message-text ul, .message-text ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.message-text li {
    margin-bottom: 5px;
}

.welcome-message .message-text {
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f7ff 100%);
    border: 1px solid #b3e0ff;
}

/* Chat input */
.chat-input-container {
    padding: 20px 30px;
    border-top: 1px solid #e9ecef;
    background: white;
}

.input-wrapper {
    position: relative;
    margin-bottom: 15px;
}

textarea {
    width: 100%;
    padding: 15px 60px 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    resize: none;
    max-height: 150px;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #00E4BA;
    box-shadow: 0 0 0 3px rgba(0, 228, 186, 0.1);
}

.input-actions {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #00E4BA 0%, #00B894 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 228, 186, 0.4);
}

#attachBtn {
    background: #6c757d;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #6c757d;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-selector select {
    padding: 5px 10px;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    background: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
}

.hint {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 400px;
}

.hint i {
    color: #ffc107;
}

/* Footer */
.footer {
    padding: 15px 30px;
    text-align: center;
    font-size: 0.8rem;
    color: #6c757d;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

/* Typing indicator */
.typing-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 46, 0.9);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.typing-indicator.visible {
    opacity: 1;
    visibility: visible;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00E4BA;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Responsive design */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 15px;
    }
    
    .chat-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 15px;
    }
    
    .input-footer {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .hint {
        max-width: 100%;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}