.ref-shortcode-wrapper,
.ref-shortcode-wrapper * { box-sizing: border-box; }

.ref-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.ref-tab {
    appearance: none;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 700;
    color: #4b5563;
    border-radius: 999px;
    transition: all 0.25s ease;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.ref-tab:hover,
.ref-tab.active {
    background: #111827;
    color: #fff;
    border-color: #111827;
    transform: translateY(-1px);
}

.ref-dropdown-wrap { position: relative; display: inline-block; }

.ref-dropdown-toggle {
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 700;
    color: #4b5563;
    border-radius: 999px;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.ref-dropdown-toggle:hover,
.ref-dropdown-toggle.active-dropdown {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.ref-dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 420px;
    background: #fff;
    border: 1px solid #edf0f4;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.25s ease;
    z-index: 99;
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
}

.ref-dropdown-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }

.ref-dropdown-menu .ref-tab.dropdown-item {
    text-align: left;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 650;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: none;
}

.ref-count { font-size: 11px; color: #9ca3af; margin-left: 8px; }
.ref-tab:hover .ref-count,
.ref-tab.active .ref-count { color: rgba(255,255,255,.75); }

.ref-dropdown-menu::-webkit-scrollbar { width: 6px; }
.ref-dropdown-menu::-webkit-scrollbar-track { background: #f8fafc; border-radius: 8px; }
.ref-dropdown-menu::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }

.ref-grid-container {
    display: grid;
    grid-template-columns: repeat(var(--aay-ref-columns, 6), minmax(0, 1fr));
    gap: 16px;
}

.ref-item {
    display: block;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ref-item.hide,
.ref-item.load-hidden { display: none !important; }

.ref-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,.92);
    border: 1px solid #edf0f4;
    border-radius: 18px;
    overflow: hidden;
    text-decoration: none !important;
    color: inherit;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

.ref-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 55px rgba(15, 23, 42, 0.12);
    border-color: rgba(227, 0, 15, 0.22);
}

.ref-card-static:hover { transform: none; }

.ref-logo-wrap {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    padding: 18px;
    height: 112px;
    text-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ref-logo-wrap img {
    width: auto !important;
    height: auto !important;
    max-width: 78%;
    max-height: 74px;
    object-fit: contain;
    mix-blend-mode: multiply;
    display: block;
}

.ref-logo-fallback {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #111827;
    color: #fff;
    font-size: 24px;
    font-weight: 800;
}

.ref-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ref-card:hover .ref-overlay { opacity: 1; }

.ref-overlay-text {
    color: #fff;
    text-align: center;
    font-weight: 700;
    font-size: 12px;
    line-height: 1.35;
}

.ref-overlay-text svg { width: 19px; height: 19px; margin-bottom: 4px; }

.ref-content {
    min-height: 92px;
    padding: 12px 10px 14px;
    border-top: 1px solid #edf0f4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ref-cats { margin-bottom: 7px; }

.ref-cat-badge {
    display: inline-block;
    background: rgba(227, 0, 15, 0.08);
    color: #E3000F;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 1.2;
    font-weight: 800;
}

.ref-title {
    font-size: 12px;
    line-height: 1.35;
    margin: 0;
    color: #111827;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .01em;
}

.ref-desc {
    margin: 6px 0 0;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.35;
}

.aay-ref-load-wrap {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

.aay-ref-load-more {
    appearance: none;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 24px;
    border-radius: 999px;
    background: #E3000F;
    color: #fff;
    font-weight: 800;
    box-shadow: 0 16px 30px rgba(227, 0, 15, 0.22);
    transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}

.aay-ref-load-more:hover {
    background: #b9000c;
    transform: translateY(-2px);
    box-shadow: 0 20px 38px rgba(227, 0, 15, 0.28);
}

.aay-ref-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #6b7280;
    padding: 28px;
    border: 1px dashed #d1d5db;
    border-radius: 16px;
}

@media (max-width: 1400px) { .ref-grid-container { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .ref-grid-container { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 768px) {
    .ref-dropdown-menu { width: min(300px, calc(100vw - 32px)); grid-template-columns: 1fr; right: auto; left: 0; }
    .ref-grid-container { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    .ref-filter-tabs { justify-content: flex-start; gap: 8px; }
    .ref-tab, .ref-dropdown-toggle { padding: 9px 13px; font-size: 13px; }
    .ref-grid-container { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .ref-logo-wrap { height: 96px; padding: 14px; }
    .ref-content { min-height: 86px; }
}
