/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

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

.logo i {
    font-size: 1.5rem;
    color: #f39c12;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-outline {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    gap: 1rem;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
}

.chat-header h2 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.chat-header p {
    color: #6c757d;
    font-size: 0.9rem;
}

.sport-selector {
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sport-selector label {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9rem;
}

.sport-dropdown {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    color: #2c3e50;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 150px;
}

.sport-dropdown:focus {
    outline: none;
    border-color: #3498db;
}

.sport-dropdown:hover {
    border-color: #3498db;
}

.creator-selector {
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.creator-selector label {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9rem;
}

.creator-dropdown {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    color: #2c3e50;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 150px;
}

.creator-dropdown:focus {
    outline: none;
    border-color: #3498db;
}

.creator-dropdown:hover {
    border-color: #3498db;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    max-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

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

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

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

.bot-message .message-avatar {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

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

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

.message-text {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

/* Rendered Markdown table styling inside chat */
.message-text .md-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px; /* row gap */
    margin: 0.25rem 0;
}

.message-text .md-table thead th {
    background: #f1f3f5;
    border: 1px solid #e9ecef;
    color: #2c3e50;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
}

.message-text .md-table tbody td {
    background: #ffffff;
    border: 1px solid #e9ecef;
    padding: 10px 12px;
    vertical-align: top;
    text-align: left;
    line-height: 1.4;
}

.user-message .message-text {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
}

.message-text p {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-text li {
    margin-bottom: 0.25rem;
}

/* Sources */
.sources {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.sources h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.source-item {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.source-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.85rem;
}

.source-content {
    color: #6c757d;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.source-similarity {
    color: #28a745;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Chat Input */
.chat-input-container {
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.chat-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: border-color 0.3s ease;
}

#messageInput:focus {
    outline: none;
    border-color: #3498db;
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.input-footer {
    margin-top: 0.5rem;
    min-height: 20px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #6c757d;
    font-size: 0.8rem;
}

.typing-indicator i {
    animation: pulse 1.5s infinite;
}

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

.typing-indicator i:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Sidebar */
.sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-card, .quick-actions, .stats-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.status-card h3, .quick-actions h3, .stats-card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.status-label {
    font-weight: 500;
    color: #6c757d;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.status-indicator.connected {
    color: #28a745;
}

.status-indicator.disconnected {
    color: #dc3545;
}

.status-indicator.checking {
    color: #ffc107;
}

.quick-action-btn {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.quick-action-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9rem;
}

.stat-value {
    font-weight: 600;
    color: #2c3e50;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #2c3e50;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0.25rem;
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.document-item {
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #f8f9fa;
}

.document-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.document-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.document-description {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.loading i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

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

.loading-content {
    text-align: center;
    color: #2c3e50;
}

.loading-content i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #3498db;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        padding: 0.5rem;
    }
    
    .sidebar {
        width: 100%;
        order: -1;
    }
    
    .sidebar-content {
        flex-direction: row;
        overflow-x: auto;
        gap: 0.5rem;
    }
    
    .status-card, .quick-actions, .stats-card {
        min-width: 250px;
        flex-shrink: 0;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1rem;
    }
    
    .logo h1 {
        font-size: 1.2rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .chat-messages {
        max-height: 400px;
    }
    
    .message-content {
        max-width: 90%;
    }
}



