
/***********************************************************************************
 * Responsive Adjustments for Color List
 * Applies to: page-colors.php
 * Breakpoints: Mobile (<768px), Tablet (768px–1023px), Desktop (≥1024px)
 ***********************************************************************************/

/* TEST BANNER

html::before {
    content: '✔ responsive.css ACTIVE';
    display: block;
    background: green;
    color: white;
    padding: 6px;
    text-align: center;
    font-weight: bold;
}

*/

/* Mobile (<768px) */
@media (max-width: 767px) {

    /* Navigation */
    .color-list-nav-bar {
        flex-direction: column;
        align-items: center; /* Center nav items */
        gap: 12px;
    }

    .color-list-nav-bar-cell {
        flex: 1 1 auto;
        width: 100%;
        display: flex;
        justify-content: center; /* Center buttons inside cell */
    }

    .color-list-nav-bar-cell.search {
        order: 99;
    }

    .color-list-search-wrapper {
        flex-direction: column;
        align-items: center;
    }

    #colorListSearch {
        width: 100%;
        max-width: 320px;
    }

    #clearColorListSearch {
        right: 12px;
    }

    /* Table Layout */
    .color-list-content-container {
        display: block;
    }

    .color-list-content-row {
        display: flex;
        flex-direction: column;
        padding: 12px;
        border-radius: 10px;
    }

    .color-list-content-cell {
        width: 100%;
        text-align: left;
        padding: 6px 0;
        margin: 0;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    /* Show only first three cells on mobile */
    .color-list-content-cell:nth-child(n+4) {
        display: none;
    }

    .color-list-content-row .color-list-swatch-container {
        height: 60px;
    }

    .color-list-content-row .color-list-swatch {
        height: 60px;
        width: 100%;
    }

    .color-list-hex,
    .color-list-rgb {
        display: inline-block;
        font-size: 14px;
        width: auto;
        max-width: 100%;
    }

    /* Optional: truncate text properly in first cell */
    .color-list-content-cell:first-child {
        font-weight: bold;
    }
}

/* Tablet (768px–1023px) */
@media (min-width: 768px) and (max-width: 1023px) {

    /* Navigation */
    .color-list-nav-bar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .color-list-nav-bar-cell {
        flex: 1 1 calc(50% - 12px);
        justify-content: center;
        min-width: 160px;
    }

    .color-list-nav-bar-cell.search {
        flex: 1 1 100%;
        order: 99;
    }

    #colorListSearch {
        width: 100%;
    }

    /* Table Layout */
    .color-list-content-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .color-list-content-row {
        display: grid;
        grid-template-columns: 30% 30% 40%;
        align-items: center;
    }

    .color-list-content-cell:nth-child(4),
    .color-list-content-cell:nth-child(5),
    .color-list-content-cell:nth-child(6) {
        display: none;
    }
}

/* Desktop (≥1024px) */
@media (min-width: 1024px) {

    /* Reset Navigation */
    .color-list-nav-bar {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .color-list-nav-bar-cell {
        flex: 0 0 auto;
    }

    /* Restore Table Layout */
    .color-list-content-container {
        display: grid;
        gap: 10px;
    }

    .color-list-content-row {
        display: grid;
        grid-template-columns: 20% 48% 14% 6% 6% 6%;
    }

    .color-list-content-cell {
        display: block;
    }
}
