/* ================================================================
   Dekkjahúsið Tire Search — tire-search.css

   Design philosophy:
   - Light, airy, clean — easy on the eyes for all ages
   - Moss green primary accent (matches site's forest/green identity)
   - Strong typography hierarchy — size → brand → name → price
   - High contrast text on all backgrounds (WCAG AA+)
   - Generous touch targets (52px+) on every interactive element
   - No heavy dark blocks — grey tints only where needed for depth
   ================================================================ */

/* ── Design tokens ───────────────────────────────────────────── */
.dts-wrap {
    --green:         #3a5c2e;   /* moss green — site accent */
    --green-mid:     #4a7040;
    --green-light:   #e8f2e4;   /* soft green tint */
    --green-border:  #b8d4b0;
    --sailun-green:  #1e6630;
    --red:           #9a0000;   /* site brand red — used sparingly */
    --gold:          #8a6200;   /* manufacturer label */
    --bg:            #f5f6f4;   /* page background — warm off-white */
    --surface:       #ffffff;   /* cards, inputs */
    --surface-2:     #f8f9f7;   /* footer, image bg */
    --border:        #dce3dc;
    --border-mid:    #c8d2c8;
    --text:          #111111;   /* near-black — max contrast */
    --text-mid:      #333333;
    --muted:         #525252;   /* WCAG AA on white */
    --radius:        10px;
    --radius-sm:     7px;
    --shadow-sm:     0 1px 4px rgba(0,0,0,.07);
    --shadow-card:   0 2px 8px rgba(0,0,0,.08);
    --shadow-hover:  0 8px 28px rgba(0,0,0,.13);

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    box-sizing: border-box;
    font-size: 16px;
    line-height: 1.5;
}
.dts-wrap *, .dts-wrap *::before, .dts-wrap *::after { box-sizing: inherit; }

/* ── Instruction text ────────────────────────────────────────── */
.dts-help-text {
    font-size: 15px;
    color: var(--muted);
    margin-bottom: 14px;
    line-height: 1.6;
}

/* ── Filter bar ──────────────────────────────────────────────── */
.dts-filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 4px solid var(--green);   /* green accent — not red */
    border-radius: var(--radius);
    padding: 22px 22px 16px;
    margin-bottom: 26px;
    box-shadow: var(--shadow-card);
}

.dts-filters__row {
    display: flex;
    flex-wrap: nowrap;
    gap: 14px;
    align-items: stretch;  /* all columns same height */
}

.dts-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 0;
    min-width: 0;          /* prevents overflow on small screens */
}

.dts-filter-group--reset {
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: flex-end;  /* button sits at bottom, aligned with selects */
}

/* Labels */
.dts-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--green);
    white-space: nowrap;
    user-select: none;
    height: 16px;            /* fixed label height — all columns identical */
    display: flex;
    align-items: center;
}

/* Selects — clean, large, easy to use */
.dts-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--surface-2)
        url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%233a5c2e' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E")
        no-repeat right 12px center;
    border: 1.5px solid var(--border-mid);
    border-radius: var(--radius-sm);
    padding: 0 36px 0 14px;  /* vertical padding via height — consistent across browsers */
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s;
    width: 100%;
    height: 52px;            /* fixed height — same for every dropdown always */
    line-height: 52px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dts-select:hover {
    border-color: var(--green-mid);
    background-color: #f2f6f0;
}
.dts-select:focus {
    outline: 3px solid rgba(58,92,46,.3);
    outline-offset: 1px;
    border-color: var(--green);
    background-color: var(--surface);
    box-shadow: 0 0 0 4px rgba(58,92,46,.08);
}
.dts-select option {
    background: #ffffff;
    color: var(--text);
    font-size: 16px;
}

/* Hint text */
.dts-field-hint {
    font-size: 12px;
    color: #7a8a7a;
    letter-spacing: .01em;
    display: block;
    height: 18px;            /* fixed hint height — consistent spacing below all selects */
    line-height: 18px;
}

/* Size indicator — only shows when something is selected */
.dts-size-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-size: 20px;
    font-weight: 800;
    color: var(--green);
    background: var(--green-light);
    border: 1.5px solid var(--green-border);
    padding: 5px 18px;
    border-radius: 24px;
    letter-spacing: .04em;
}
/* hidden by default — JS removes hidden attr only when a value is set */
.dts-size-indicator[hidden] { display: none !important; }

/* ── Reset / Hreinsa button ──────────────────────────────────── */
.dts-btn {
    padding: 0 20px;
    border: 1.5px solid var(--border-mid);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, transform .1s, opacity .15s;
    white-space: nowrap;
    line-height: 1.3;
    background: var(--surface-2);
    color: var(--text-mid);
    height: 52px;            /* exactly matches select height */
    letter-spacing: .01em;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dts-btn:hover:not(:disabled) {
    background: #eaf2e6;
    border-color: var(--green-mid);
    color: var(--green);
}
.dts-btn:focus {
    outline: 3px solid rgba(58,92,46,.3);
    outline-offset: 2px;
}
.dts-btn:active:not(:disabled) { transform: scale(.97); }

/* Disabled state — greyed out, no pointer */
.dts-btn:disabled {
    opacity: .42;
    cursor: not-allowed;
    color: #999;
    border-color: #ddd;
    background: #f5f5f5;
}

/* ── Results meta ────────────────────────────────────────────── */
.dts-results-meta {
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 16px;
    min-height: 20px;
}

/* ── Placeholder / empty state ───────────────────────────────── */
.dts-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 24px;
    color: var(--muted);
    font-size: 17px;
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
}

