/* Analysis History Page Styles */

.analysis-history-page {
    background-color: var(--bg-primary);
    min-height: 100vh;
    padding: 2rem 0;
    color: var(--text-primary);
}

.page-title {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Analysis Cards */
.analysis-card {
    transition: all 0.2s ease-in-out;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.analysis-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft) !important;
    border-color: var(--accent-primary);
}

.analysis-card .card-title {
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.3;
}

/* Accordion borders between items */
.analysis-card + .analysis-card {
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* Accordion headers (summary rows) */
.analysis-card .accordion-button {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
    box-shadow: inset 0 -1px 0 var(--border-color);
}
.analysis-card .accordion-button:not(.collapsed) {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: inset 0 -1px 0 var(--border-color);
}
.analysis-card .accordion-button::after {
    filter: brightness(0) invert(1);
}
.analysis-card .accordion-body {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.analysis-card .text-muted {
    color: var(--text-secondary) !important;
}
.analysis-card .metric-label,
.analysis-card .metric-value {
    color: var(--text-primary);
}

.analysis-history-page .metric-value,
.analysis-history-page .metric-label {
    color: var(--text-primary) !important;
}

/* Summary cards (analysis_summary_stats) explicit override */
#analysis-summary-stats .metric-value,
#analysis-summary-stats .metric-label {
    color: var(--text-primary) !important;
}

/* Accordion container styling */
.analysis-history-page .accordion-item {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}
.analysis-history-page .accordion-button {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    box-shadow: inset 0 -1px 0 var(--border-color) !important;
    border: none !important;
}
.analysis-history-page .accordion-button:not(.collapsed) {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    box-shadow: inset 0 -1px 0 var(--border-color) !important;
}
.analysis-history-page .accordion-button.collapsed {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    box-shadow: inset 0 -1px 0 var(--border-color) !important;
}
.analysis-history-page .accordion-button:focus,
.analysis-history-page .accordion-button:focus-visible {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
    outline: none !important;
    border: 1px solid var(--border-color) !important;
}
.analysis-history-page .accordion-button.collapsed:focus,
.analysis-history-page .accordion-button.collapsed:focus-visible {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
    outline: none !important;
    border: 1px solid var(--border-color) !important;
}
.analysis-history-page .accordion-button::after {
    filter: brightness(0) invert(1);
}
.analysis-history-page .accordion-body {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}
.analysis-history-page .accordion-item + .accordion-item {
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}
.analysis-history-page .text-muted {
    color: var(--text-secondary) !important;
}

/* Debate dimensions table */
.analysis-history-page .analysis-history-dimensions-table {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    margin-bottom: 0;
}

.analysis-history-page .analysis-history-dimensions-table thead th {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.analysis-history-page .analysis-history-dimensions-table tbody td {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.analysis-history-page .analysis-history-dimensions-table tbody tr:hover td {
    background: var(--bg-tertiary) !important;
}

.analysis-history-page .analysis-history-dimensions-table .text-muted {
    color: var(--text-secondary) !important;
}

/* Analytics graphs */
.analysis-history-page .analysis-history-chart-card,
.analysis-history-page .analysis-history-chart-card .card-body {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.analysis-history-page .analysis-history-graph,
.analysis-history-page .analysis-history-graph .js-plotly-plot,
.analysis-history-page .analysis-history-graph .plot-container,
.analysis-history-page .analysis-history-graph .svg-container {
    background: transparent !important;
    color: var(--text-primary) !important;
}

.analysis-history-page .analysis-history-graph .gtitle,
.analysis-history-page .analysis-history-graph .xtitle,
.analysis-history-page .analysis-history-graph .ytitle,
.analysis-history-page .analysis-history-graph .y2title,
.analysis-history-page .analysis-history-graph .xtick text,
.analysis-history-page .analysis-history-graph .ytick text,
.analysis-history-page .analysis-history-graph .legendtext,
.analysis-history-page .analysis-history-graph .annotation-text,
.analysis-history-page .analysis-history-graph .hovertext text {
    fill: var(--text-primary) !important;
}

.analysis-history-page .analysis-history-graph .xgrid path,
.analysis-history-page .analysis-history-graph .ygrid path,
.analysis-history-page .analysis-history-graph .zerolinelayer path {
    stroke: rgba(127, 127, 127, 0.15) !important;
}

.analysis-card .badge {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Metric Cards */
.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filter Section */
.form-label {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Button Styles */
.btn-group .btn {
    border-radius: 0.375rem !important;
    margin-right: 0.25rem;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

/* Empty State */
.analysis-history-page .fa-4x {
    opacity: 0.3;
    color: var(--text-secondary);
}

/* Modal Styles */
.modal-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    color: var(--text-primary);
    font-weight: 600;
}

/* Status Badges */
.badge.bg-success {
    background-color: #22c55e !important;
}

.badge.bg-primary {
    background-color: var(--accent-primary) !important;
}

.badge.bg-warning {
    background-color: #f59e0b !important;
    color: #0b0f19 !important;
}

.badge.bg-secondary {
    background-color: var(--text-secondary) !important;
    color: var(--bg-secondary) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .analysis-history-page {
        padding: 1rem 0;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        margin-right: 0;
        margin-bottom: 0.25rem;
    }
}

/* Loading States */
.analysis-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Search and Filter Improvements */
.form-control,
.form-select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

/* Analysis Detail Modal */
.analysis-detail-content .fw-bold {
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.font-monospace {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* Alert Improvements */
.alert {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.alert-info {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.alert-warning {
    background-color: #f59e0b22;
    color: #fcd34d;
}

.alert-danger {
    background-color: #7f1d1d;
    color: #fecdd3;
}
