/* =========================================================
   MARS RATIOS
   ========================================================= */

.ratios-block {
    overflow: visible;
    width: 100%;
    margin-top: 28px;
}

.ratios-block + .ratios-block {
    margin-top: 32px;
}

.ratios-block-title {
    display: flex;
    align-items: center;

    min-height: 38px;

    margin-bottom: 16px;
    padding: 8px 14px;

    background: #f1f5f9;

    border-left: 3px solid #2875c7;
    border-radius: 6px;

    color: #1f2937;

    font-family: "Manrope", sans-serif;
    font-size: 14px;
    font-weight: 700;

    letter-spacing: 0.2px;
    text-transform: uppercase;
}

.ratios-grid {
    display: grid;
    overflow: visible;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}


/* ---------- CARD ---------- */

.ratio-card {
    position: relative;

    width: 100%;
    height: 145px;
    box-sizing: border-box;

    padding: 18px;

    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 15px;

    box-shadow:
        0 4px 12px rgba(15, 23, 42, 0.06);

    overflow: visible;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.ratio-card:hover {
    transform: translateY(-2px);

    box-shadow:
        0 8px 22px rgba(15, 23, 42, 0.10);
}

.ratio-card-clickable {
    cursor: pointer;
}

/* ---------- NAME ---------- */

.ratio-name {
    font-family: "Manrope", sans-serif;

    font-size: 13px;
    font-weight: 800;

    line-height: 1.35;

    color: #374151;

    max-width: 215px;

    margin-bottom: 8px;
}


/* ---------- MAIN VALUE ---------- */

.ratio-value {
    font-family: "Manrope", sans-serif;

    font-size: 30px;
    line-height: 1;

    font-weight: 700;

    color: #2875c7;

    letter-spacing: -1.2px;

    white-space: nowrap;
}

/* ---------- CHANGE ---------- */

.ratio-change {
    display: flex;
    align-items: center;
    gap: 5px;

    margin-top: 7px;

    font-family: "Manrope", sans-serif;

    font-size: 14px;
    font-weight: 600;

    color: #2875c7;
}

.ratio-arrow {
    display: inline-block;
    font-size: 17px;
    line-height: 1;
    font-weight: 600;
    color: #2875c7;
}


/* ---------- SPARKLINE PLACE ---------- */

.ratio-sparkline {
    position: absolute;

    right: 3px;
    bottom: 14px;

    width: 105px;
    height: 52px;

    pointer-events: none;
}

.ratio-sparkline-canvas {
    width: 100% !important;
    height: 100% !important;

    opacity: 0;
    clip-path: inset(0 100% 0 0);
}


.ratio-sparkline-canvas.ratio-sparkline-animate {
    animation:
        ratio-sparkline-draw 850ms ease-out forwards,
        ratio-sparkline-fade 650ms ease-out forwards;
}

.ratio-sparkline-canvas.ratio-sparkline-ready {
    opacity: 1;
    clip-path: inset(0 0 0 0);
}

@keyframes ratio-sparkline-draw {
    from {
        clip-path: inset(0 100% 0 0);
    }

    to {
        clip-path: inset(0 0 0 0);
    }
}


@keyframes ratio-sparkline-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* =========================================================
   TOOLTIP CARD
   ========================================================= */

.ratio-card[data-tooltip]::after {
    content: attr(data-tooltip);

    position: absolute;
    left: 70%;
    bottom: calc(100% + 10px);

    transform: translateX(-50%) translateY(4px);

    width: 300px;
    padding: 10px 12px;

    background: #1f2937;
    color: #ffffff;

    border-radius: 8px;

    font-family: "Manrope", sans-serif;
    font-size: 12px;
    line-height: 1.45;
    font-weight: 400;
    text-align: center;

    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(4px);

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

.ratio-card[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);

    transition-delay: 1s;
}
/* =========================================================
   RATIO DETAIL CHART
   ========================================================= */

.ratio-detail {
    display: none;

    width: 100%;
    box-sizing: border-box;

    margin-top: 28px;
    padding: 24px;

    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 15px;

    box-shadow:
        0 4px 12px rgba(15, 23, 42, 0.06);
}

.ratio-detail.active {
    display: block;
}


.ratio-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    margin-bottom: 20px;
}


.ratio-detail-title {
    font-family: "Manrope", sans-serif;

    font-size: 18px;
    font-weight: 700;

    color: #111827;
}


.ratio-detail-period {
    margin-top: 4px;

    font-family: "Manrope", sans-serif;

    font-size: 13px;
    font-weight: 500;

    color: #94a3b8;
}


.ratio-detail-close {
    width: 30px;
    height: 30px;

    border: none;
    background: transparent;

    font-size: 24px;
    line-height: 1;

    color: #94a3b8;

    cursor: pointer;

    border-radius: 6px;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.ratio-detail-close:hover {
    background: #f1f5f9;
    color: #2875c7;
}


.ratio-detail-chart {
    position: relative;

    width: 100%;
    min-width: 0;
    height: 300px;

    overflow: hidden;
}

.ratio-detail-chart canvas {
    display: block;

    width: 100% !important;
    max-width: 100% !important;
}

#ratios-business {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#ratios-main {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 1100px) {
    .ratios-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    .ratios-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 500px) {
    .ratios-grid {
        grid-template-columns: 1fr;
    }
}