/* --- Admin Drag & Drop Styles (Keep these) --- */
.post-type-reference .column-hrp_order { width: 60px; text-align: center; }
.post-type-reference .column-hrp_logo { width: 120px; }
.post-type-reference .column-hrp_logo,
.post-type-reference .column-hrp_order { vertical-align: middle; }
.hrp-drag-handle { cursor: grab; color: #888; font-size: 24px; width: 100%; text-align: center; display: inline-block; }
.ui-sortable-helper .hrp-drag-handle { cursor: grabbing; }
.wp-list-table-sortable-placeholder { height: 60px; background-color: #f0f6fc; border: 2px dashed #0073aa; }

/* --- NEW FRONT-END STYLES for Flip Animation --- */
#hrp-references-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    text-align: center;
}

.hrp-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 50px;

    /* ADDED: Hide scrollbar for cleaner mobile look */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
/* ADDED: Hide scrollbar for Chrome, Safari, and Opera */
.hrp-filters::-webkit-scrollbar {
    display: none;
}


.hrp-filter-btn {
    background-color: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 22px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s ease;
    color: #555;
    flex-shrink: 0; /* ADDED: Prevents buttons from shrinking on mobile */
}

.hrp-filter-btn:hover {
    background-color: #f7f7f7;
    border-color: #0073aa;
}

.hrp-filter-btn.active {
    border-color: #0073aa;
    color: #0073aa;
    font-weight: bold;
}

.hrp-grid-wrapper {
    position: relative;
}

.hrp-references-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    position: relative; /* Important for positioning calculations */
}

.hrp-reference-item {
    background-color: #fff;
    border-radius: 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 120px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    
    /* NEW Animation setup */
    opacity: 1;
    transform: none;
    transition: transform 0.5s ease, opacity 0.5s ease;
    will-change: transform, opacity;
}

/* A single class to hide elements before animation */
.hrp-hide {
    display: none;
}


.hrp-reference-item img {
    max-width: 100%;
    max-height: 90px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Category tags on reference items */
.hrp-item-categories {
    margin-top: 8px;
    padding: 0 5px;
}

.hrp-category-tag {
    display: inline-block;
    background-color: #0073aa;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    margin: 0 2px 2px 0;
    line-height: 1.4;
}

/* Pagination styles */
.hrp-pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.hrp-pagination button {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background-color: #ccc;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.3s ease;
}

.hrp-pagination button:hover {
    background-color: #aaa;
}

.hrp-pagination button.active {
    background-color: #0073aa;
}

/* ENSURE CATEGORIES VISIBLE IN REFERENCES VIEW */
.hrp-references-page .cat-links,
.hrp-references-page .post-categories,
.hrp-references-page .entry-meta .tags-links,
.hrp-references-page .entry-meta .cat-links {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Hide categories globally but show them in references view */
body:not(.hrp-references-page) .cat-links,
body:not(.hrp-references-page) .post-categories,
body:not(.hrp-references-page) .entry-meta .tags-links,
body:not(.hrp-references-page) .entry-meta .cat-links {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .hrp-references-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    /* Made filters scroll horizontally */
    .hrp-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
    }

    .hrp-references-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* MODIFIED FOR MOBILE: Make logo boxes shorter */
    .hrp-reference-item {
        height: 100px;
    }
    
    .hrp-reference-item img {
        max-height: 70px;
    }
}