/* =====================================================================
   EV Comparison Table  v4  —  front-end styles
   ===================================================================== */
:root {
    --evct-purple:      #5b4fcf;
    --evct-purple-dark: #4a3fb8;
    --evct-group-clr:   #5b4fcf;
    --evct-border:      #e8eaf0;
    --evct-bg:          #ffffff;
    --evct-row-alt:     #f9f9fc;
    --evct-text:        #1a1a2a;
    --evct-muted:       #888;
    --evct-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --evct-radius:      10px;
    --evct-col-w:       200px;
    --evct-sticky-w:    190px;
}

.evct-wrap { font-family: var(--evct-font); color: var(--evct-text); font-size: 14px; }

/* ── Loading ──────────────────────────────────────────────────────── */
.evct-loading {
    display: flex; align-items: center; gap: 10px;
    padding: 32px; color: var(--evct-muted); font-size: 14px;
}
.evct-spinner {
    width: 18px; height: 18px;
    border: 2.5px solid var(--evct-border);
    border-top-color: var(--evct-purple);
    border-radius: 50%;
    animation: evct-spin .7s linear infinite; display: inline-block;
}
@keyframes evct-spin { to { transform: rotate(360deg); } }

/* ── Scroller ─────────────────────────────────────────────────────── */
.evct-scroller {
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--evct-border);
    border-radius: var(--evct-radius);
    background: var(--evct-bg);
    -webkit-overflow-scrolling: touch;
    /* Needed so sticky positioning has a correct containing block on iOS */
    -webkit-transform: translateZ(0);
}
.evct-scroller[hidden] { display: none; }

/* ── Table ────────────────────────────────────────────────────────── */
/* IMPORTANT: border-collapse MUST be 'separate' (not 'collapse') for
   position: sticky to work reliably on table cells on mobile browsers
   (iOS Safari / Chrome Android). border-spacing:0 keeps cells touching. */
.evct-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    min-width: 460px;
    table-layout: fixed;
}
.evct-col         { width: var(--evct-col-w); min-width: var(--evct-col-w); }
.evct-col-sticky  {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #fff;
    width: var(--evct-sticky-w);
    min-width: var(--evct-sticky-w);
    /* Re-create the visual separation that border-collapse used to give us */
    box-shadow: 1px 0 0 var(--evct-border);
}

/* ── Image row ────────────────────────────────────────────────────── */
.evct-img-row th {
    padding: 20px 14px 10px; text-align: center; vertical-align: bottom;
    border-bottom: 1px solid var(--evct-border);
    background: #fff; position: relative;
}
.evct-img-row th:not(:last-child) { border-right: 1px solid var(--evct-border); }
.evct-img-row th.evct-col-sticky { text-align: left; border-right: none; }

.evct-vehicle-img { width: 100%; height: 90px; display: flex; align-items: flex-end; justify-content: center; }
.evct-vehicle-img img { max-height: 88px; max-width: 100%; object-fit: contain; display: block; }
.evct-no-img {
    width: 80px; height: 78px; background: #f0f0f8; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700; color: var(--evct-purple);
}

/* ── Name row ─────────────────────────────────────────────────────── */
.evct-name-row td {
    padding: 8px 14px 12px; text-align: center;
    border-bottom: 2px solid var(--evct-border); background: #fff;
}
.evct-name-row td:not(:last-child) { border-right: 1px solid var(--evct-border); }
.evct-name-row td.evct-col-sticky { text-align: left; border-right: none; }
.evct-name-link { font-size: 13px; font-weight: 600; color: var(--evct-text); text-decoration: none; display: block; line-height: 1.3; }
a.evct-name-link:hover { color: var(--evct-purple); }

/* ── Data rows ────────────────────────────────────────────────────── */
.evct-data-row td {
    border-bottom: 1px solid var(--evct-border);
    vertical-align: middle; text-align: center; background: #fff;
}
.evct-data-row td:not(:last-child) { border-right: 1px solid var(--evct-border); }
.evct-data-row td.evct-col-sticky  { border-right: none; }
.evct-data-row:nth-child(even) td             { background: var(--evct-row-alt); }
.evct-data-row:nth-child(even) .evct-col-sticky { background: var(--evct-row-alt); }

/* Sticky first data cell */
.evct-first-data { text-align: left !important; padding: 0 !important; }
.evct-first-data .evct-group-label {
    display: block; font-size: 11.5px; font-weight: 700; color: var(--evct-group-clr);
    padding: 7px 14px 1px;
}
.evct-first-data .evct-cell-val {
    display: block; font-size: 13.5px; font-weight: 500; color: var(--evct-text);
    padding: 1px 14px 8px;
}

/* Value cells */
.evct-val-cell { padding: 11px 12px; font-size: 13.5px; font-weight: 500; }
.evct-val-cell.evct-empty { color: var(--evct-muted); font-weight: 400; }

/* ── Price row ────────────────────────────────────────────────────── */
.evct-price-row td {
    background: var(--evct-purple) !important; color: #fff !important;
    font-weight: 700; font-size: 14px;
    border-color: var(--evct-purple-dark) !important;
}
.evct-price-row .evct-first-data .evct-group-label { color: rgba(255,255,255,.65); }
.evct-price-row .evct-first-data .evct-cell-val    { color: #fff; font-size: 14.5px; }
.evct-price-row .evct-val-cell.evct-empty          { color: rgba(255,255,255,.45); }

/* ── View Details action row ─────────────────────────────────────── */
.evct-action-row td {
    padding: 12px 12px;
    text-align: center;
    background: #fff;
}
.evct-action-row td:not(:last-child) { border-right: 1px solid var(--evct-border); }
.evct-action-row td.evct-col-sticky  { background: #fff; border-right: none; }

.evct-view-btn {
    display: inline-block;
    background: var(--evct-purple);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    padding: 7px 18px;
    border-radius: 30px;
    transition: background .15s, transform .1s;
}
.evct-view-btn:hover  { background: var(--evct-purple-dark); color: #fff; }
.evct-view-btn:active { transform: scale(.96); }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
    :root { --evct-col-w: 150px; --evct-sticky-w: 145px; }
    .evct-vehicle-img { height: 64px; }
    .evct-vehicle-img img { max-height: 60px; }
}
