/* Dashboard Page Specific Styles */

/* Fix scrollbar issue - override base.css min-height */
.app-layout {
    min-height: auto !important;
}

/* CSS Variables for table row styling */
:root {
    --bg-subtle: #f8f9fa;
    --fg-muted: #6c757d;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 16px;
}

/* Filter Sidebar */
.filters-sidebar {
    height: fit-content;
    top: 24px;
    font-size: 13px;
}

.filters-sidebar .section-card-title {
    font-size: 16px;
}

.filter-group {
    margin-bottom: 14px;
}

.filter-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    font-size: 12px;
}

.filter-select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background-color: white;
    transition: border-color 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #0039A6;
}

input[type="date"].filter-select:focus,
input[type="date"].filter-select:focus-visible {
    outline: none;
    border-color: #ddd;
    box-shadow: none;
}

.date-inputs {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filters-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 16px;
}

.filters-actions .button {
    width: 100%;
    justify-content: center;
    padding: 6px 12px;
    font-size: 12px;
}

/* Dashboard Content */
.dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 0px;
    min-width: 0;
}

/* Make dashboard controls sticky */
.dashboard-main > .section-thin-card:first-child {
    top: 24px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Make dashboard content more compact */
.dashboard-main .section-thin-card {
    font-size: 13px;
    margin-bottom: 16px;
}

.dashboard-main .section-thin-card:last-child {
    margin-bottom: 0;
}

.dashboard-main .section-thin-card .section-card-title {
    font-size: 16px;
}

/* Dashboard Controls Header Layout */
.dashboard-controls-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.dashboard-edit-controls-header {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 16px;
}

.dashboard-edit-controls-header .button {
    padding: 6px 12px;
    font-size: 12px;
}

.dashboard-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-selector label {
    font-size: 12px;
    white-space: nowrap;
}

.dashboard-type-select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    background-color: white;
    min-width: 180px;
}

/* Half-width mulls inputs */
.dashboard-type-select.mulls-input {
    min-width: 90px;
    width: 90px;
}

/* Loading and Empty States */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
    display: block;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 12px;
    font-size: 20px;
}

