/* ═══════════════════════════════════════════════════════════════════════════
   TOP TRUMPS MACHINES — Frontend Styles v1.4.0
   Cards: FIXED pixel size (set via admin Settings → Card Design).
   Flexbox grid — Elementor/theme containers cannot stretch or squish cards.
═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variable Defaults (overridden by PHP inline style block) ────────── */
:root {
    --ttm-primary:     #ffc701;
    --ttm-card-bg:     #1a1a1a;
    --ttm-back-bg:     #0d0d0d;
    --ttm-btn-bg:      #ffc701;
    --ttm-btn-text:    #111111;
    --ttm-stat-label:  #999999;
    --ttm-stat-value:  #ffffff;
    --ttm-price-color: #ffc701;
    --ttm-font:        'Oswald', sans-serif;
    --ttm-card-radius: 14px;
    --ttm-card-width:  280px;
    --ttm-card-height: 720px;
    --ttm-transition:  0.65s cubic-bezier(0.4, 0.2, 0.2, 1.0);
}

/* ══════════════════════════════════════════════════════════════════════════
   WRAPPER
══════════════════════════════════════════════════════════════════════════ */
.ttm-wrapper {
    width: 100%;
    font-family: var(--ttm-font);
    /* Clip any accidental overflow from fixed-size cards */
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ══════════════════════════════════════════════════════════════════════════
   FILTER TRIGGER BUTTON (floating pill)
══════════════════════════════════════════════════════════════════════════ */
.ttm-filter-trigger-wrap {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.ttm-filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: #111111;
    color: var(--ttm-primary) !important;
    border: 2px solid var(--ttm-primary);
    border-radius: 50px;
    font-family: var(--ttm-font) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
    position: relative;
    text-decoration: none !important;
}

.ttm-filter-trigger:hover {
    background: var(--ttm-primary) !important;
    color: #111 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,199,1,0.35);
}

.ttm-filter-trigger:hover .ttm-filter-icon {
    stroke: #111;
}

.ttm-filter-icon {
    flex-shrink: 0;
    stroke: var(--ttm-primary);
    transition: stroke 0.2s;
}

.ttm-filter-trigger__label { line-height: 1; }

.ttm-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    background: var(--ttm-primary);
    color: #111 !important;
    border-radius: 50%;
    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1;
    letter-spacing: 0;
    flex-shrink: 0;
}

.ttm-filter-trigger.ttm-has-filters {
    background: var(--ttm-primary) !important;
    color: #111 !important;
    border-color: var(--ttm-primary) !important;
}
.ttm-filter-trigger.ttm-has-filters .ttm-filter-icon { stroke: #111 !important; }
.ttm-filter-trigger.ttm-has-filters .ttm-filter-badge { background: #111 !important; color: var(--ttm-primary) !important; }
.ttm-filter-trigger:hover .ttm-filter-badge { background: #111; color: var(--ttm-primary) !important; }

/* ══════════════════════════════════════════════════════════════════════════
   BACKDROP OVERLAY
══════════════════════════════════════════════════════════════════════════ */
.ttm-filter-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.ttm-filter-backdrop.ttm-drawer-open {
    opacity: 1;
    pointer-events: all;
}

/* ══════════════════════════════════════════════════════════════════════════
   SLIDE-IN FILTER DRAWER
══════════════════════════════════════════════════════════════════════════ */
.ttm-filter-drawer {
    position: fixed;
    top: 0; right: 0;
    width: 320px;
    max-width: 90vw;
    height: 100%;
    height: 100dvh;
    background: #111111;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 40px rgba(0,0,0,0.5);
    border-left: 2px solid #1e1e1e;
    overflow: hidden;
}
.ttm-filter-drawer.ttm-drawer-open {
    transform: translateX(0);
}

.ttm-filter-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px 16px;
    border-bottom: 1px solid #1e1e1e;
    background: #0d0d0d;
    flex-shrink: 0;
}

.ttm-filter-drawer__title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: var(--ttm-font) !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ttm-primary) !important;
}
.ttm-filter-drawer__title svg { stroke: var(--ttm-primary); flex-shrink: 0; }

