﻿/*
* Contains all global CSS overrides for RadzenDataGrid, moved from site.css.
*/

:root {
    /* DataGrid */
    --rz-grid-background-color: var(--color-card-bg);
    --rz-grid-header-background-color: var(--color-background);
    --rz-grid-header-color: var(--color-text-secondary);
    --rz-grid-header-border-color: var(--color-border);
    --rz-grid-row-background-color: var(--color-card-bg);
    --rz-grid-row-stripe-background-color: var(--color-background); /* Swapped for darker base */
    --rz-grid-row-hover-background-color: var(--color-border);
    --rz-grid-row-color: var(--color-text-primary);
    --rz-grid-row-border-color: var(--color-border);

    /* Pager */
    --rz-paginator-background-color: var(--color-background);
    --rz-paginator-color: var(--color-text-secondary);
    --rz-paginator-button-hover-background-color: var(--color-border);
    --rz-paginator-button-active-background-color: var(--color-accent);
    --rz-paginator-button-active-color: var(--color-text-primary);
}

.pretty-radzen-grid .rz-grid-table tfoot td.numeric-cell-padding {
    padding-right: 24px !important;
}

/* Apply text-align: right ONLY on screens wider than the mobile breakpoint */
@media (min-width: 769px) {
    .pretty-radzen-grid .rz-grid-table tfoot td.numeric-cell-padding {
        text-align: right;
    }
}

/* Dark theme for Radzen Grid Footer */
.rz-grid-table tfoot {
    background-color: var(--color-background); /* Darker footer bg */
}

.rz-grid-table tfoot td {
    color: var(--color-text-primary);
    font-weight: bold;
    border-top: 2px solid var(--color-accent) !important; /* Separator line */
    border-bottom: none !important;
}

/* --- START: Mobile Responsive Override for .pretty-radzen-grid --- */
/*
 * This override replaces the default Radzen stacking with a 
 * "card" style view on mobile, inspired by the HistoricalStations footer.
*/
@media (max-width: 768px) {

    /* 1. Hide the table header, as labels will be in each cell */
    .pretty-radzen-grid .rz-grid-table thead {
        display: none;
    }

    .live-sessions-grid .rz-grid-table tbody td .rz-cell-data > div {
        /* 1. Swap visual order: Text first, Icon second */
        flex-direction: row-reverse !important;

        /* 2. Align to the Right (Start of the reversed row) */
        justify-content: flex-start !important;

        /* 3. Ensure container fills the width */
        width: 100% !important;
    }

    .influx-stats-grid .station-cell {
        /* 1. Swap visual order: Text first, Image/Dot second */
        flex-direction: row-reverse !important;

        /* 2. Align to the Right (Start of the reversed row) */
        justify-content: flex-start !important;

        /* 3. Ensure container fills the width to allow alignment */
        width: 100% !important;
    }

    /* 2. Turn each row into a distinct "card" */
    .pretty-radzen-grid .rz-grid-table tbody tr {
        display: block;
        background-color: transparent; /* MODIFICATION: No card background */
        border: 1px solid var(--color-border);
        border-radius: 12px;
        margin-bottom: 0.75rem; /* Space between cards */
        padding: 0.5rem 0.75rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    /* 3. Make each cell a flex row (Label vs Value) */
    .pretty-radzen-grid .rz-grid-table tbody td {
        display: flex !important; /* Override Radzen's !important */
        justify-content: flex-start;
        align-items: baseline;
        padding: 0.6rem 0.25rem !important; /* Override Radzen padding */
        border-bottom: 1px dashed var(--color-border); /* Separator *inside* the card */
        text-align: left !important;
        white-space: normal; /* Allow wrapping */
        font-size: 0.85em;
        color: darkgray;
        border-radius: 5px;
    }

    /* 4. Last cell in card gets no border */
    .pretty-radzen-grid .rz-grid-table tbody td:last-child {
        border-bottom: none;
    }

    /* 5. Style the Label (Radzen's ::before pseudo-element) */
    .pretty-radzen-grid .rz-grid-table tbody td::before {
        content: attr(data-label); /* Radzen provides this */
        font-weight: 600;
        color: var(--color-text-secondary); /* Label color */
        padding-right: 1rem;
        text-align: left; /* Label align */
        flex-shrink: 0; /* Don't let the label shrink */
    }

    /* 6. Style the Value (Radzen's .rz-cell-data span) */
    .pretty-radzen-grid .rz-grid-table tbody td .rz-cell-data {
        padding-right: 6px;
        flex-grow: 1; /* MODIFICATION: Allow value to fill space */
        word-break: break-word;
        font-weight: 600;
        color: var(--color-text-primary); /* Value color */
        padding-left: 8px;
        text-align: right; /* MODIFICATION: Align value to the right */
    }

    /* 7. --- START: Updated Icon Cell Styling --- */

    /* 7a. Center the image container (rz-cell-data) */
    .pretty-radzen-grid .rz-grid-table tbody td:first-child {
        background: transparent !important;
        justify-content: center; /* Center the flex item */
        border-bottom: none; /* No separator line under the image */
        margin-bottom: 0.5rem; /* Add space below the image */
        padding-bottom: 0.25rem !important;
    }

    /* 7b. The cell data wrapper itself doesn't need 100% width */
    .pretty-radzen-grid .rz-grid-table tbody td:first-child .rz-cell-data {
        text-align: center;
        width: auto; /* Let it be the size of the image */
        flex-grow: 0; /* Don't let it grow */
    }

    /* 7c. Hide the label for the icon cell */
    .pretty-radzen-grid .rz-grid-table tbody td:first-child::before {
        display: none;
    }

    /* 7d. [NEW] Hide the entire cell if it's empty (no image) */
    .pretty-radzen-grid .rz-grid-table tbody td:first-child:empty {
        display: none !important;
    }

    /* --- END: Updated Icon Cell Styling --- */

    /* 8. Make the data container a simple block */
    .pretty-radzen-grid .rz-data-grid-data {
        overflow-x: hidden; /* No horizontal scroll */
    }

    /* 9. Give the pager some space */
    .pretty-radzen-grid .rz-paginator-bottom {
        margin-top: 8px;
    }
}
/* --- END: Mobile Responsive Override --- */