.metrics {
    margin-bottom: 1rem;

    &__title {
        margin-bottom: 0.5rem;
        padding: 0 1.5rem;
        color: var(--text);
        font-weight: 600;
        font-size: var(--h2);
    }

    &__grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1rem;
    }

    &__item {
        min-width: 0;
    }
}

.metric {
    @extend .blur-bg;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    height: 100%;
    background-color: var(--transp-1);
    border: 1px solid var(--transp-1);
    border-radius: var(--border05);
    transition: transform var(--transition),
        background-color var(--transition);
    overflow: hidden;

    &::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(45deg, transparent 0%, var(--transp-1) 100%);
        opacity: 0;
        transition: opacity var(--transition);
    }

    &:hover {
        transform: translateY(-2px);

        &::before {
            opacity: 1;
        }

        .metric__icon {
            transform: scale(1.1);

            .metric__icon-svg {
                color: var(--accent);
            }
        }
    }

    &__header {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }

    &__icon {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: var(--h6);
        transition: all var(--transition);
    }

    &__icon-svg {
        color: var(--text-200);
        transition: color var(--transition);
    }

    &__label {
        font-size: var(--p);
        font-weight: 500;
        color: var(--text-400);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    &__content {
        margin-top: auto;
        position: relative;
        z-index: 1;
    }

    &__main {
        display: flex;
        align-items: flex-end;
        gap: 0.75rem;
    }

    &__value {
        font-size: var(--h3);
        font-weight: 600;
        color: var(--text);
        line-height: 1.2;
        letter-spacing: -0.02em;
    }

    &__trend {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        font-size: var(--small);
        font-weight: 500;
        padding: 0.2rem 0.35rem;
        border-radius: 5px;
        margin-bottom: 0.35rem;
        transition: transform var(--transition);

        &:hover {
            transform: translateY(-1px);

            .metric__trend-icon {
                transform: scale(1.1);
            }
        }

        &--up {
            color: var(--success);
            background-color: var(--success-light);
        }

        &--down {
            color: var(--error);
            background-color: var(--error-light);
        }
    }

    &__trend-icon {
        width: 1rem;
        height: 1rem;
        transition: transform var(--transition);
    }
}

@media (max-width: 768px) {
    .metrics {
        &__grid {
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 0.75rem;
        }
    }

    .metric {
        padding: 1rem;

        &__header {
            margin-bottom: 0.75rem;
            gap: 0.5rem;
        }

        &__icon {
            width: 2rem;
            height: 2rem;
        }

        &__icon-svg {
            width: 1rem;
            height: 1rem;
        }

        &__main {
            gap: 0.5rem;
            flex-wrap: wrap;
        }

        &__trend {
            padding: 0.25rem 0.5rem;
        }
    }
}