/* CuspideScience Article Metrics — OJS 3.4.x */
.csm-metrics {
    margin: 1.25rem 0;
}

.csm-metrics__card {
    overflow: visible;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Override large theme heading rules inside article items. */
.obj_article_details .csm-metrics .csm-metrics__title,
.csm-metrics .csm-metrics__title {
    margin: 0 !important;
    padding: 0.72rem 0.9rem 0.65rem !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 1.12rem !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
}

.csm-metrics__summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.csm-metrics__stat {
    min-width: 0;
    padding: 0.9rem 0.5rem 0.8rem;
    text-align: center;
}

.csm-metrics--compact .csm-metrics__stat {
    padding-top: 0.72rem;
    padding-bottom: 0.68rem;
}

.csm-metrics__stat + .csm-metrics__stat {
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.csm-metrics__icon {
    display: block;
    width: 22px;
    height: 22px;
    margin: 0 auto 0.18rem;
    color: currentColor;
    opacity: 0.78;
}

.csm-metrics__icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.csm-metrics__number {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.csm-metrics__label {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.73rem;
    line-height: 1.2;
    opacity: 0.8;
}

.csm-metrics__label--with-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.22rem;
}

.csm-metrics__source {
    padding: 0 0.9rem 0.6rem;
    text-align: center;
    font-size: 0.68rem;
    line-height: 1.35;
    opacity: 0.65;
}

/* Accessible CSS-only information tooltips. */
.csm-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    cursor: help;
    outline: 0;
}

.csm-tooltip__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 1;
    opacity: 0.68;
}

.csm-tooltip__bubble {
    position: absolute;
    z-index: 50;
    left: 50%;
    bottom: calc(100% + 8px);
    width: min(260px, 72vw);
    padding: 0.5rem 0.6rem;
    transform: translateX(-50%);
    border-radius: 4px;
    background: #1f2933;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 400;
    line-height: 1.35;
    text-align: left;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

.csm-tooltip__bubble::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2933;
}

.csm-tooltip:hover .csm-tooltip__bubble,
.csm-tooltip:focus .csm-tooltip__bubble,
.csm-tooltip:focus-within .csm-tooltip__bubble {
    opacity: 1;
    visibility: visible;
}

.csm-countries {
    padding: 0.78rem 0.9rem 0.85rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.csm-countries__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin-bottom: 0.55rem;
}

.obj_article_details .csm-countries__heading h3,
.csm-countries__heading h3 {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    margin: 0 !important;
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
}

.csm-countries__count {
    flex: 0 0 auto;
    font-size: 0.68rem;
    opacity: 0.65;
}

.csm-countries__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.csm-countries__item + .csm-countries__item {
    margin-top: 0.45rem;
}

.csm-countries__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    font-size: 0.76rem;
    line-height: 1.25;
}

.csm-countries__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.csm-countries__flag {
    margin-right: 0.28rem;
}

.csm-countries__value {
    flex: 0 0 auto;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.csm-countries__bar {
    height: 3px;
    margin-top: 0.15rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
}

.csm-countries__bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: currentColor;
    opacity: 0.55;
}

.csm-countries__note {
    margin: 0.65rem 0 0;
    font-size: 0.67rem;
    line-height: 1.38;
    opacity: 0.62;
}

.csm-details {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.72rem;
}

.csm-details summary {
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    font-weight: 600;
    opacity: 0.75;
}

.csm-details summary:hover,
.csm-details summary:focus {
    opacity: 1;
}

.csm-details__body {
    padding: 0 0.9rem 0.75rem;
    line-height: 1.4;
    opacity: 0.75;
}

.csm-details__body p {
    margin: 0.35rem 0 0;
}

/* Main-column variant can use slightly larger numbers. */
.csm-metrics--main:not(.csm-metrics--compact) .csm-metrics__number {
    font-size: 1.58rem;
}

@media (max-width: 480px) {
    .csm-metrics {
        margin-top: 1rem;
        margin-bottom: 1rem;
    }

    .csm-metrics__stat {
        padding-left: 0.3rem;
        padding-right: 0.3rem;
    }

    .csm-metrics__number {
        font-size: 1.18rem;
    }

    .csm-metrics__label {
        font-size: 0.67rem;
    }

    .csm-metrics__icon {
        width: 20px;
        height: 20px;
    }

    .csm-tooltip__bubble {
        position: fixed;
        z-index: 9999;
        left: 50%;
        bottom: 1rem;
        width: calc(100vw - 2rem);
        max-width: 360px;
        transform: translateX(-50%);
    }

    .csm-tooltip__bubble::after {
        display: none;
    }
}

@media (max-width: 340px) {
    .csm-metrics__summary {
        grid-template-columns: 1fr;
    }

    .csm-metrics__stat + .csm-metrics__stat {
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        border-left: 0;
    }

    .csm-metrics__stat {
        display: grid;
        grid-template-columns: 24px 1fr auto;
        align-items: center;
        gap: 0.45rem;
        padding: 0.6rem 0.8rem;
        text-align: left;
    }

    .csm-metrics__icon {
        margin: 0;
    }

    .csm-metrics__label--with-info {
        justify-content: flex-start;
    }
}
