/* =============================================
   TYRE COMPARE TABLE
   Component: inc/components/tyre-compare/
   ============================================= */

/* Wrapper - horizontal scroll on mobile */
.dg-compare-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -25px;
    padding: 0 25px;
}
@media (min-width: 992px) {
    .dg-compare-wrapper {
        overflow-x: scroll;
        margin: 0;
        padding: 0;
    }
}

/* Table base */
.dg-compare-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    font-size: 16px;
}

/* Header row - tyre images + names */
.dg-compare-table thead th {
    vertical-align: top;
    padding: 20px 15px;
    text-align: center;
    font-weight: 700;
    font-style: italic;
    border: none;
    position: relative;
}
.dg-compare-table thead th:first-child {
    width: 220px;
    min-width: 180px;
}
.dg-compare-table thead th .dg-compare-img {
    display: block;
    max-width: 180px;
    height: 250px;
    object-fit: contain;
    margin: 0 auto 15px;
    padding-left: 12.5px;
    padding-right: 12.5px;
}
.dg-compare-table thead th .dg-compare-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 18px;
    color: #999;
    line-height: 1;
}
.dg-compare-table thead th .dg-compare-remove:hover {
    color: #333;
}
.dg-compare-table thead th .dg-compare-name {
    font-size: 16px;
    font-weight: 900;
    font-style: normal;
    text-transform: none;
}

/* Body rows */
.dg-compare-table tbody tr {
    border: none;
}
.dg-compare-table tbody tr:nth-child(even) {
    background-color: #f7f8fa;
}
.dg-compare-table tbody td {
    padding: 18px 15px;
    text-align: center;
    vertical-align: middle;
    border-right: 1px solid #e8e8e8;
}
.dg-compare-table tbody td:last-child {
    border-right: none;
}
.dg-compare-table thead th {
    border-right: 1px solid #e8e8e8;
}
.dg-compare-table thead th:first-child,
.dg-compare-table thead th:last-child {
    border-right: none;
}
.dg-compare-table tbody td:first-child {
    border-right: none;
}
.dg-compare-table tbody td:first-child {
    text-align: left;
    font-weight: 700;
    position: sticky;
    left: 0;
    background-color: inherit;
    z-index: 1;
}
/* Inherit bg for sticky column on even rows */
.dg-compare-table tbody tr:nth-child(even) td:first-child {
    background-color: #f7f8fa;
}
.dg-compare-table tbody tr:nth-child(odd) td:first-child {
    background-color: #fff;
}

/* Empty slot (5th column placeholder) */
.dg-compare-table .dg-compare-empty {
    opacity: 0.3;
}
.dg-compare-table .dg-compare-empty .dg-compare-img {
    filter: grayscale(1);
    opacity: 0.5;
}

/* =============================================
   RATING: A-E letter badges
   ============================================= */
.dg-rating-letters {
    display: inline-flex;
    gap: 7.5px;
    align-items: center;
}
.dg-rating-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    font-style: normal;
    color: var(--wp--preset--color--secondary);
    background-color: var(--wp--preset--color--blue-gray);
}
.dg-rating-letter.is-active {
    background-color: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--secondary);
}

/* =============================================
   RATING: Dot rating (1-5)
   ============================================= */
.dg-rating-dots {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}
.dg-rating-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: var(--wp--preset--color--blue-gray);
}
.dg-rating-dot.is-filled {
    background-color: var(--wp--preset--color--primary);
}

/* =============================================
   MOBILE: Slick slider - one card per tyre
   ============================================= */

/* Navigation buttons */
.dg-compare-nav {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}
.dg-compare-nav button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--wp--preset--color--secondary);
    background: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dg-compare-nav button:disabled {
    opacity: 0.3;
    cursor: default;
}
.dg-compare-nav span {
    font-size: 14px;
    font-weight: 600;
}

/* Mobile slider container */
.dg-compare-mobile {
    display: none;
}

/* Single tyre card in slider */
.dg-compare-card {
    padding: 0 5px;
}
.dg-compare-card-header {
    text-align: center;
    padding: 20px 15px;
    position: relative;
}
.dg-compare-card-header .dg-compare-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
}
.dg-compare-card-header .dg-compare-remove img {
    width: 18px;
    height: 18px;
    max-width: none;
}
.dg-compare-card-header img {
    max-width: 200px;
    height: 200px;
    object-fit: contain;
    margin: 0 auto 15px;
    display: block;
}
.dg-compare-card-header .dg-compare-name {
    font-size: 16px;
    font-weight: 900;
    font-style: normal;
    text-transform: none;
}

/* Attribute rows inside card */
.dg-compare-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
}
.dg-compare-card-row:nth-child(even) {
    background-color: #f7f8fa;
}
.dg-compare-card-label {
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: 15px;
}
.dg-compare-card-value {
    font-size: 14px;
    text-align: right;
}
@media (max-width: 399px) {
    .dg-compare-card-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .dg-compare-card-label {
        margin-right: 0;
        margin-bottom: 3px;
    }
    .dg-compare-card-value {
        text-align: left;
    }
}

/* Slick overrides - scoped to compare slider */
.dg-compare-mobile .slick-track {
    display: flex;
}
.dg-compare-mobile .slick-slide {
    height: auto !important;
}
.dg-compare-mobile .slick-slide > div {
    height: auto !important;
}
/* Hide default slick arrows - we use custom nav */
.dg-compare-mobile .slick-arrow {
    display: none !important;
}
/* Hide default slick dots */
.dg-compare-mobile .slick-dots {
    display: none !important;
}

@media (max-width: 991px) {
    .dg-compare-table {
        display: none;
    }
    .dg-compare-mobile {
        display: block;
    }
    .dg-compare-nav {
        display: flex;
    }
    .dg-rating-letter {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
    .dg-rating-dot {
        width: 12px;
        height: 12px;
    }
}

/* =============================================
   Compare lockers / tabs (task 266)
   Vertailukorin lokerointi vehicle_typen mukaan: välilehdet näkyvät kun
   korissa on >=2 ajoneuvotyyppiä (sidebar-paneeli ja teeman footer-drawer).
   Plugin-JS tuottaa markupin näillä luokilla; piilotetut lokerot
   [hidden]-attribuutilla.
   ============================================= */
.dg-compare-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.dg-compare-tab-btn {
    flex: 0 1 auto;
    padding: 6px 12px;
    border: 1px solid #d0d3d8;
    border-radius: 999px;
    background: #fff;
    color: #333;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
}
.dg-compare-tab-btn:hover {
    border-color: var(--wp--preset--color--primary, #999);
}
.dg-compare-tab-btn.is-active {
    background: var(--wp--preset--color--primary, #1a1a1a);
    border-color: var(--wp--preset--color--primary, #1a1a1a);
    color: var(--wp--preset--color--secondary, #fff);
}
/* Lokero-panelit: piilotetut [hidden]-attribuutilla (sidebar div, drawer li). */
.dg-compare-locker[hidden],
.dg-compare-drawer__item[hidden] {
    display: none;
}
