/*
 * YourDailyDrive — Widget Stylesheet
 *
 * Shared styles for all YourDailyDrive embed widgets.
 * All rules are scoped under .ydd-widget to avoid conflicts with the host site.
 *
 * Widgets:
 *   .ydd-car-cards  — Promo car grid (promo.js)
 */

/* ── Reset / base ─────────────────────────────────────────────────────────── */

.ydd-widget *,
.ydd-widget *::before,
.ydd-widget *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.ydd-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #222;
    -webkit-font-smoothing: antialiased;
}

/* ── Car cards grid ───────────────────────────────────────────────────────── */

.ydd-widget .ydd-car-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* ── Individual card ──────────────────────────────────────────────────────── */

.ydd-widget .ydd-car-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ydd-widget .ydd-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ydd-widget a.ydd-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* ── Car image ────────────────────────────────────────────────────────────── */

.ydd-widget .ydd-car-img {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #f5f5f5;
}

.ydd-widget .ydd-car-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.ydd-widget a.ydd-card:hover .ydd-car-img img {
    transform: scale(1.03);
}

.ydd-widget .ydd-no-image {
    width: 100%;
    height: 100%;
    background: #ebebeb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24' fill='none' stroke='%23bbb' stroke-width='1.5'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E") center / 48px no-repeat;
}

/* ── Status banner (corner label over image) ──────────────────────────────── */

.ydd-widget .ydd-band {
    position: absolute;
    top: 12px;
    left: 0;
    padding: 4px 12px 4px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff;
    z-index: 2;
    pointer-events: none;
    /* small right-angle tail on the right side */
    clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 50%, 100% 100%, 0 100%);
}

