/* ============================================================
   Medal Items Manager – Frontend Styles
   Compatible with Astra Theme
   ============================================================ */

/* ---------- Category Navigation Menu ---------- */
.mim-cat-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 28px;
    padding: 0;
    list-style: none;
}

.mim-cat-link {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none !important;
    color: #555;
    background: #f4f4f4;
    border: 2px solid transparent;
    transition: all .2s ease;
    white-space: nowrap;
}

.mim-cat-link:hover {
    background: #e8e8e8;
    color: #222;
    text-decoration: none !important;
}

.mim-cat-link.active {
    background: #c9972a;
    color: #fff !important;
    border-color: #c9972a;
}

/* Astra overrides — stop theme from adding underlines */
.mim-cat-nav a,
.mim-cat-nav a:visited,
.mim-cat-nav a:hover,
.mim-cat-nav a:focus {
    text-decoration: none !important;
    box-shadow: none !important;
}

/* ---------- Grid Wrapper ---------- */
.mim-grid-wrap {
    width: 100%;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* ---------- Item Grid ---------- */
.mim-sc-grid {
    display: grid;
    gap: 28px;
    margin: 0 !important;
    padding: 0 !important;
    padding-left: 0 !important;
    list-style: none;
}

/* Astra theme injects padding-left on ul inside .entry-content on category/archive pages */
.entry-content .mim-sc-grid,
.entry-content ul.mim-sc-grid,
.ast-article-post .mim-sc-grid,
.ast-article-post ul.mim-sc-grid,
article .mim-sc-grid,
article ul.mim-sc-grid {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

/* Column variants */
.mim-cols-2 .mim-sc-grid { grid-template-columns: repeat(2, 1fr); }
.mim-cols-3 .mim-sc-grid { grid-template-columns: repeat(3, 1fr); }
.mim-cols-4 .mim-sc-grid { grid-template-columns: repeat(4, 1fr); }
.mim-cols-5 .mim-sc-grid { grid-template-columns: repeat(5, 1fr); }
.mim-cols-6 .mim-sc-grid { grid-template-columns: repeat(6, 1fr); }

/* Default (no class): 4 columns */
.mim-sc-grid:not(.mim-cols-2 .mim-sc-grid):not(.mim-cols-3 .mim-sc-grid) {
    grid-template-columns: repeat(4, 1fr);
}

/* ---------- Individual Item Card ---------- */
.mim-sc-item {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.mim-item-inner {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    transition: transform .2s ease, box-shadow .2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.mim-item-inner:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(0,0,0,.14);
}

.mim-sc-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.mim-sc-name {
    padding: 10px 12px 12px;
    font-size: .875rem;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin: 0;
    line-height: 1.3;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Pagination ---------- */
.mim-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid #eee;
}

.mim-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none !important;
    color: #555;
    background: #f4f4f4;
    border: 2px solid transparent;
    transition: all .15s ease;
}

.mim-page-btn:hover {
    background: #e4e4e4;
    color: #222;
    text-decoration: none !important;
}

.mim-page-btn.active {
    background: #c9972a;
    color: #fff !important;
    border-color: #c9972a;
    pointer-events: none;
}

/* Astra: remove theme link styles from pagination */
.mim-pagination a,
.mim-pagination a:visited,
.mim-pagination a:hover {
    text-decoration: none !important;
    box-shadow: none !important;
}

/* ---------- Empty state ---------- */
.mim-sc-empty {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 40px 0;
}

/* ---------- Responsive ---------- */
@media ( max-width: 1024px ) {
    .mim-cols-5 .mim-sc-grid,
    .mim-cols-6 .mim-sc-grid { grid-template-columns: repeat(4, 1fr); }
}

@media ( max-width: 768px ) {
    .mim-cols-4 .mim-sc-grid,
    .mim-cols-5 .mim-sc-grid,
    .mim-cols-6 .mim-sc-grid { grid-template-columns: repeat(3, 1fr); }
    .mim-sc-grid { gap: 16px; }
}

@media ( max-width: 540px ) {
    .mim-sc-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
    .mim-cat-nav { gap: 6px; }
    .mim-cat-link { padding: 6px 14px; font-size: .8rem; }
}

@media ( max-width: 360px ) {
    .mim-sc-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
}

/* Pagination dots */
.mim-page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 40px;
    color: #aaa;
    font-size: .875rem;
    pointer-events: none;
}

/* ── Hide page title on pages that use medal shortcodes ──
   Astra theme uses .entry-title for the page/post heading.
   Add class "mim-hide-title" to the page body via page settings,
   OR use the [medal_hide_title] shortcode at the top of the page.  */
.mim-hide-title .entry-title,
.mim-hide-title .page-title,
.mim-hide-title .ast-page-title,
.mim-hide-title h1.entry-title {
    display: none !important;
}

/* ════════════════════════════════════════
   MEDAL CATEGORY SIDEBAR WIDGET – Dark Theme
   ════════════════════════════════════════ */

/* ── CSS Variables ── */
.mim-sidebar-widget {
    --sid-bg:           #1a1a2e;
    --sid-bg2:          #16213e;
    --sid-gold:         #c9972a;
    --sid-gold-light:   #e0b84a;
    --sid-gold-dim:     #a07520;
    --sid-text:         #d0cfc8;
    --sid-text-muted:   #8a8a9a;
    --sid-active-text:  #c9972a;
    --sid-hover-bg:     rgba(201, 151, 42, 0.07);
    --sid-active-left:  3px solid #c9972a;
    --sid-count-bg:     #2a2a42;
    --sid-count-active: #c9972a;

    font-family: inherit;
    background: var(--sid-bg);
    border-radius: 10px;
    overflow: hidden;
    /* no extra bottom padding — widget is tight */
}

/* ── Title bar ── */
.mim-sidebar-widget-title {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--sid-gold);
    margin: 0;
    padding: 14px 18px 13px;
    background: #F7FFF9;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: none;
}