.empty-state p {
    color: #999;
    font-size: 14px;
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.loading-state h3 {
    margin: 20px 0 8px 0;
    color: #666;
    font-size: 18px;
}

.loading-state p {
    color: #999;
    font-size: 14px;
    margin: 0;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0039A6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dashboard-layout {
        grid-template-columns: 250px 1fr;
        gap: 16px;
    }
    
    .filters-sidebar {
        width: 250px;
    }
}

@media (max-width: 968px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .filters-sidebar {
        position: static;
        order: -1;
        width: 100%;
        left: auto;
        top: auto;
        margin-bottom: 20px;
    }
    
    .dashboard-main {
        margin-left: 0;
    }
    
    .dashboard-main > .section-thin-card:first-child {
        position: static;
        left: auto;
        right: auto;
        top: auto;
        box-shadow: none;
    }
    
    .dashboard-content {
        margin-top: 0;
    }
    
    .dashboard-controls-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .dashboard-edit-controls-header {
        justify-content: stretch;
    }
    
    .dashboard-selector {
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .dashboard-main {
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .dashboard-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    
    .dashboard-type-select {
        min-width: auto;
    }
    
    .generate-btn {
        justify-content: center;
    }
}

/* Dashboard Content Styling */

/* KPI Cards (Metrics) */
.dashboard-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 6px;
    margin-bottom: 6px;
}

.dashboard-kpi-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.dashboard-kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.kpi-title {
    font-size: 11px;
    font-weight: 600;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: #0039A6;
    margin-bottom: 3px;
    line-height: 1.2;
}

.kpi-subtitle {
    font-size: 11px;
    color: #000;
    font-weight: 500;
}

/* Individual Chart Container Styling */

.chart-placeholder,
.chart-container {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 200px;
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 24px;
    margin-top: 8px;
    margin-bottom: 8px;
}

/* For actual rendered charts */
.chart-container canvas,
.chart-container svg,
.section-card-body canvas,
.section-card-body svg {
    margin: 16px 0; /* slightly tighter default */
}

/* Reduce bottom gap specifically for chart canvases inside chart-canvas-container */
.chart-canvas-container canvas {
    margin-bottom: 0 !important;
}

/* Also trim container bottom spacing */
.chart-canvas-container {
    padding-bottom: 0;
    margin-bottom: 0;
}

.chart-icon {
    font-size: 48px;
    color: #9ca3af;
}

.chart-info {
    flex: 1;
}

.chart-type {
    font-size: 16px;
    color: #374151;
    margin-bottom: 8px;
}

.chart-meta {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
}

.chart-status {
    font-size: 14px;
    color: #9ca3af;
    font-style: italic;
}

/* Table Grid Layout */
.dashboard-table-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 8px;
}

/* Remove default margins from section cards in table grids */
.dashboard-table-grid .section-thin-card {
    margin-bottom: 0;
}

/* Remove padding from table containers so content goes to edges */
.table-body-no-padding {
    padding: 0 !important;
}

.table-body-no-padding .table-wrapper {
    border-radius: 0;
    overflow: hidden;
    overflow-y: auto;
    margin-bottom: 8px;
}

.table-body-no-padding .table-wrapper.no-table-bottom-margin {
    margin-bottom: 0;
}

/* Only apply max-height when no dynamic height is set */
.table-body-no-padding .table-wrapper:not([style*="height"]) {
    max-height: 400px;
}

/* Compact table styling for dashboard */
.dashboard-main .modern-table th {
    padding: 8px 12px;
    font-size: 11px;
}

.dashboard-main .modern-table td {
    padding: 6px 12px;
    font-size: 12px;
}

/* Perspective buttons - default unstyled appearance */
.perspective-button {
    background: none;
    border: 1px solid #ccc;
    color: #333;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 4px;
    transition: background-color 0.2s ease;
}

.perspective-button:hover {
    background-color: #f5f5f5;
}

.perspective-button.active {
    background-color: #e9ecef;
    border-color: #999;
}

/* Game Performance Table - Left align first column (category names) */
.dashboard-main .modern-table th:first-child,
.dashboard-main .modern-table td:first-child {
    text-align: left !important;
}

/* Dashboard table tooltip styling */
.dashboard-main .modern-table td[title],
.dashboard-main .modern-table th[title] {
    position: relative;
}

.dashboard-main .modern-table td[title]:hover,
.dashboard-main .modern-table th[title]:hover {
    background-color: rgba(0, 57, 166, 0.1) !important;
    transition: background-color 0.2s ease;
}

/* Simple fix for loading state - override flex behavior */
#loadingState .section-card-header {
    justify-content: flex-start;
}

#loadingState .section-card-title {
    flex: 1;
}

/* Empty State and Loading State Content */
.empty-state-content,
.loading-state-content {
    text-align: center;
    padding: 40px 20px;
    width: 100%;
    display: block;
}

.empty-state-content i,
.loading-state-content i {
    font-size: 48px;
    color: #9ca3af;
    margin-bottom: 16px;
    display: block;
}

.empty-state-content h3,
.loading-state-content h3 {
    margin: 0 0 12px 0;
    color: #374151;
    font-size: 20px;
    font-weight: 600;
    width: 100%;
}

.empty-state-content p,
.loading-state-content p {
    margin: 0;
    color: #6b7280;
    font-size: 16px;
    line-height: 1.5;
    width: 100%;
}

/* Dashboard Content Responsive Design */
@media (max-width: 768px) {
    .dashboard-metrics-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .dashboard-table-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .chart-placeholder {
        flex-direction: column;
        text-align: center;
        min-height: 150px;
    }
    
    .chart-icon {
        font-size: 36px;
    }
}