.ydd-widget .ydd-band--new      { background: #27ae60; }
.ydd-widget .ydd-band--promo    { background: #e74c3c; }
.ydd-widget .ydd-band--sold     { background: #555;    }
.ydd-widget .ydd-band--ordered  { background: #e67e22; }
.ydd-widget .ydd-band--inoption { background: #8e44ad; }
.ydd-widget .ydd-band--expected { background: #2980b9; }

/* ── Card content ─────────────────────────────────────────────────────────── */

.ydd-widget .ydd-car-content {
    padding: 14px 14px 10px;
    flex: 1;
}

.ydd-widget .ydd-car-title {
    margin-bottom: 8px;
}

.ydd-widget .ydd-car-title h2 {
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.ydd-widget .ydd-car-title h3 {
    display: block;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

/* ── Specs row ────────────────────────────────────────────────────────────── */

.ydd-widget .ydd-car-specs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 0;
    font-size: 12px;
    color: #555;
}

.ydd-widget .ydd-car-specs span {
    white-space: nowrap;
}

/* Bullet separator between spec items */
.ydd-widget .ydd-car-specs i {
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #bbb;
    margin: 0 6px;
    vertical-align: middle;
    font-style: normal;
}

/* ── Server-rendered specs blocks ─────────────────────────────────────────── */

.ydd-widget .ydd-main-specs,
.ydd-widget .ydd-other-specs {
    font-size: 12px;
    color: #555;
    margin-top: 4px;
}

.ydd-widget .ydd-main-specs span,
.ydd-widget .ydd-other-specs span {
    display: inline;
    white-space: nowrap;
}

/* ── Card footer: price + CTA ─────────────────────────────────────────────── */

.ydd-widget .ydd-car-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 14px;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
}

.ydd-widget .ydd-price-group {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.ydd-widget .ydd-price {
    font-size: 17px;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
}

/* Applied when displayPrice is a text label (e.g. "Price on request" or "Sold") */
.ydd-widget .ydd-price.ydd-price-text {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.ydd-widget .ydd-vat-desc {
    font-size: 11px;
    font-weight: 400;
    color: #999;
    white-space: nowrap;
}

.ydd-widget .ydd-monthly-price {
    font-size: 12px;
    font-weight: 400;
    color: #666;
    white-space: nowrap;
}

/* Arrow CTA icon */
.ydd-widget .ydd-car-cta {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s, background 0.2s;
}

.ydd-widget a.ydd-card:hover .ydd-car-cta {
    border-color: #111;
    background: #111;
}

.ydd-widget .ydd-car-cta::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-top:   1.5px solid #666;
    border-right: 1.5px solid #666;
    transform: rotate(45deg) translate(-1px, 1px);
    transition: border-color 0.2s;
}

.ydd-widget a.ydd-card:hover .ydd-car-cta::after {
    border-color: #fff;
}

/* ── Slider mode ───────────────────────────────────────────────────────────── */

/* Outer wrapper — extra horizontal padding lets the Slick arrows breathe */
.ydd-widget .ydd-car-slider {
    margin: 0 -10px; /* compensate for inner card padding so edge cards align */
}

/* Give each slide internal gutter — Slick doesn't support gap natively */
.ydd-widget .ydd-car-slider .ydd-car-card {
    padding: 0 10px;
}

/* Equal heights across all slides — stretch track to tallest card */
.ydd-widget .ydd-car-slider .slick-track {
    display: flex;
}

.ydd-widget .ydd-car-slider .slick-slide {
    height: auto;
    display: flex;
    flex-direction: column;
}

.ydd-widget .ydd-car-slider .slick-slide > div {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
}

/* Dots live below the track; give the widget enough room */
.ydd-widget .ydd-car-slider.slick-dotted.slick-slider {
    margin-bottom: 36px;
}

/* Custom prev / next arrow buttons */
.ydd-widget .ydd-slick-prev,
.ydd-widget .ydd-slick-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.10);
    color: #333;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ydd-widget .ydd-slick-prev:hover,
.ydd-widget .ydd-slick-next:hover {
    background: rgba(0, 0, 0, 0.22);
    color: #000;
}

.ydd-widget .ydd-slick-prev.slick-disabled,
.ydd-widget .ydd-slick-next.slick-disabled {
    opacity: 0.3;
    cursor: default;
}

/* Position arrows outside the slider track */
    .ydd-widget .ydd-slick-prev {
        left: -44px;
    }
.ydd-widget .ydd-slick-next { right: -44px; left:auto;}

/* Dot colour */
.ydd-widget .slick-dots li button:before {
    color: #ccc;
    font-size: 8px;
}

.ydd-widget .slick-dots li.slick-active button:before {
    color: #111;
}

/* ── Loading skeleton ─────────────────────────────────────────────────────── */

@keyframes ydd-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}

.ydd-widget .ydd-skeleton .ydd-card {
    pointer-events: none;
}

.ydd-widget .ydd-skel-block,
.ydd-widget .ydd-skel-line {
    background: linear-gradient(90deg, #ebebeb 25%, #f5f5f5 50%, #ebebeb 75%);
    background-size: 800px 100%;
    animation: ydd-shimmer 1.4s infinite;
    border-radius: 4px;
}

.ydd-widget .ydd-skeleton .ydd-car-img {
    aspect-ratio: 16 / 10;
    border-radius: 0;
}

.ydd-widget .ydd-skel-line {
    height: 14px;
    margin-bottom: 8px;
    width: 90%;
}

.ydd-widget .ydd-skel-line--title {
    height: 16px;
    width: 75%;
    margin-bottom: 10px;
}

.ydd-widget .ydd-skel-line--short {
    width: 50%;
}

/* ── States ───────────────────────────────────────────────────────────────── */

.ydd-widget .ydd-empty,
.ydd-widget .ydd-error {
    padding: 24px;
    text-align: center;
    font-size: 14px;
    color: #777;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    background: #fafafa;
}

.ydd-widget .ydd-error {
    color: #c0392b;
    background: #fff5f5;
    border-color: #f5c6c6;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .ydd-widget .ydd-car-cards {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 14px;
    }
}

@media (max-width: 420px) {
    .ydd-widget .ydd-car-cards {
        grid-template-columns: 1fr;
    }
}
