/* ==========================================
   GalacticRAVE Image Library
========================================== */

.image-library-controls {
    position: relative;
    z-index: 5;
    margin: 0 0 2rem;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.image-library-filter-form {
    display: grid;
    grid-template-columns:
        minmax(120px, 1fr)
        minmax(125px, 1fr)
        minmax(125px, 1fr)
        minmax(120px, 0.95fr)
        74px
        118px
        72px;
    column-gap: 0.65rem;
    align-items: end;
}

.image-library-filter {
    display: block;
    min-width: 0;
}

.image-library-filter span {
    display: block;
    margin-bottom: 0.22rem;
    color: #607086;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.065em;
    text-transform: uppercase;
}

.image-library-filter select {
    box-sizing: border-box;
    display: block;
    width: 100%;
    height: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0 1.8rem 0 0.6rem;
    border: 1px solid rgba(3, 21, 48, 0.13);
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.78);
    color: #2f3d4f;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: normal;
    text-overflow: ellipsis;
    box-shadow: none;
}

.image-library-filter select:hover {
    background-color: rgba(255, 255, 255, 0.95);
}

.image-library-filter select:focus {
    border-color: #086afe;
    background-color: #ffffff;
    outline: 2px solid rgba(8, 106, 254, 0.1);
    outline-offset: 1px;
}

/* Equipment popover */

.image-library-equipment {
    position: relative;
    align-self: end;
    width: 118px;
    min-width: 118px;
    margin: 0;
}

.image-library-equipment-toggle {
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0 0.65rem;
    border: 1px solid rgba(3, 21, 48, 0.13);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.78);
    color: #2f3d4f;
    font-family: inherit !important;
    font-size: 0.9rem !important;
    font-weight: 400 !important;
    line-height: normal !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    cursor: pointer;
    box-shadow: none;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.image-library-equipment-toggle:hover,
.image-library-equipment-toggle:focus,
.image-library-equipment.is-open .image-library-equipment-toggle {
    border-color: rgba(8, 106, 254, 0.45);
    background: #ffffff;
    color: #086afe;
    outline: none;
}

.image-library-equipment.is-active .image-library-equipment-toggle {
    border-color: #086afe;
    color: #086afe;
}

.image-library-equipment-toggle .chevron {
    flex-shrink: 0;
    font-family: inherit;
    font-size: 0.75rem;
    line-height: 1;
    transition: transform 0.18s ease;
}

.image-library-equipment.is-open .chevron {
    transform: rotate(180deg);
}

.image-library-equipment-panel {
    position: absolute;
    top: calc(100% + 0.55rem);
    right: 0;
    z-index: 20;
    width: min(320px, 85vw);
    padding: 1rem;
    border: 1px solid rgba(3, 21, 48, 0.12);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 14px 36px rgba(3, 21, 48, 0.18);
}

.image-library-equipment-panel[hidden] {
    display: none;
}

.image-library-equipment-panel .image-library-filter + .image-library-filter {
    margin-top: 0.85rem;
}

/* Clear action */

.image-library-filter-actions {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: stretch;
    align-self: end;
    width: 72px;
    height: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0;
}

.image-library-filter-reset {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 36px;
    margin: 0;
    padding: 0 0.5rem;
    border: 1px solid rgba(3, 21, 48, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.58);
    color: #2f3d4f;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: normal;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: none;
}

.image-library-filter-reset:hover,
.image-library-filter-reset:focus {
    border-color: rgba(8, 106, 254, 0.5);
    background: #ffffff;
    color: #086afe;
    text-decoration: none;
    outline: none;
}

/* Pagination */

.image-library-pagination {
    margin: 3rem 0 0;
    text-align: center;
}

.image-library-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 42px;
    margin: 0 0.15rem;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    background: #ffffff;
    color: #2f3d4f;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(3, 21, 48, 0.08);
}

.image-library-pagination .page-numbers.current {
    background: #086afe;
    color: #ffffff;
}

.image-library-pagination a.page-numbers:hover,
.image-library-pagination a.page-numbers:focus {
    background: #f4f8fc;
    color: #086afe;
    text-decoration: none;
}

/* Empty state */

.image-library-empty {
    padding: 3rem 2rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.7);
    text-align: center;
    box-shadow: 0 4px 16px rgba(3, 21, 48, 0.06);
}

.image-library-empty h2 {
    margin-top: 0;
}

/* Tablet */

@media (max-width: 900px) {
    .image-library-filter-form {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .image-library-equipment {
        width: 100%;
        min-width: 0;
    }

    .image-library-equipment-panel {
        right: auto;
        left: 0;
    }

    .image-library-filter-actions {
        width: 100%;
    }
}

/* Narrow tablet and mobile */

@media (max-width: 700px) {
    .image-library-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 500px) {
    .image-library-filter-form {
        grid-template-columns: 1fr;
    }

    .image-library-equipment-toggle {
        width: 100%;
    }

    .image-library-equipment-panel {
        position: static;
        width: 100%;
        margin-top: 0.55rem;
    }

    .image-library-filter-actions {
        width: 100%;
        height: 36px;
    }
}

/* GR IMAGE LIBRARY SORT CONTROLS BEGIN */

/*
 * Redistribute the desktop filter row:
 *
 * - slightly reduce the first four taxonomy/meta controls;
 * - give Year enough room for its four-digit values;
 * - reserve a readable width for the new Sort control.
 */
@media (min-width: 1100px) {
    .image-library-filter-form {
        grid-template-columns:
            minmax(0, 0.95fr)
            minmax(0, 0.95fr)
            minmax(0, 0.95fr)
            minmax(0, 0.95fr)
            minmax(84px, 0.52fr)
            minmax(126px, 0.76fr)
            auto
            auto;
    }

    .image-library-filter--year select {
        min-width: 84px;
    }

    .image-library-filter--sort select {
        min-width: 126px;
    }
}

@media (max-width: 1099px) {
    .image-library-filter--year,
    .image-library-filter--sort {
        min-width: 0;
    }
}

/* GR IMAGE LIBRARY SORT CONTROLS END */

/* GR IMAGE LIBRARY SORT LABEL BEGIN */

.gr-image-card-link {
    position: relative;
    display: block;
}

.gr-image-sort-label {
    position: absolute;
    top: 0.7rem;
    left: 0.7rem;
    z-index: 2;
    max-width: calc(100% - 1.4rem);
    padding: 0.32rem 0.55rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.25rem;
    background: rgba(12, 18, 27, 0.78);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

/* GR IMAGE LIBRARY SORT LABEL END */