.ttm-filter-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #888;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
    padding: 0;
}
.ttm-filter-drawer__close:hover { background: #2a2a2a; color: #fff; }

.ttm-filter-drawer__body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px 22px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.ttm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ttm-filter-group label {
    font-family: var(--ttm-font) !important;
    font-size: 10px !important;
    letter-spacing: 2.5px !important;
    text-transform: uppercase !important;
    color: var(--ttm-primary) !important;
    font-weight: 700 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

.ttm-filter-group select,
.ttm-filter-group input[type="number"] {
    background: #1a1a1a !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    border: 1px solid #2a2a2a !important;
    border-radius: 8px;
    padding: 12px 14px !important;
    font-size: 16px !important;        /* 16px prevents iOS zoom */
    font-family: var(--ttm-font) !important;
    transition: border-color 0.2s;
    box-shadow: none !important;
    width: 100%;
    box-sizing: border-box;
    min-height: 48px !important;
}
.ttm-filter-group select:focus,
.ttm-filter-group input[type="number"]:focus {
    outline: none !important;
    border-color: var(--ttm-primary) !important;
}
.ttm-filter-group select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffc701' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    padding-right: 36px !important;
}

.ttm-filter-drawer__footer {
    display: flex;
    gap: 10px;
    padding: 16px 22px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    border-top: 1px solid #1e1e1e;
    background: #0d0d0d;
    flex-shrink: 0;
}

.ttm-filter-drawer__reset {
    flex: 1;
    padding: 12px;
    background: transparent !important;
    border: 1px solid #2a2a2a !important;
    border-radius: 8px;
    color: #777 !important;
    font-family: var(--ttm-font) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px !important;
}
.ttm-filter-drawer__reset:hover { border-color: #555 !important; color: #ccc !important; }

.ttm-filter-drawer__apply {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--ttm-primary) !important;
    border: none !important;
    border-radius: 8px;
    color: #111 !important;
    font-family: var(--ttm-font) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px !important;
}
.ttm-filter-drawer__apply:hover { background: #ffd740 !important; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,199,1,0.35); }

/* ══════════════════════════════════════════════════════════════════════════
   CARD GRID — Flexbox, NOT CSS Grid
   Cards are fixed px size. This flex container just wraps them.
   No 1fr columns — Elementor/theme cannot affect card dimensions.
══════════════════════════════════════════════════════════════════════════ */
.ttm-grid {
    display: flex !important;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
    /* Let grid overflow-scroll horizontally on tiny screens rather than squish cards */
    overflow-x: auto;
    padding-bottom: 8px;
    box-sizing: border-box;
}

/* ══════════════════════════════════════════════════════════════════════════
   CARD WRAPPER — FIXED PIXEL SIZE
   width/height/flex are set to hardcoded px by PHP inline CSS block.
   These CSS-file rules are the fallback defaults only.
   !important in inline style wins over these, but both use same values.
══════════════════════════════════════════════════════════════════════════ */
.ttm-wrapper .ttm-card-wrapper {
    /* PHP inline CSS overrides these with !important — these are fallbacks */
    flex: 0 0 280px;
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    height: 720px;
    min-height: 720px;
    cursor: default;
    border-radius: var(--ttm-card-radius);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    box-sizing: border-box;
    position: relative;
    perspective: 1400px;
}

.ttm-wrapper .ttm-card-wrapper:hover {
    box-shadow: 0 5px 22px rgba(0,0,0,0.2);
    transform: translateY(-4px);
}

.ttm-wrapper .ttm-card-inner {
    /* PHP inline CSS also overrides these with exact px */
    width: 280px;
    height: 720px;
    transform-style: preserve-3d;
    transition: transform var(--ttm-transition);
    border-radius: var(--ttm-card-radius);
    position: relative;
    /* NEVER filter/drop-shadow here — destroys preserve-3d */
}

/* Flip via JS .ttm-flipped class ONLY */
.ttm-wrapper .ttm-card-wrapper.ttm-flipped .ttm-card-inner {
    transform: rotateY(180deg);
}

/* ── Card faces ─────────────────────────────────────────────────────────── */
.ttm-wrapper .ttm-card-front,
.ttm-wrapper .ttm-card-back {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--ttm-card-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* ══════════════════════════════════════════════════════════════════════════
   FRONT FACE
══════════════════════════════════════════════════════════════════════════ */
.ttm-wrapper .ttm-card-front {
    background: #1a1a1a !important;
    background-color: #1a1a1a !important;
    border: 2px solid #252525 !important;
    color: #ffffff !important;
}

/* Yellow header */
.ttm-wrapper .ttm-card-header {
    background: var(--ttm-primary) !important;
    background-color: #ffc701 !important;
    padding: 10px 13px 12px;
    flex-shrink: 0;
    margin: 0 !important;
}

.ttm-wrapper .ttm-card-header__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.ttm-wrapper .ttm-card-badge {
    font-size: 14px !important;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(0,0,0,0.4) !important;
    font-weight: 700 !important;
    line-height: 1;
    margin: 0 !important; padding: 0 !important;
}

.ttm-wrapper .ttm-card-type {
    background: #111 !important;
    color: var(--ttm-primary) !important;
    font-size: 8px !important;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 3px 8px !important;
    border-radius: 4px;
    font-weight: 700 !important;
    white-space: nowrap;
}

.ttm-wrapper .ttm-card-header__main {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px;
}

.ttm-wrapper .ttm-card-title {
    font-family: var(--ttm-font) !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    color: #111 !important;
    margin: 0 !important; padding: 0 !important;
    line-height: 1.15;
    flex: 1;
    min-width: 0;
}

.ttm-wrapper .ttm-card-year {
    display: block;
    font-size: 10px !important;
    font-weight: 400 !important;
    color: rgba(0,0,0,0.5) !important;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.ttm-wrapper .ttm-card-name {
    display: block;
    font-size: 17px !important;
    letter-spacing: 0.2px;
    color: #111 !important;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Stars — dark on yellow, fully visible */
.ttm-wrapper .ttm-stars-header {
    flex-shrink: 0;
    text-align: right;
}

.ttm-wrapper .ttm-condition-label-header {
    display: block;
    font-size: 7px !important;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(0,0,0,0.45) !important;
    font-weight: 700 !important;
    margin-bottom: 2px;
}

.ttm-wrapper .ttm-stars {
    display: flex;
    gap: 2px;
    justify-content: flex-end;
}

.ttm-wrapper .ttm-star {
    font-size: 14px !important;
    color: rgba(0,0,0,0.15) !important;
    line-height: 1;
}

.ttm-wrapper .ttm-star.active {
    color: #111 !important;
}

/* Square image — height = width of card */
.ttm-wrapper .ttm-card-media {
    position: relative;
    width: 100%;
    /* aspect-ratio makes it square: height always equals the card width */
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    background: #000 !important;
    overflow: hidden;
    margin: 0 !important; padding: 0 !important;
}

.ttm-wrapper .ttm-gallery-slider {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

.ttm-wrapper .ttm-slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    transition: opacity 0.45s ease;
}
.ttm-wrapper .ttm-slide.active { opacity: 1; }

.ttm-wrapper .ttm-slide img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block !important;
    margin: 0 !important; padding: 0 !important; border: none !important;
}

.ttm-wrapper .ttm-slide-controls {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
    z-index: 10;
}

.ttm-wrapper .ttm-slide-prev,
.ttm-wrapper .ttm-slide-next {
    background: rgba(255,199,1,0.9) !important;
    border: none !important;
    color: #111 !important;
    width: 28px; height: 28px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
    padding: 0 !important; line-height: 1;
}
.ttm-wrapper .ttm-slide-prev:hover,
.ttm-wrapper .ttm-slide-next:hover {
    background: var(--ttm-primary) !important;
    transform: scale(1.1);
}

.ttm-wrapper .ttm-slide-dots { display: flex; gap: 5px; align-items: center; }

.ttm-wrapper .ttm-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3) !important;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.ttm-wrapper .ttm-dot.active {
    background: var(--ttm-primary) !important;
    transform: scale(1.3);
}

.ttm-wrapper .ttm-no-image {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: #1e1e1e !important; color: #444 !important;
}
.ttm-wrapper .ttm-no-image span { font-size: 44px; }
.ttm-wrapper .ttm-no-image p { margin: 6px 0 0; font-size: 12px !important; color: #555 !important; }

/* Price bar */
.ttm-wrapper .ttm-price-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 13px;
    background: #0f0f0f !important;
    border-top: 3px solid var(--ttm-primary) !important;
    flex-shrink: 0;
    margin: 0 !important;
}

.ttm-wrapper .ttm-price-label {
    font-size: 9px !important;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #666 !important;
    font-weight: 700 !important;
}

.ttm-wrapper .ttm-price-value {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: var(--ttm-price-color) !important;
    letter-spacing: 0.3px;
    font-family: var(--ttm-font) !important;
    line-height: 1;
}

.ttm-wrapper .ttm-price-value span {
    font-size: 10px !important;
    color: #666 !important;
    font-weight: 400 !important;
    margin-left: 3px;
}

/* Stats */
.ttm-wrapper .ttm-card-stats {
    background: #1a1a1a !important;
    background-color: #1a1a1a !important;
    padding: 8px 13px 4px;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    color: #fff !important;
}

.ttm-wrapper .ttm-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #272727 !important;
    gap: 6px;
}
.ttm-wrapper .ttm-stat-row:last-of-type { border-bottom: none !important; }

.ttm-wrapper .ttm-stat-label {
    font-size: 10px !important;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--ttm-stat-label) !important;
    font-weight: 600 !important;
    flex-shrink: 0;
    display: flex; align-items: center; gap: 5px;
    margin: 0 !important; padding: 0 !important;
    white-space: nowrap;
}

.ttm-wrapper .ttm-stat-value {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: var(--ttm-stat-value) !important;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
    margin: 0 !important; padding: 0 !important;
}

.ttm-wrapper .ttm-notes {
    font-size: 11px !important;
    color: #ffff !important;
    font-style: italic;
    line-height: 1.3;
    letter-spacing: 1.5px;
    margin-top: 4px !important;
    padding-top: 4px !important;
    border-top: 1px solid #272727 !important;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Enquire Now button */
.ttm-wrapper .ttm-enquire-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px !important;
    background: var(--ttm-btn-bg) !important;
    background-color: #ffc701 !important;
    color: var(--ttm-btn-text) !important;
    border: none !important;
    border-top: 2px solid rgba(0,0,0,0.08) !important;
    font-family: var(--ttm-font) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    width: 100%;
    flex-shrink: 0;
    transition: background 0.2s, letter-spacing 0.2s;
    text-decoration: none !important;
    margin-top: auto;
    box-sizing: border-box;
}
.ttm-wrapper .ttm-enquire-btn:hover {
    background: #ffd740 !important;
    letter-spacing: 2.5px;
    color: #111 !important;
}
.ttm-wrapper .ttm-enquire-btn svg { transition: transform 0.2s; flex-shrink: 0; }
.ttm-wrapper .ttm-enquire-btn:hover svg { transform: translateX(4px); }

/* ══════════════════════════════════════════════════════════════════════════
   BACK FACE — ALL TEXT WHITE
══════════════════════════════════════════════════════════════════════════ */
.ttm-wrapper .ttm-card-back {
    background: var(--ttm-back-bg) !important;
    background-color: #0d0d0d !important;
    border: 2px solid #252525 !important;
    /* All text on back face defaults to white */
    color: #ffffff !important;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Back button */
.ttm-wrapper .ttm-back-btn {
    display: flex; align-items: center; gap: 5px;
    background: transparent !important; border: none !important;
    color: #777777 !important;
    font-family: var(--ttm-font) !important;
    font-size: 14px !important;
    letter-spacing: 1.5px; text-transform: uppercase;
    cursor: pointer;
    padding: 10px 14px 0 !important;
    transition: color 0.2s;
    align-self: flex-start; flex-shrink: 0;
    box-shadow: none !important;
}
.ttm-wrapper .ttm-back-btn:hover { color: var(--ttm-primary) !important; background: transparent !important; }

/* Back header */
.ttm-wrapper .ttm-back-header {
    padding: 4px 14px 14px;
    border-bottom: 2px solid #1e1e1e !important;
    flex-shrink: 0;
    background: #0d0d0d !important;
}

.ttm-wrapper .ttm-back-logo {
    font-family: var(--ttm-font) !important;
    font-size: 8px !important;
    letter-spacing: 3px; text-transform: uppercase;
    color: var(--ttm-primary) !important;
    font-weight: 700 !important;
    margin-bottom: 5px;
}

.ttm-wrapper .ttm-back-title {
    font-family: var(--ttm-font) !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    color: #ffffff !important;
    margin: 0 0 4px !important; padding: 0 !important;
    line-height: 1.2;
}

.ttm-wrapper .ttm-back-subtitle {
    font-size: 10px !important;
    color: #888888 !important;
    margin: 0 !important;
    text-transform: uppercase;
    letter-spacing: 1px; line-height: 1.4;
}

/* Enquiry form */
.ttm-wrapper .ttm-enquiry-form {
    display: flex; flex-direction: column; gap: 9px;
    padding: 13px 14px; flex: 1;
    background: #0d0d0d !important;
    color: #ffffff !important;
}

.ttm-wrapper .ttm-form-row { display: flex; gap: 8px; }

.ttm-wrapper .ttm-form-row--half {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}

.ttm-wrapper .ttm-form-row input,
.ttm-wrapper .ttm-form-row textarea {
    width: 100%; box-sizing: border-box;
    background: #1a1a1a !important; background-color: #1a1a1a !important;
    border: 1px solid #2e2e2e !important;
    border-radius: 7px;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    font-family: var(--ttm-font) !important;
    font-size: 11px !important;
    padding: 10px 12px !important;
    transition: border-color 0.2s;
    box-shadow: none !important; outline: none !important;
}
.ttm-wrapper .ttm-form-row input:focus,
.ttm-wrapper .ttm-form-row textarea:focus {
    border-color: var(--ttm-primary) !important;
    background: #212121 !important;
    background-color: #212121 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    box-shadow: none !important; outline: none !important;
}
.ttm-wrapper .ttm-form-row input::placeholder,
.ttm-wrapper .ttm-form-row textarea::placeholder {
    color: #888888 !important;
    -webkit-text-fill-color: #888888 !important;
    opacity: 1 !important;
    font-size: 10px !important;
}
/* Override browser autofill yellow background */
.ttm-wrapper .ttm-form-row input:-webkit-autofill,
.ttm-wrapper .ttm-form-row input:-webkit-autofill:hover,
.ttm-wrapper .ttm-form-row input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #1a1a1a inset !important;
    -webkit-text-fill-color: #ffffff !important;
    border-color: var(--ttm-primary) !important;
}
.ttm-wrapper .ttm-form-row textarea { resize: none; height: 52px; }

/* Submit button */
.ttm-wrapper .ttm-submit-btn {
    background: var(--ttm-btn-bg) !important; background-color: #ffc701 !important;
    color: var(--ttm-btn-text) !important;
    border: none !important; border-radius: 8px;
    padding: 12px !important;
    font-family: var(--ttm-font) !important;
    font-size: 12px !important; font-weight: 700 !important;
    letter-spacing: 1.5px; text-transform: uppercase;
    cursor: pointer; width: 100%;
    transition: all 0.2s; flex-shrink: 0;
    box-shadow: none !important;
}
.ttm-wrapper .ttm-submit-btn:hover {
    background: #ffd740 !important;
    color: #111 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255,199,1,0.4) !important;
}

/* Feedback */
.ttm-wrapper .ttm-form-feedback {
    font-size: 10px !important; text-align: center;
    min-height: 12px; border-radius: 4px; flex-shrink: 0;
    background: transparent !important; color: #aaaaaa !important;
}
.ttm-wrapper .ttm-form-feedback.success { color: #6fcf80 !important; background: rgba(93,186,111,0.1) !important; padding: 5px 8px; }
.ttm-wrapper .ttm-form-feedback.error   { color: #ff7070 !important; background: rgba(255,80,80,0.1) !important;  padding: 5px 8px; }

/* Price strip on back */
.ttm-wrapper .ttm-back-price-strip {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    background: #080808 !important; background-color: #080808 !important;
    border-top: 3px solid var(--ttm-primary) !important;
    flex-shrink: 0;
}
.ttm-wrapper .ttm-bp-label {
    font-size: 8px !important; letter-spacing: 2px; text-transform: uppercase;
    color: #555555 !important; font-weight: 700 !important;
}
.ttm-wrapper .ttm-bp-value {
    font-size: 15px !important; font-weight: 700 !important;
    color: var(--ttm-primary) !important;
    font-family: var(--ttm-font) !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGINATION
══════════════════════════════════════════════════════════════════════════ */
.ttm-wrapper .ttm-pagination { display: flex; justify-content: center; gap: 6px; margin-top: 36px; flex-wrap: wrap; }
.ttm-wrapper .ttm-pagination .page-numbers {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 8px;
    background: #111 !important; color: #888 !important;
    text-decoration: none !important; font-family: var(--ttm-font) !important;
    font-size: 14px !important; font-weight: 600 !important;
    border: 1px solid #222 !important; transition: all 0.2s;
}
.ttm-wrapper .ttm-pagination .page-numbers:hover,
.ttm-wrapper .ttm-pagination .page-numbers.current {
    background: var(--ttm-primary) !important; color: #111 !important; border-color: var(--ttm-primary) !important;
}

.ttm-wrapper .ttm-no-results {
    text-align: center; padding: 40px 20px;
    color: #666 !important; font-family: var(--ttm-font) !important; font-size: 16px !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   ADD MACHINE FORM
══════════════════════════════════════════════════════════════════════════ */
.ttm-add-form-wrap { max-width: 860px; margin: 0 auto; font-family: var(--ttm-font); }
.ttm-form-heading { font-family: var(--ttm-font); font-size: 26px; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 24px; }
.ttm-add-form { background: #f9f9f9; border-radius: 12px; overflow: hidden; border: 2px solid #eee; }
.ttm-add-form__section { padding: 24px 28px; border-bottom: 2px solid #eee; }
.ttm-add-form__section h3 { font-family: var(--ttm-font); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: #888; margin: 0 0 18px; padding-bottom: 8px; border-bottom: 2px solid var(--ttm-primary); display: inline-block; }
.ttm-add-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.ttm-add-field { display: flex; flex-direction: column; gap: 5px; }
.ttm-add-field.ttm-add-field--full { grid-column: 1 / -1; }
.ttm-add-field label { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #555; }
.ttm-add-field input[type="text"], .ttm-add-field input[type="number"], .ttm-add-field select, .ttm-add-field textarea { padding: 9px 13px; border: 2px solid #e0e0e0; border-radius: 7px; font-family: inherit; font-size: 14px; color: #222; background: #fff; transition: border-color 0.2s; }
.ttm-add-field input:focus, .ttm-add-field select:focus, .ttm-add-field textarea:focus { outline: none; border-color: var(--ttm-primary); }
.ttm-upload-label { cursor: pointer; }
.ttm-upload-label input[type="file"] { display: none; }
.ttm-upload-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; background: #111; color: var(--ttm-primary); border-radius: 7px; font-family: var(--ttm-font); font-size: 13px; font-weight: 600; letter-spacing: 1px; cursor: pointer; transition: all 0.2s; }
.ttm-upload-btn:hover { background: #222; }
.ttm-image-preview-add { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ttm-preview-thumb { position: relative; width: 80px; height: 80px; border-radius: 6px; overflow: hidden; border: 2px solid #ddd; }
.ttm-preview-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ttm-preview-thumb .ttm-hero-badge { position: absolute; top: 2px; left: 2px; background: var(--ttm-primary); color: #111; font-size: 8px; font-weight: 700; padding: 1px 4px; border-radius: 3px; }
.ttm-field-help { font-size: 12px; color: #888; margin: 0 0 12px; }
.ttm-add-form__actions { padding: 24px 28px; text-align: center; }
.ttm-submit-btn--large { font-size: 15px !important; padding: 13px 36px !important; width: auto !important; min-width: 220px; border-radius: 9px !important; }
.ttm-submit-note { font-size: 12px; color: #aaa; margin: 10px 0 0; }
.ttm-login-notice { padding: 20px 24px; background: #fff8e1; border: 2px solid var(--ttm-primary); border-radius: 8px; font-family: var(--ttm-font); }

/* ══════════════════════════════════════════════════════════════════════════
   STATES & ANIMATIONS
══════════════════════════════════════════════════════════════════════════ */
.ttm-grid.ttm-loading { pointer-events: none; opacity: 0.35; transition: opacity 0.2s; }
.ttm-field-error { border-color: #e55 !important; box-shadow: 0 0 0 2px rgba(255,80,80,0.15) !important; }

@keyframes ttm-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ttm-wrapper .ttm-card-wrapper { animation: ttm-fade-in 0.4s ease both; }
.ttm-wrapper .ttm-card-wrapper:nth-child(1) { animation-delay: 0.04s; }
.ttm-wrapper .ttm-card-wrapper:nth-child(2) { animation-delay: 0.08s; }
.ttm-wrapper .ttm-card-wrapper:nth-child(3) { animation-delay: 0.12s; }
.ttm-wrapper .ttm-card-wrapper:nth-child(n+4) { animation-delay: 0.16s; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (661px – 1024px)
   2 columns, cards slightly narrower
══════════════════════════════════════════════════════════════════════════ */
@media ( max-width: 1024px ) and ( min-width: 661px ) {
    .ttm-grid {
        gap: 16px;
        justify-content: flex-start;
    }
    .ttm-filters {
        padding: 14px 16px;
        margin-bottom: 24px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 660px)
   Single column. Cards fill screen width (handled by PHP inline @media).
   Every touch target is ≥ 44px. No horizontal scroll.
══════════════════════════════════════════════════════════════════════════ */
@media ( max-width: 660px ) {

    /* ── Wrapper ─────────────────────────────────────────────────────────── */
    .ttm-wrapper {
        padding: 0 4px;
    }

    /* ── Grid: single column, cards centered ─────────────────────────────── */
    .ttm-grid {
        flex-direction: column !important;
        align-items: center !important;
        gap: 20px;
        overflow-x: visible !important;
        padding: 0 0 12px;
    }

    /* ── Filter drawer: full-width on mobile ─────────────────────────────── */
    .ttm-filter-drawer {
        width: 100% !important;
        max-width: 100vw !important;
        border-left: none !important;
        border-top: 2px solid #1e1e1e !important;
        top: auto !important;
        bottom: 0 !important;
        height: auto !important;
        max-height: 85dvh !important;
        border-radius: 18px 18px 0 0;
        transform: translateY(100%) !important;
    }
    .ttm-filter-drawer.ttm-drawer-open {
        transform: translateY(0) !important;
    }
    .ttm-filter-trigger-wrap {
        justify-content: center;
    }

    /* ── Card faces: both are 100% of the (now fluid) card wrapper ───────── */
    .ttm-wrapper .ttm-card-front,
    .ttm-wrapper .ttm-card-back {
        width: 100%;
        height: 100%;
    }

    /* ── Header: slightly more padding, larger title ─────────────────────── */
    .ttm-wrapper .ttm-card-header {
        padding: 12px 15px 14px !important;
    }
    .ttm-wrapper .ttm-card-name {
        font-size: 20px !important;
    }
    .ttm-wrapper .ttm-card-year {
        font-size: 12px !important;
    }
    .ttm-wrapper .ttm-star {
        font-size: 17px !important;
    }

    /* ── Gallery slider: bigger touch controls ───────────────────────────── */
    .ttm-wrapper .ttm-slide-prev,
    .ttm-wrapper .ttm-slide-next {
        width: 36px !important;
        height: 36px !important;
        font-size: 22px !important;
    }
    .ttm-wrapper .ttm-dot {
        width: 8px !important;
        height: 8px !important;
    }
    .ttm-wrapper .ttm-slide-controls {
        padding: 10px 12px !important;
    }

    /* ── Price bar: larger text ──────────────────────────────────────────── */
    .ttm-wrapper .ttm-price-bar {
        padding: 11px 15px !important;
    }
    .ttm-wrapper .ttm-price-value {
        font-size: 20px !important;
    }
    .ttm-wrapper .ttm-price-label {
        font-size: 10px !important;
    }

    /* ── Stats rows: more padding, bigger text ───────────────────────────── */
    .ttm-wrapper .ttm-card-stats {
        padding: 10px 15px 6px !important;
    }
    .ttm-wrapper .ttm-stat-row {
        padding: 8px 0 !important;
    }
    .ttm-wrapper .ttm-stat-label {
        font-size: 11px !important;
    }
    .ttm-wrapper .ttm-stat-value {
        font-size: 13px !important;
    }

    /* ── Enquire Now button: bigger touch target ──────────────────────────── */
    .ttm-wrapper .ttm-enquire-btn {
        padding: 16px !important;
        font-size: 15px !important;
        min-height: 52px !important;
    }

    /* ── Card BACK ───────────────────────────────────────────────────────── */
    .ttm-wrapper .ttm-back-btn {
        padding: 12px 16px 0 !important;
        font-size: 11px !important;
        min-height: 44px !important;
    }
    .ttm-wrapper .ttm-back-header {
        padding: 4px 15px 14px !important;
    }
    .ttm-wrapper .ttm-back-title {
        font-size: 18px !important;
    }
    .ttm-wrapper .ttm-back-subtitle {
        font-size: 11px !important;
    }
    .ttm-wrapper .ttm-enquiry-form {
        padding: 12px 15px !important;
        gap: 10px !important;
    }

    /* Stack half-width fields to full on mobile ─────────────────────────── */
    .ttm-wrapper .ttm-form-row--half {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* Bigger input touch targets on card back ────────────────────────────── */
    .ttm-wrapper .ttm-form-row input,
    .ttm-wrapper .ttm-form-row textarea,
    .ttm-wrapper .ttm-dyn-field select {
        font-size: 16px !important;          /* prevents iOS zoom on focus */
        padding: 12px 13px !important;
        min-height: 44px !important;
    }
    .ttm-wrapper .ttm-form-row input::placeholder,
    .ttm-wrapper .ttm-form-row textarea::placeholder {
        font-size: 14px !important;
    }
    .ttm-wrapper .ttm-form-row textarea {
        height: 56px !important;
    }
    .ttm-wrapper .ttm-submit-btn {
        padding: 14px !important;
        font-size: 14px !important;
        min-height: 50px !important;
    }
    .ttm-wrapper .ttm-back-price-strip {
        padding: 11px 15px !important;
    }
    .ttm-wrapper .ttm-bp-value {
        font-size: 16px !important;
    }

    /* ── Pagination ──────────────────────────────────────────────────────── */
    .ttm-wrapper .ttm-pagination {
        gap: 8px;
        margin-top: 28px;
    }
    .ttm-wrapper .ttm-pagination .page-numbers {
        width: 44px !important;
        height: 44px !important;
        font-size: 15px !important;
    }

    /* ── Add-machine form ────────────────────────────────────────────────── */
    .ttm-add-form-wrap {
        padding: 0 4px;
    }
    .ttm-form-heading {
        font-size: 20px !important;
        letter-spacing: 1px;
        margin-bottom: 16px;
    }
    .ttm-add-form__section {
        padding: 16px 14px !important;
    }
    .ttm-add-form__actions {
        padding: 16px 14px !important;
    }
    .ttm-add-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .ttm-add-field input[type="text"],
    .ttm-add-field input[type="number"],
    .ttm-add-field select,
    .ttm-add-field textarea {
        font-size: 16px !important;          /* prevents iOS zoom on focus */
        padding: 12px 13px !important;
        min-height: 44px !important;
    }
    .ttm-submit-btn--large {
        width: 100% !important;
        font-size: 15px !important;
        padding: 15px !important;
        min-height: 52px !important;
    }

    /* ── Hover states: disable on touch (no hover on mobile) ────────────── */
    .ttm-wrapper .ttm-card-wrapper:hover {
        transform: none !important;
        box-shadow: 0 6px 28px rgba(0,0,0,0.5) !important;
    }
    .ttm-wrapper .ttm-enquire-btn:hover {
        letter-spacing: 2px !important;
    }
    .ttm-btn--filter:hover {
        transform: none !important;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   VERY SMALL SCREENS (≤ 360px) — extra compact adjustments
══════════════════════════════════════════════════════════════════════════ */
@media ( max-width: 360px ) {
    .ttm-wrapper .ttm-card-name {
        font-size: 17px !important;
    }
    .ttm-wrapper .ttm-price-value {
        font-size: 17px !important;
    }
    .ttm-wrapper .ttm-enquire-btn {
        font-size: 13px !important;
        letter-spacing: 1.5px !important;
    }
    .ttm-wrapper .ttm-stat-label {
        font-size: 10px !important;
    }
    .ttm-wrapper .ttm-stat-value {
        font-size: 12px !important;
    }
}

/* ── Dynamic enquiry form fields (select, half-width, etc) ──────────────── */
.ttm-wrapper .ttm-dyn-field {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

/* Half-width fields are paired inside ttm-form-row--half which uses grid */
.ttm-wrapper .ttm-dyn-field.ttm-field-half {
    width: 100%;
    min-width: 0;
}

/* Select fields on card back */
.ttm-wrapper .ttm-dyn-field select {
    width: 100%;
    box-sizing: border-box;
    background: #1a1a1a !important;
    background-color: #1a1a1a !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    border: 1px solid #2e2e2e !important;
    border-radius: 7px;
    padding: 10px 12px !important;
    font-size: 11px !important;
    font-family: var(--ttm-font) !important;
    transition: border-color 0.2s;
    box-shadow: none !important;
    outline: none !important;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23ffc701'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
}
.ttm-wrapper .ttm-dyn-field select:focus {
    border-color: var(--ttm-primary) !important;
    background-color: #212121 !important;
}
.ttm-wrapper .ttm-dyn-field select option {
    background: #1a1a1a;
    color: #fff;
}

/* ── Frontend star rating picker (add-machine form) ─────────────────────── */
.ttm-frontend-stars {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.ttm-frontend-star {
    font-size: 28px;
    color: #ddd;
    cursor: pointer;
    transition: color 0.15s, transform 0.1s;
    line-height: 1;
    user-select: none;
}

.ttm-frontend-star.hover,
.ttm-frontend-star.active {
    color: #ffc701;
    transform: scale(1.15);
}

.ttm-rating-label {
    font-size: 13px;
    color: #888;
    font-style: italic;
    margin-left: 8px;
    transition: color 0.15s;
}

.ttm-frontend-stars:has(.ttm-frontend-star.active) .ttm-rating-label {
    color: #555;
}

/* ── Touch device: "Tap to Enquire" instead of "Hover to Enquire" ───────── */
/* The JS adds .ttm-touch-device to <body> on touch devices */
body.ttm-touch-device .ttm-enquire-btn::after {
    /* Already says ENQUIRE NOW — no change needed, button is obvious */
}

/* Active state feedback for touch (replaces hover) */
body.ttm-touch-device .ttm-enquire-btn:active {
    background: #e6b300 !important;
    transform: scale(0.98) !important;
}
body.ttm-touch-device .ttm-slide-prev:active,
body.ttm-touch-device .ttm-slide-next:active {
    transform: scale(0.92) !important;
    background: var(--ttm-primary) !important;
}
body.ttm-touch-device .ttm-submit-btn:active {
    transform: scale(0.98) !important;
    background: #e6b300 !important;
}
body.ttm-touch-device .ttm-back-btn:active {
    color: var(--ttm-primary) !important;
}

/* Prevent body scroll when card back is open on mobile */
@media ( max-width: 660px ) {
    .ttm-wrapper .ttm-card-back {
        /* Ensure back-face form is scrollable if content overflows */
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    /* Safe area padding for notched phones */
    .ttm-wrapper .ttm-back-price-strip {
        padding-bottom: max(11px, env(safe-area-inset-bottom)) !important;
    }
    .ttm-wrapper .ttm-enquire-btn {
        padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
    }
}