/* Folder icon before title */
.mim-sidebar-widget-title::before {
    content: '🗂';
    font-size: .85rem;
    flex-shrink: 0;
}

/* ── List Reset ── */
.mim-sidebar-cat-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;       /* zero — no gap top or bottom */
}

.mim-sidebar-cat-list li {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    border-bottom: 1px solid rgba(255,255,255,.04);
}

.mim-sidebar-cat-list li:last-child {
    border-bottom: none;
}

.mim-sidebar-cat-list li::before,
.mim-sidebar-cat-list li::after {
    display: none !important;
    content: none !important;
}

/* ── Links ── */
.mim-sidebar-cat-link {
    display: flex !important;
    align-items: center;
    gap: 0;
    padding: 12px 18px;
    text-decoration: none !important;
    color: #fff!important;
    font-size: .875rem;
    font-weight: 400;
    letter-spacing: .01em;
    transition: background .15s ease, color .15s ease, border-left .15s ease;
    box-shadow: none !important;
    outline: none;
    border-left: 3px solid transparent;
    position: relative;
    line-height: 1;
}

/* Remove the old dot pseudo-element */
.mim-sidebar-cat-link::before {
    display: none !important;
    content: none !important;
}

/* No right arrow pseudo-element */
.mim-sidebar-cat-link::after {
    display: none !important;
    content: none !important;
}

/* ── Hover state ── */
.mim-sidebar-cat-link:hover {
    background: var(--sid-hover-bg) !important;
    color: #fff !important;
    border-left: var(--sid-active-left);
    text-decoration: none !important;
}

/* ── Active state ── */
.mim-sidebar-cat-link.active {
    background: rgba(201, 151, 42, 0.10) !important;
    color: var(--sid-active-text) !important;
    font-weight: 600 !important;
    border-left: var(--sid-active-left);
    text-decoration: none !important;
    box-shadow: none !important;
}

/* ── Name span ── */
.mim-sidebar-cat-name {
    flex: 1;
    line-height: 1.2;
}

/* ── Count badge ── */
.mim-sidebar-cat-count {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 600;
    color: var(--sid-text-muted);
    background: var(--sid-count-bg);
    border-radius: 20px;
    padding: 2px 8px;
    min-width: 24px;
    letter-spacing: .02em;
    transition: background .15s, color .15s;
    margin-left: auto;
}

.mim-sidebar-cat-link:hover .mim-sidebar-cat-count {
    background: rgba(201, 151, 42, 0.25);
    color: var(--sid-gold-light);
}

.mim-sidebar-cat-link.active .mim-sidebar-cat-count {
    background: var(--sid-count-active);
    color: #fff;
}

/* ── Astra / theme resets ── */
.widget .mim-sidebar-cat-list li {
    list-style: none !important;
}
.widget .mim-sidebar-cat-list a {
    text-decoration: none !important;
    box-shadow: none !important;
}
