/* Shared styles for the AnimalInfo/Cow genomic, linear, and type screens (USA/CAN/GBR proofs). */

.border-radius-15 {
    border-radius: 15px;
}

.border-radius-50 {
    border-radius: 50px;
}

.border-primary {
    border: 1px solid #153d77;
}

.border-gray {
    border: 1px solid #cacaca;
}

.genomic-gradient {
    background: #eaf4fc;
    background: linear-gradient(90deg, #eaf4fc 0%, #f5f9fd 100%);
    background-clip: padding-box; /* Garante suavidade */
    -webkit-backface-visibility: hidden; /* Suaviza a renderização no Chrome/Safari */
    -webkit-transform: translateZ(0); /* Ativa a renderização via GPU */
    color: var(--rz-primary);
}

.rz-slider.rz-state-disabled .rz-slider-handle {
    background-color: white;
    border: 1px solid var(--rz-primary-light);
}

.rz-slider.rz-state-disabled .rz-slider-range {
    background-color: var(--rz-primary-light);
    border: var(--rz-slider-disabled-range-border);
}

.traits-wrapper > div {
    padding: 0.3rem 0;
}

    .traits-wrapper > div:nth-child(even) {
        background: #f8f8f8;
    }

.genomic-value-wrapper {
    padding: 0.1rem 0.2rem;
    border-radius: 0.5rem;
    border: 1px solid var(--rz-primary-light);
    min-width: 5rem;
    min-height: 1.3rem;
}

@media screen and (max-width: 1024px) {
    .animal-info-trait-row {
        min-width: 0;
    }

        .animal-info-trait-row > * {
            min-width: 0;
        }
}

/* Dairy Cow genomic trait cards (opt-in via .dairy-cow-traits): every row shares the same
   label | slider | value columns so value boxes line up, and the row adapts to the card's
   width (not the viewport) in three tiers. BeefOnDairy reuses the row classes without the
   opt-in class and keeps the flex layout above. */
.dairy-cow-traits {
    --cow-trait-value-w: 5rem;
    container: cow-traits / inline-size;
}

    .dairy-cow-traits > .animal-info-trait-row {
        display: grid !important;
        grid-template-columns: minmax(0, 30%) minmax(0, 1fr) var(--cow-trait-value-w);
        grid-template-areas: "label slider value";
        align-items: center;
        column-gap: 0.75rem;
        row-gap: 0.25rem;
        min-width: 0;
    }

        .dairy-cow-traits > .animal-info-trait-row > * {
            min-width: 0;
        }

        .dairy-cow-traits > .animal-info-trait-row > :first-child {
            grid-area: label;
            width: auto !important;
            overflow: hidden;
        }

            .dairy-cow-traits > .animal-info-trait-row > :first-child > .rz-text-truncate {
                min-width: 0;
                flex: 0 1 auto;
            }

            .dairy-cow-traits > .animal-info-trait-row > :first-child > :not(.rz-text-truncate) {
                flex-shrink: 0;
            }

        .dairy-cow-traits > .animal-info-trait-row > .fill-slider {
            grid-area: slider;
            width: auto !important;
            margin-top: 0;
        }

            .dairy-cow-traits > .animal-info-trait-row > .fill-slider > .rz-slider {
                flex: 1 1 0;
                width: auto;
                min-width: 0;
            }

        .dairy-cow-traits > .animal-info-trait-row > .genomic-value-wrapper {
            grid-area: value;
            width: 100%;
            min-width: 0;
            box-sizing: border-box;
        }

/* Medium card: single line, min/max bounds hidden. */
@container cow-traits (340px < width <= 420px) {
    .dairy-cow-traits > .animal-info-trait-row > .fill-slider > .slider-bound-label {
        display: none;
    }
}

/* Narrow card: label + value on the first line, slider with bounds full width below. */
@container cow-traits (width <= 340px) {
    .dairy-cow-traits > .animal-info-trait-row {
        grid-template-columns: minmax(0, 1fr) var(--cow-trait-value-w);
        grid-template-areas:
            "label value"
            "slider slider";
    }

        /* Rows without a slider (N/A / no range) don't keep an empty second line. */
        .dairy-cow-traits > .animal-info-trait-row:not(:has(> .fill-slider)) {
            grid-template-areas: "label value";
        }
}

/* USA Animal Info: evaluation date / test type badges (same look as the legacy headline pills). */
.dairy-cow-info-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.9rem;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.4;
    color: #153d77;
    white-space: nowrap;
}

/* USA Animal Info: "Information powered by" sits at the right of the Genomic/Pedigree/Linear tab
   strip (same height as the tab headers); on narrow viewports it moves above the tabs. */
.animal-info-tabs-wrapper {
    position: relative;
    margin-top: 1rem;
}

    .animal-info-tabs-wrapper > .animal-info-tabs-powered-by {
        position: absolute;
        top: 0;
        right: 1rem;
        z-index: 1;
        height: 3rem;
        white-space: nowrap;
    }

    .animal-info-tabs-wrapper > .animal-info-tabs .rz-tabview-nav {
        padding-right: 18rem;
    }

@media (max-width: 768px) {
    .animal-info-tabs-wrapper > .animal-info-tabs-powered-by {
        position: static;
        height: auto;
        justify-content: flex-end;
        padding: 0.5rem 1rem 0;
    }

    .animal-info-tabs-wrapper > .animal-info-tabs .rz-tabview-nav {
        padding-right: 0;
    }
}

/* Dairy Cow headline indexes (USA metric cards; CAN/GBR pills): stack when the card is too narrow
   so the value is never pushed out; titles truncate. */
.dairy-cow-main-traits {
    container: cow-main-traits / inline-size;
}

