/* ---------------------- */
/* Race Pricing Container */
/* ---------------------- */

/* Mobile-first: Stacked layout */
.mmp-pricing-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}
.mmp-pricing-container > .mmp-pricing-item:first-child {
    border-top: 1px solid #e0e0e0;
}
.mmp-price {
    font-weight: 600;
}
.mmp-date.passed,
.mmp-price.passed {
    color: #777779;
    text-decoration: line-through;
}

.mmp-pricing-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ---------------------- */
/* Multi-Race Table Styles */
/* ---------------------- */

.mmp-multi-race-table {
    display: grid;
    grid-template-columns: minmax(150px, 200px) repeat(
            var(--mmp-date-columns, 1),
            minmax(100px, 1fr)
        );
    border: 1px solid #e0e0e0;
    overflow: hidden;
    margin-top: 1rem;
}

.mmp-table-header {
    background-color: #f9f9f9;
    font-weight: 600;
    padding: 12px 14px;
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    text-align: center;
}

.mmp-race-name-header {
    text-align: left;
}

.mmp-table-header:last-child {
    border-right: none;
}

.mmp-race-name {
    background-color: #f9f9f9;
    font-weight: 600;
    padding: 12px 14px;
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    text-align: left;
    vertical-align: middle;
}

.mmp-price-cell {
    padding: 12px 14px;
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    text-align: center;
    background-color: #fff;
    vertical-align: middle;
}

.mmp-price-cell:last-child {
    border-right: none;
}

.mmp-no-price {
    color: #999;
    font-style: italic;
}

/* Passed styles for multi-race table */
.mmp-table-header.passed {
    background-color: #f2f2f2;
    background-image: linear-gradient(
        135deg,
        #c9c9c9 10%,
        #ebebeb 10%,
        #ebebeb 50%,
        #c9c9c9 50%,
        #c9c9c9 60%,
        #ebebeb 60%,
        #ebebeb 100%
    );
    background-size: 7.07px 7.07px;
    color: #777779;
}

.mmp-price-cell.passed {
    background-color: #ffffff;
    background-image: linear-gradient(
        135deg,
        #dedede 10%,
        #ffffff 10%,
        #ffffff 50%,
        #dedede 50%,
        #dedede 60%,
        #ffffff 60%,
        #ffffff 100%
    );
    background-size: 7.07px 7.07px;
    color: #777779;
    text-decoration: line-through;
}

/* Mobile responsive for multi-race table */
@media (max-width: 767px) {
    .mmp-multi-race-table {
        display: block;
        font-size: 14px;
        border: none;
        margin-top: 1rem;
    }

    .mmp-table-header {
        display: none;
    }

    .mmp-race-name {
        display: block;
        background-color: #f9f9f9;
        font-weight: 600;
        padding: 12px;
        border: 1px solid #e0e0e0;
        border-bottom: none;
        margin-top: 15px;
    }

    .mmp-race-name:first-of-type {
        margin-top: 0;
    }

    .mmp-price-cell {
        display: block;
        padding: 8px 12px;
        border: 1px solid #e0e0e0;
        border-top: none;
        background-color: #fff;
        position: relative;
    }

    .mmp-price-cell:last-child {
        border-bottom: 1px solid #e0e0e0;
    }

    /* Add date labels on mobile using CSS data attributes */
    .mmp-price-cell::before {
        content: attr(data-date);
        font-weight: 600;
        color: #666;
        margin-right: 10px;
    }
}

@media (max-width: 1024px) {
    .mmp-pricing-container {
        font-size: 14px;
    }

    .mmp-multi-race-table {
        font-size: 12px;
    }

    .mmp-table-header,
    .mmp-race-name,
    .mmp-price-cell {
        padding: 8px 10px;
    }
}

/* Desktop: Grid layout - Single Race */
@media (min-width: 768px) {
    .mmp-pricing-container:not(.mmp-multi-race-table) {
        display: grid;
        grid-template-columns: repeat(var(--mmp-tier-count, auto-fill), 1fr);
        grid-template-rows: auto auto;
        border: 1px solid #e0e0e0;
        overflow: hidden; /* For border-radius if added */
    }
    .mmp-pricing-item {
        display: contents; /* Core of the grid trick */
        border: none;
        padding: 0;
    }
    .mmp-pricing-container:not(.mmp-multi-race-table)
        > .mmp-pricing-item:first-child {
        border-top: none;
    }
    .mmp-date {
        grid-row: 1;
        text-align: left;
        padding: 10px 14px;
        background-color: #f9f9f9 !important;
        border-bottom: 1px solid #e0e0e0;
        border-right: 1px solid #e0e0e0;
    }
    .mmp-price {
        grid-row: 2;
        text-align: left;
        padding: 10px 14px;
        background-color: #fff !important;
        border-right: 1px solid #e0e0e0;
    }
    .mmp-pricing-item:last-child .mmp-date,
    .mmp-pricing-item:last-child .mmp-price {
        border-right: none;
    }

    /* Passed styles for desktop grid - Single Race */
    .mmp-date.passed {
        background-color: #f2f2f2;
        background-image: linear-gradient(
            135deg,
            #c9c9c9 10%,
            #ebebeb 10%,
            #ebebeb 50%,
            #c9c9c9 50%,
            #c9c9c9 60%,
            #ebebeb 60%,
            #ebebeb 100%
        );
        background-size: 7.07px 7.07px;
        text-decoration: none;
    }
    .mmp-price.passed {
        background-color: #ffffff;
        background-image: linear-gradient(
            135deg,
            #dedede 10%,
            #ffffff 10%,
            #ffffff 50%,
            #dedede 50%,
            #dedede 60%,
            #ffffff 60%,
            #ffffff 100%
        );
        background-size: 7.07px 7.07px;
        text-decoration: none;
    }
}
