/* Modern Color-Coded Manga Type Badges */
.manga-type-badge {
    display: inline-flex !important;
    align-items: center !important;
    padding: 4px 8px !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    letter-spacing: 0.3px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    opacity: 0.83 !important;
    visibility: visible !important;
    z-index: 10 !important;
}

.manga-type-badge:hover {
    opacity: 1 !important;
}

.manga-type-badge::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.manga-type-badge:hover::before {
    opacity: 1;
}

/* مانگا (Manga) */
.manga-type-manga {
    background: linear-gradient(135deg, #dc2626, #b91c1c, #991b1b) !important;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 3px 12px rgba(220, 38, 38, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 0 16px rgba(220, 38, 38, 0.2) !important;
}

/* مانهوا (Manhwa) */
.manga-type-manhwa {
    background: linear-gradient(135deg, #2563eb, #1d4ed8, #1e40af) !important;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 0 16px rgba(37, 99, 235, 0.2) !important;
}

/* مانها (Manhua) */
.manga-type-manhua {
    background: linear-gradient(135deg, #9333ea, #7e22ce, #6b21a8) !important;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 3px 12px rgba(147, 51, 234, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 0 16px rgba(147, 51, 234, 0.2) !important;
}

/* کمیک (Comic) */
.manga-type-comic {
    background: linear-gradient(135deg, #f59e0b, #d97706, #b45309) !important;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 3px 12px rgba(245, 158, 11, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 0 16px rgba(245, 158, 11, 0.2) !important;
}

.mz-card-ribbon-badges {
    display: contents;
}

/* Recent and newest cards share these compact mobile stats in rails and grids.
 * The wrapper occupies only the existing cover and takes no layout space. */
@supports (display: contents) {
    @media (max-width: 767.98px) {
        @font-face {
            font-family: 'MZ Ribbon Digits';
            src: url('../fonts/ribbon-condensed-digits.woff2') format('woff2');
            font-weight: 700;
            font-display: swap;
            unicode-range: U+002C, U+0030-0039;
        }

        .mz-card-ribbon-badges {
            position: absolute;
            inset: 0;
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            grid-auto-rows: max-content;
            align-content: start;
            justify-items: right;
            pointer-events: none;
        }

        /* The rail already offsets its type badge up by 3px. Match that spacing
         * in the archive without moving its type badge. */
        #manga-grid .mz-card-ribbon-badges {
            row-gap: 3px;
        }

        .mz-card-ribbon-badges > .mz-card-ribbon-type {
            position: static;
            grid-row: 1;
            margin: .5rem .5rem 0 0;
        }

        .mz-card-ribbon-badges > .mz-card-ribbon-stats {
            display: contents;
        }

        .mz-card-ribbon-badges .mz-card-ribbon-desktop {
            display: none;
        }

        .mz-card-ribbon-badges .mz-card-ribbon-mobile {
            display: inline;
        }

        .mz-card-ribbon-badges .mz-card-chip {
            z-index: 10;
            gap: 2px;
            border: 0 !important;
            box-shadow: none !important;
            -webkit-backdrop-filter: none !important;
            backdrop-filter: none !important;
            font: 700 10px/1 'MZ Ribbon Digits', 'Arial Narrow', sans-serif;
            font-variant-numeric: tabular-nums;
        }

        .mz-card-ribbon-badges .mz-card-ribbon-number {
            min-inline-size: 0;
            overflow-wrap: anywhere;
        }

        .mz-card-ribbon-badges .mz-card-ribbon-chapters {
            position: absolute;
            left: 0;
            bottom: 8px;
            max-inline-size: 100%;
            padding: 3px 9px 3px 4px;
            border-left: 1px solid #905942 !important;
            border-radius: 0;
            background: linear-gradient(155deg, #f6c09b, #d89a74) !important;
            color: #362219;
            font-size: 11px;
            clip-path: polygon(0 0, 100% 0, calc(100% - 5px) 50%, 100% 100%, 0 100%);
        }

        .mz-card-ribbon-badges .mz-card-ribbon-likes {
            grid-row: 2;
            max-inline-size: calc(100% - 1rem);
            margin-right: .5rem;
            padding: 2px 3px;
            border-radius: 12px;
            background: #412923 !important;
            color: #ffe0cd;
        }

        .mz-card-ribbon-badges .mz-card-chip svg {
            flex: none;
            width: 9px;
            height: 9px;
            color: inherit;
        }

        .mz-card-ribbon-badges .mz-card-ribbon-chapters svg {
            order: 1;
        }

        .mz-card-ribbon-badges .mz-card-ribbon-likes svg {
            width: 8.5px;
            height: 8.5px;
        }
    }
}
