/**
 * GraphRAG Multi-Tenant Frontend Styles - Clean and intuitive for non-tech users
 */

:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    --text-primary: #333;
    --text-secondary: #666;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--light-bg);
}

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

/* Header */
.header {
    background: white;
    padding: 20px 0;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-details {
    text-align: right;
}

.user-name {
    font-weight: bold;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Authentication Forms */
.auth-section {
    max-width: 400px;
    margin: 50px auto;
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.auth-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}


/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
    text-align: center;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--text-secondary);
}

.btn-secondary:hover {
    background: #555;
}

.btn-success {
    background: var(--success-color);
}

.btn-danger {
    background: var(--error-color);
}

.btn-full {
    width: 100%;
}

.btn-link {
    background: none;
    color: var(--primary-color);
    text-decoration: underline;
    padding: 0;
}

/* Dashboard */
.dashboard {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--light-bg);
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn:hover {
    background: white;
    color: var(--primary-color);
}

.tab-btn.active {
    background: white;
    color: var(--primary-color);
    font-weight: bold;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

.tab-title {
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* Upload Section */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    background: var(--light-bg);
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: white;
}

.upload-icon {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.upload-text {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.file-input {
    margin-bottom: 15px;
}

/* Documents List */
.documents-list {
    margin-top: 30px;
}

.document-item {
    background: var(--light-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-info h4 {
    margin-bottom: 5px;
    color: var(--text-primary);
}

.doc-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.doc-size,
.doc-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.doc-visibility {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}
.visibility-content_based {
    background: #e6ffe6;
    color: var(--success-color);
}
.visibility-private {
    background: #ffe6e6;
    color: var(--error-color);
}

.visibility-shared {
    background: #e6f3ff;
    color: var(--info-color);
}

.visibility-public {
    background: #e6ffe6;
    color: var(--success-color);
}

.doc-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.doc-status.processed {
    background: #e6ffe6;
    color: var(--success-color);
}

.doc-status.pending {
    background: #fff3cd;
    color: var(--warning-color);
}

.no-documents {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-size: 1.1rem;
}

/* Query Section */
.query-form {
    background: var(--light-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.query-input {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    margin-bottom: 15px;
    min-height: 100px;
    resize: vertical;
}

.query-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Results Display */
.results-area {
    min-height: 200px;
}

.query-result,
.comparison-results {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 20px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.result-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.stat {
    background: var(--light-bg);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.answer {
    margin-bottom: 20px;
}

.answer h4 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.answer-text {
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--light-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.result-breakdown {
    margin: 15px 0;
    padding: 15px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
}

.breakdown-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.breakdown-stats span {
    background: white;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    font-weight: 500;
}

/* Follow-up Questions */
.follow-ups {
    margin-top: 20px;
    padding: 15px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
}

.follow-ups h4 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.follow-ups ul {
    list-style: none;
}

.follow-ups li {
    margin: 8px 0;
}

.follow-up-btn {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.follow-up-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Comparison Results */
.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.winner-badge {
    background: var(--success-color);
    color: white;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.method-result {
    background: var(--light-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
}

.method-result h4 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.method-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.method-stats span {
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

.method-answer {
    background: white;
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.graph-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.comparison-insights {
    background: var(--light-bg);
    padding: 15px;
    border-radius: var(--border-radius);
}

.comparison-insights h4 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.comparison-insights ul {
    list-style: none;
}

.comparison-insights li {
    margin: 8px 0;
    padding-left: 20px;
    position: relative;
}

.comparison-insights li::before {
    content: '💡';
    position: absolute;
    left: 0;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    color: white;
    font-weight: bold;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background: var(--success-color);
}

.notification.error {
    background: var(--error-color);
}

.notification.warning {
    background: var(--warning-color);
}

.notification.info {
    background: var(--info-color);
}

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

/* Enhanced Answer Formatting */
.answer-text {
    line-height: 1.8;
    font-size: 1.1rem;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    white-space: normal; /* Allow HTML formatting */
}

.answer-text h1, .answer-text h2, .answer-text h3 {
    color: var(--primary-color);
    margin: 20px 0 10px 0;
}

.answer-text p {
    margin-bottom: 15px;
}

.answer-text ul, .answer-text ol {
    margin: 10px 0 10px 20px;
    padding-left: 20px;
}

.answer-text li {
    margin-bottom: 8px;
}

.answer-text strong {
    color: #000000;
    font-weight: 600;
}

.answer-text code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.answer-text blockquote {
    border-left: 3px solid var(--primary-color);
    padding-left: 15px;
    margin: 15px 0;
    font-style: italic;
    color: var(--text-secondary);
}

/* Method differentiation badges */
.method-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 8px 0;
}

.vector-badge {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.graph-badge {
    background: linear-gradient(135deg, #070707, #0a0a0a);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: none;
        min-width: 120px;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .result-stats {
        justify-content: flex-start;
    }
    
    .breakdown-stats {
        justify-content: flex-start;
    }
    
    .method-stats {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .auth-section {
        margin: 20px auto;
        padding: 20px;
    }
    
    .tab-content {
        padding: 20px;
    }
    
    .upload-area {
        padding: 20px;
    }
    
    .doc-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-secondary);
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.mt-30 {
    margin-top: 30px;
}

.hidden {
    display: none !important;
}

/* Cost Tracking Styles */
.cost-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.cost-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    text-align: center;
}

.cost-card h3 {
    color: var(--text-color);
    margin-bottom: 10px;
    font-size: 1rem;
}

.cost-amount {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 10px 0;
}

.cost-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.cost-breakdown {
    margin-top: 30px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.model-costs {
    margin-top: 15px;
}

.model-cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.model-cost-item:last-child {
    border-bottom: none;
}

.model-name {
    font-weight: 600;
    color: var(--text-color);
}

.model-stats {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.model-cost {
    color: var(--primary-color);
    font-weight: 600;
}