/* Dashboard Page Styles - V2 */

.dashboard-page {
    background: var(--bg-primary, #f5f7fa);
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem 1.5rem;
}

/* Header */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    margin-bottom: 2rem;
}

.header-left .back-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary, #666);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.header-left .back-link:hover {
    color: var(--primary-color, #ffe600);
}

/* Dashboard Navigation */
.dashboard-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1.5rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border-color, #e0e0e0);
}

.dashboard-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-secondary, #666);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
}

.dashboard-nav .nav-link:hover {
    background: var(--bg-hover, #f0f0f0);
    color: var(--primary-color, #ffe600);
}

.dashboard-nav .nav-link i {
    font-size: 0.875rem;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-center h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Date Range Selector */
.date-range-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-range-dropdown {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    background: var(--bg-secondary, #fff);
    color: var(--text-primary, #333);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}

.date-range-dropdown:hover {
    border-color: var(--primary-color, #ffe600);
}

.date-range-dropdown:focus {
    outline: none;
    border-color: var(--primary-color, #ffe600);
    box-shadow: 0 0 0 3px var(--focus-ring, rgba(255, 230, 0, 0.22));
}

.custom-date-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.5rem;
}

.date-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    background: var(--bg-secondary, #fff);
    color: var(--text-primary, #333);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.date-input:hover {
    border-color: var(--primary-color, #ffe600);
}

.date-input:focus {
    outline: none;
    border-color: var(--primary-color, #ffe600);
    box-shadow: 0 0 0 3px var(--focus-ring, rgba(255, 230, 0, 0.22));
}

.date-separator {
    font-size: 0.875rem;
    color: var(--text-secondary, #888);
}

.btn-primary.small {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    min-width: auto;
}

.last-updated {
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
}

/* Loading & Error States */
.loading-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--text-secondary, #888);
}

.loading-state i,
.error-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-state {
    color: var(--error-color, #dc3545);
}

.error-state .btn-primary {
    margin-top: 1rem;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--bg-secondary, #fff);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}

.metric-icon.blue {
    background: linear-gradient(135deg, #ffe600, #f2d600);
    color: var(--accent-contrast, #1f1f1f);
}

.metric-icon.green {
    background: linear-gradient(135deg, #34a853, #1e8e3e);
}

.metric-icon.purple {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
}

.metric-icon.orange {
    background: linear-gradient(135deg, #ff9800, #f57c00);
}

.metric-icon.teal {
    background: linear-gradient(135deg, #00bcd4, #0097a7);
}

.metric-icon.red {
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary, #333);
    line-height: 1.2;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary, #888);
    margin-top: 0.25rem;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--bg-secondary, #fff);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-card h3 i {
    color: var(--primary-color, #ffe600);
}

.chart-container {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-placeholder {
    color: var(--text-secondary, #888);
    text-align: center;
}

/* Model Usage Bar Chart (Simple CSS) */
.model-bar-chart {
    width: 100%;
}

.model-bar-item {
    margin-bottom: 1rem;
}

.model-bar-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.model-bar-name {
    color: var(--text-primary, #333);
    font-weight: 500;
}

.model-bar-count {
    color: var(--text-secondary, #888);
}

.model-bar-track {
    height: 8px;
    background: var(--bg-primary, #f0f0f0);
    border-radius: 4px;
    overflow: hidden;
}

.model-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffe600, #f2d600);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Activity Chart - Redesigned with separate x-axis */
.activity-chart-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.activity-bars {
    display: flex;
    align-items: flex-end;
    height: 180px;
    gap: 2px;
    padding: 0 4px;
}

.activity-bar {
    flex: 1;
    min-width: 0;
}

.activity-bar-fill {
    width: 100%;
    background: linear-gradient(180deg, #ffe600, #f2d600);
    border-radius: 3px 3px 0 0;
    transition: height 0.3s ease;
    min-height: 2px;
}

.activity-bar-fill:hover {
    opacity: 0.85;
}

/* Separate X-axis - always evenly spaced */
.activity-x-axis {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 4px 0;
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
}

.activity-x-axis span {
    text-align: center;
    min-width: 40px;
}

/* First and last labels align to edges */
.activity-x-axis span:first-child {
    text-align: left;
}

.activity-x-axis span:last-child {
    text-align: right;
}

/* Recent Section */
.recent-section {
    background: var(--bg-secondary, #fff);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
}

.recent-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recent-section h3 i {
    color: var(--primary-color, #ffe600);
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-primary, #f5f7fa);
    border-radius: 8px;
}

.recent-item-icon {
    font-size: 1.25rem;
}

.recent-item-icon.positive {
    color: #34a853;
}

.recent-item-icon.negative {
    color: #ea4335;
}

.recent-item-content {
    flex: 1;
}

.recent-item-title {
    font-weight: 500;
    color: var(--text-primary, #333);
    font-size: 0.875rem;
}

.recent-item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
}

.no-data {
    color: var(--text-secondary, #888);
    text-align: center;
    padding: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .header-center {
        order: -1;
        width: 100%;
        justify-content: center;
    }

    .header-right {
        flex-wrap: wrap;
        width: 100%;
        justify-content: center;
    }

    .date-range-selector {
        flex-wrap: wrap;
        width: 100%;
        justify-content: center;
    }

    .custom-date-inputs {
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .date-range-dropdown,
    .date-input {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    .last-updated {
        width: 100%;
        text-align: center;
        order: 10;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }
}

/* Dark Mode Support */
[data-theme="dark"] .dashboard-page,
.dark-mode .dashboard-page {
    background: var(--bg-primary, #1a1a2e);
}

[data-theme="dark"] .metric-card,
[data-theme="dark"] .chart-card,
[data-theme="dark"] .recent-section,
.dark-mode .metric-card,
.dark-mode .chart-card,
.dark-mode .recent-section {
    background: var(--bg-secondary, #16213e);
}