/* USA (4 pills): two per line. */
@container cow-main-traits (width <= 820px) {
    .dairy-cow-main-traits > .rz-col-md-3 {
        flex: 0 0 calc((100% - var(--rz-gap)) / 2) !important;
        max-width: calc((100% - var(--rz-gap)) / 2) !important;
    }
}

/* CAN/GBR (3 pills): one per line as soon as three don't fit side by side. */
@container cow-main-traits (width <= 680px) {
    .dairy-cow-main-traits > .rz-col-md-4 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* USA keeps two compact cards per line on phones (see DairyCowMetricCard); one per line only on very narrow screens. */
@container cow-main-traits (width <= 260px) {
    .dairy-cow-main-traits > [class*="rz-col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* BeefOnDairy Genomic Predictions header: the "Population Min / Max" title is dropped when the
   card is narrow (the rows hide or move the bounds there too); other titles truncate. */
.bod-genomic-header {
    container: bod-genomic-header / inline-size;
}

    .bod-genomic-header > .rz-stack > * {
        min-width: 0;
    }

@container bod-genomic-header (width <= 500px) {
    .bod-genomic-header .bod-genomic-header-bounds {
        display: none;
    }
}

/* Paper always uses the full single-line row: without a query container the tiers don't apply.
   A4 columns are narrow (~48%), so spacing is compacted to leave the slider a usable width. */
@media print {
    .dairy-cow-main-traits,
    .bod-genomic-header {
        container-type: normal;
    }

    .dairy-cow-traits {
        --cow-trait-value-w: 4rem;
        container-type: normal;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

        .dairy-cow-traits > .animal-info-trait-row {
            grid-template-columns: minmax(0, 25%) minmax(0, 1fr) var(--cow-trait-value-w);
            column-gap: 0.5rem;
        }

            .dairy-cow-traits > .animal-info-trait-row > .fill-slider > .slider-bound-label {
                flex-basis: 2.5rem;
                width: 2.5rem;
                font-size: 0.75rem;
            }
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

    .progress-header span {
        height: 15px;
        font-size: 0.7rem;
        display: inline;
        padding: 0 3px;
    }

.progress-track {
    height: 22px;
    background-color: #e0e0e0;
    display: flex;
    align-items: center;
}

    .progress-track.rotate {
        transform: rotate(180deg);
    }

.progress-fill {
    margin-left: 50%;
    background-color: #243b77;
    height: 70%;
}

    .progress-fill.arrow::before {
        content: "";
        display: block;
        width: 15px;
        height: 100%;
        border-left: 8px solid #243b77;
        border-top: 8px solid transparent;
        border-bottom: 8px solid transparent;
        margin-left: 100%;
    }

@media print {
    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    @page {
        display: block;
        margin: 10mm auto;
    }

    #accordionSidebar, #pageHeading, #myTab, .no-print {
        display: none !important;
    }

    #content {
        background: #fff;
    }

    .print-column-12 {
        width: 100% !important;
    }

    .print-column-8 {
        width: 66% !important;
    }

    .print-column-6 {
        width: 48% !important;
    }

    .print-column-4 {
        width: 32% !important;
    }

    /* Beef On Dairy Animal Info: on-screen the sections sit in RadzenCards, but in
       print they should read flat like the legacy report (no shadow/border/radius). */
    .bod-animal-info-card {
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }

    /* Keep the header fields (REG ID, Sire, ...) from being clipped with an ellipsis
       once the columns are constrained to the printed page width. */
    .bod-animal-info-header .rz-text-truncate {
        text-overflow: clip;
        white-space: normal;
        overflow: visible;
    }

    .container-slider > div > div {
        width: 20% !important;
    }

    .container-slider .fill-slider {
        width: 57% !important;
    }

    .animal-genomic-header-gradient {
        border: none !important;
    }
}

/* Beef Brahman Animal Info: colored descriptive cards (InfoCard), ported from the
   legacy BrahmanAnimalInfo page's inline <style> block. Theme is driven by the
   --header-color / --body-color / --text-color / --card-border custom properties
   set inline per card. */
.beef-brahman-info-card {
    border: 2px solid var(--card-border);
    border-radius: 18px;
    overflow: hidden;
    background: transparent;
    margin-bottom: 1rem;
}

.beef-brahman-info-card-header {
    background-color: var(--header-color);
    color: #fff;
    font-weight: 600;
    text-align: center;
    padding: 14px;
}

.beef-brahman-info-card-body {
    background-color: var(--body-color);
    padding: 18px;
}

.beef-brahman-info-card .item-title {
    font-weight: 700;
    color: var(--text-color);
}

.beef-brahman-info-card .item-text {
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.4;
}

.beef-brahman-info-card .item-info {
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.4;
    margin-top: 10px;
    font-style: italic;
}

.beef-brahman-info-card .divider {
    height: 1px;
    background-color: var(--text-color);
    margin: 14px 0;
}

/* STgenetics coin used as the favorable-allele icon on Beef / BxD Animal Info */
.stg-coin {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    animation: stg-coin-spin 4s linear infinite;
    will-change: transform;
}

/* Offset the second coin so a pair does not flip in lockstep */
.stg-coin + .stg-coin {
    animation-delay: -1s;
}

@keyframes stg-coin-spin {
    from {
        transform: perspective(200px) rotateY(0deg);
    }

    to {
        transform: perspective(200px) rotateY(360deg);
    }
}

/* Static coin on the report pages (Brahman, Brangus and BxD) */
.beef-brahman-report-print .stg-coin,
.beef-brangus-report-print .stg-coin,
.beef-on-dairy-report-print .stg-coin {
    animation: none;
    transform: none;
}

/* Static coin in the PDF and for users who prefer reduced motion */
@media print, (prefers-reduced-motion: reduce) {
    .stg-coin {
        animation: none;
        transform: none;
    }
}
