/* Baseline copied from TowSmart.Client dashboard-widgets.css, re-tokened to Patriot theme.css (no green/red). */
/* Dashboard Widget Grid System */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    width: 100%;
}

.dashboard-grid.compact {
    gap: 0.75rem;
}

/* Widget sizing */
.widget-full {
    grid-column: 1 / -1;
}

.widget-half {
    grid-column: span 1;
}

/* Themed Stat Cards */
.themed-stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

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

.themed-stat-card h6 {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.themed-stat-card h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0;
}

.themed-stat-card small {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

/* Themed Metric Cards with color variants */
.themed-metric-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    border-left: 4px solid;
}

.themed-metric-card.primary {
    border-left-color: var(--accent);
}

.themed-metric-card.success {
    border-left-color: var(--accent-hover);
}

.themed-metric-card.warning {
    border-left-color: var(--text-secondary);
}

.themed-metric-card.info {
    border-left-color: var(--accent);
}

.themed-metric-card.danger {
    border-left-color: var(--text-primary);
}

/* Themed Card Body */
.themed-card-body {
    padding: 1rem;
    background-color: var(--card-bg);
    color: var(--text-primary);
}

.themed-card-body.compact {
    padding: 0.75rem;
}

/* Themed Revenue Summary Cards */
.revenue-summary-card {
    border-radius: 8px;
    padding: 0.75rem;
    color: white;
    border: none;
}

.revenue-summary-card.primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
}

.revenue-summary-card.success {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
}

.revenue-summary-card.info {
    background: linear-gradient(135deg, var(--text-secondary) 0%, var(--accent) 100%);
}

.revenue-summary-card h6 {
    opacity: 0.85;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.revenue-summary-card h3 {
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.revenue-summary-card small {
    opacity: 0.75;
    font-size: 0.7rem;
}

/* Themed Data Rows */
.themed-data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.themed-data-row:last-child {
    border-bottom: none;
}

.themed-data-row span:first-child {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.themed-data-row strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Mobile Responsive Tables */
.table-responsive-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .table-responsive-mobile table {
        font-size: 0.85rem;
    }

    .table-responsive-mobile th,
    .table-responsive-mobile td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }
}

/* Compact Grid Layout */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .widget-full,
    .widget-half {
        grid-column: 1 / -1;
    }

    .themed-stat-card h3 {
        font-size: 1.25rem;
    }

    .revenue-summary-card h3 {
        font-size: 1.25rem;
    }
}

/* Theme Dark Mode Adjustments */
.theme-dark .themed-stat-card {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
}

.theme-dark .themed-stat-card:hover {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05);
}

.theme-dark .themed-metric-card {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
}

.theme-dark .themed-data-row {
    border-bottom-color: var(--border-color);
}

/* ApexCharts Dark Mode */
.theme-dark .apexcharts-canvas {
    background: transparent !important;
}

.theme-dark .apexcharts-text {
    fill: var(--text-primary) !important;
}

.theme-dark .apexcharts-legend-text {
    color: var(--text-primary) !important;
}

.theme-dark .apexcharts-title-text {
    fill: var(--text-primary) !important;
}

.theme-dark .apexcharts-xaxis-label,
.theme-dark .apexcharts-yaxis-label {
    fill: var(--text-secondary) !important;
}

.theme-dark .apexcharts-gridline {
    stroke: var(--border-color) !important;
}

.theme-dark .apexcharts-tooltip {
    background: var(--card-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.theme-dark .apexcharts-tooltip-title {
    background: var(--surface-2) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Loading States */
.widget-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    color: var(--text-secondary);
}

/* Widget Section Headers */
.widget-section-header {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

/* Compact spacing utilities */
.compact-spacing .row {
    margin-top: -0.5rem;
    margin-bottom: -0.5rem;
}

.compact-spacing .row > [class*='col-'] {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Themed total row for tables */
.themed-total-row {
    background-color: var(--surface-2) !important;
    border-top: 2px solid var(--border-color) !important;
    border-bottom: 2px solid var(--border-color) !important;
}

.themed-total-row td {
    color: var(--text-primary) !important;
    font-weight: 700 !important;
}

.theme-dark .themed-total-row {
    background-color: var(--accent-soft) !important;
    border-color: var(--accent) !important;
}

/* Mobile ApexCharts Responsive */
@media (max-width: 768px) {
    .apexcharts-canvas {
        max-width: 100% !important;
    }

    .apexcharts-legend {
        padding: 0 !important;
    }

    .apexcharts-legend-series {
        margin: 2px 4px !important;
    }

    .apexcharts-legend-text {
        font-size: 11px !important;
    }
}

@media (max-width: 576px) {
    .apexcharts-legend {
        position: relative !important;
        justify-content: center !important;
    }

    .apexcharts-legend-series {
        display: inline-flex !important;
        margin: 2px !important;
    }

    .apexcharts-legend-text {
        font-size: 10px !important;
    }

    .apexcharts-datalabels-group text {
        font-size: 10px !important;
    }
}

/* Stat card row: every KPI card on one row at desktop, wraps 2-up then 1-up on narrow screens */
.dashboard-grid.stat-row {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

@media (max-width: 992px) {
    .dashboard-grid.stat-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 400px) {
    .dashboard-grid.stat-row {
        grid-template-columns: 1fr;
    }
}