/* ── Loading ─────────────────────────────────────────────────── */
.dts-loading {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 70px 20px;
    font-size: 16px;
    color: var(--muted);
    gap: 14px;
}
.dts-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--border);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: dts-spin .65s linear infinite;
    flex-shrink: 0;
}
@keyframes dts-spin { to { transform: rotate(360deg); } }

/* ── Grid ────────────────────────────────────────────────────── */
.dts-grid {
    transition: opacity .2s ease;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
/* Tablet */
@media (min-width: 640px) {
    .dts-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
/* Desktop — 3 bigger cards instead of 4 small ones */
@media (min-width: 960px) {
    .dts-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
}
/* Wide desktop — 4 columns */
@media (min-width: 1200px) {
    .dts-grid { grid-template-columns: repeat(4, 1fr); gap: 22px; }
}

/* ── Card ────────────────────────────────────────────────────── */
.dts-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s, transform .18s, border-color .2s;
    position: relative;
}
.dts-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
    border-color: var(--green-border);
}

/* Sailun highlight */
.dts-card--sailun {
    border-color: #9ecfaa;
    background: linear-gradient(180deg, #eef8f1 0%, #fff 40%);
}

/* ── Season badge ────────────────────────────────────────────── */
.dts-card__season-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 3;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.dts-season-summer { background: #fffbe6; }
.dts-season-winter { background: #e6f2fb; }

/* ── Offer badge (Sailun) ────────────────────────────────────── */
.dts-card__offer-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--sailun-green);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 4px 10px;
    border-radius: 5px;
    z-index: 3;
}

/* ── Image — taller on desktop for bigger cards ──────────────── */
.dts-card__image-wrap {
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 160px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}
@media (min-width: 640px) { .dts-card__image-wrap { height: 180px; } }
@media (min-width: 960px)  { .dts-card__image-wrap { height: 200px; } }

.dts-card__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    transition: transform .3s;
    padding: 14px;
}
.dts-card:hover .dts-card__img { transform: scale(1.04); }
.dts-card__img--placeholder {
    padding: 12px 8px;
    opacity: .78;
}

/* ── Card body ───────────────────────────────────────────────── */
.dts-card__body {
    padding: 14px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

/* Size — most important, must be unmissable */
.dts-card__size {
    display: inline-block;
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    background: var(--green-light);
    border-radius: 6px;
    padding: 4px 11px;
    letter-spacing: .03em;
    line-height: 1.4;
    border-left: 3px solid var(--green);
    margin-bottom: 3px;
    align-self: flex-start;
}
@media (min-width: 480px) { .dts-card__size { font-size: 17px; } }
@media (min-width: 960px) { .dts-card__size { font-size: 18px; } }

/* Brand — gold, uppercase */
.dts-card__brand {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--gold);
}
.dts-card--sailun .dts-card__brand { color: var(--sailun-green); }

/* Name */
.dts-card__name {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
@media (min-width: 480px) { .dts-card__name { font-size: 14px; } }
@media (min-width: 960px) { .dts-card__name { font-size: 15px; } }

/* ── Card footer ─────────────────────────────────────────────── */
.dts-card__footer {
    padding: 11px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.dts-card__footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Price */
.dts-card__price {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
@media (min-width: 960px) { .dts-card__price { font-size: 20px; } }
.dts-card--sailun .dts-card__price { color: var(--sailun-green); }

.dts-card__offer-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--sailun-green);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: 2px;
}

/* Stock pills */
.dts-card__stock {
    font-size: 11px;
    font-weight: 700;
    border-radius: 5px;
    padding: 4px 10px;
    white-space: nowrap;
    line-height: 1.3;
    letter-spacing: .01em;
}
.dts-card__stock--in {
    background: var(--green-light);
    color: var(--green);
    border: 1px solid var(--green-border);
}
.dts-card__stock--out {
    background: #fce8e8;
    color: var(--red);
    border: 1px solid rgba(154,0,0,.18);
    font-size: 10px;
    padding: 4px 7px;
}

/* ── Pagination ──────────────────────────────────────────────── */
.dts-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 36px;
    flex-wrap: wrap;
}
.dts-page-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--border-mid);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.dts-page-btn:hover:not(:disabled) {
    background: var(--green-light);
    border-color: var(--green);
    color: var(--green);
}
.dts-page-btn:focus {
    outline: 3px solid rgba(58,92,46,.3);
    outline-offset: 2px;
}
/* Active page — dark bg, readable */
.dts-page-btn--active {
    background: var(--green);
    border-color: var(--green);
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
}
.dts-page-btn:disabled { opacity: .35; cursor: not-allowed; }
.dts-page-ellipsis {
    padding: 0 6px;
    color: var(--muted);
    font-size: 16px;
    line-height: 44px;
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .dts-filters__row { flex-wrap: wrap; gap: 10px; align-items: stretch; }
    /* Three selects side by side on mobile, each equal third */
    .dts-filter-group { flex: 1 1 calc(33.33% - 7px) !important; min-width: 0 !important; }
    .dts-filter-group--reset { flex: 1 1 100% !important; justify-content: flex-end; }
    .dts-filter-group--reset .dts-btn { width: 100%; }
    .dts-card__image-wrap { height: 130px; }
    .dts-card__body { padding: 10px 12px 8px; }
    .dts-card__footer { padding: 9px 12px; }
    /* Slightly smaller select text on mobile to fit 3 columns */
    .dts-select { font-size: 15px; padding: 0 28px 0 10px; }
    .dts-label { font-size: 10px; letter-spacing: 1px; }
}
@media (max-width: 360px) {
    .dts-grid { grid-template-columns: 1fr; }
    .dts-card__image-wrap { height: 200px; }
    .dts-filter-group { flex: 1 1 100% !important; }
}

/* ── Accessibility ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .dts-card, .dts-card__img, .dts-grid, .dts-spinner { transition: none; animation: none; }
}
