/**
 * jst-cards.css — shared job card stylesheet.
 *
 * Single source of truth for card UI.
 * Loaded by:
 *   • class-widget-iframe.php  (iframe embed)
 *   • Any future shortcode / block that renders cards server-side
 *
 * The JS cardHtml() in job_favorites.php uses these same class names but
 * gets its styles from the parent page (already enqueued).  This file is
 * only for contexts that need a self-contained stylesheet (e.g. iframe).
 *
 * Tokens and rules are copied verbatim from jobscout_tracker_styles() in
 * job_favorites.php so the two stay visually identical.
 */

/* ── Google Fonts ───────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ── Reset ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; padding: 0; }

/* ── Design tokens (mirrors jst-scope :root in job_favorites.php) ── */
:root {
    --jst-brand: #0f172a;
    --jst-brand-dark: #020617;
    --jst-brand-soft: color-mix(in srgb, var(--jst-brand) 10%, transparent);
    --jst-brand-line: color-mix(in srgb, var(--jst-brand) 18%, transparent);
    --jst-ink: #0f172a;
    --jst-ink-2: #475569;
    --jst-ink-3: #94a3b8;
    --jst-surface: #ffffff;
    --jst-page: #fafafa;
    --jst-line: #e2e8f0;
    --jst-ok: #047857;    --jst-ok-bg: rgba(16,185,129,.12);
    --jst-warn: #a16207;  --jst-warn-bg: rgba(251,191,36,.18);
    --jst-danger: #be123c;--jst-danger-bg: rgba(244,63,94,.12);
    --jst-indigo: #4f46e5;--jst-indigo-soft: rgba(79,70,229,.1);
    --jst-radius: 16px;
    --jst-radius-sm: 12px;
    --jst-radius-full: 9999px;
    --jst-card-bg: #ffffff;
    --jst-card-radius: 20px;
    --jst-page-border: none;
    --jst-page-radius: 0px;
    --jst-gap: 14px;
    --jst-shadow: 0 1px 3px rgba(15,23,42,.04), 0 1px 2px rgba(15,23,42,.03);
    --jst-shadow-lift: 0 10px 25px -5px rgba(15,23,42,.08), 0 8px 10px -6px rgba(15,23,42,.04);
    font-family: 'Plus Jakarta Sans', 'Hind Siliguri', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    color: var(--jst-ink);
    line-height: 1.45;
}

/* ── Page wrapper ─────────────────────────────────────────────────── */
/* body/html must be transparent — ALL background lives on .djm-page */
html, body {
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-sizing: border-box !important;
}
/* The endpoint script sets html/body to the exact widget height. */
html, body { min-height: 0 !important; overflow: hidden !important; }
body { display: block; }

.djm-page {
    padding: 10px 8px 8px;
    background: var(--jst-page-bg, var(--jst-page));
    border: var(--jst-page-border, none);
    border-radius: var(--jst-page-radius, 0px);
    overflow: hidden;
    /* no min-height — iframe auto-resizes via postMessage */
}

/* ── Widget header ────────────────────────────────────────────────── */
.djm-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
    padding: 0 2px;
}
.djm-head h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--jst-ink);
    line-height: 1.3;
}
.djm-viewall {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: var(--jst-radius-full);
    background: var(--jst-brand);
    color: #fff !important;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: filter .15s;
    box-shadow: var(--jst-shadow);
}
.djm-viewall:hover { filter: brightness(1.12); }

/* ── Grid ─────────────────────────────────────────────────────────── */
.djm-grid {
    display: grid;
    /* wider min → fewer but wider cards */
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: var(--jst-gap);
}

/* ── Card (verbatim from jst-scope .jst-card) ────────────────────── */
.jst-card {
    background: var(--jst-card-bg, var(--jst-surface));
    border: 1px solid var(--jst-line);
    border-radius: var(--jst-card-radius, 20px);
    padding: 14px;              /* reduced from 20px */
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: space-between;
    box-shadow: var(--jst-shadow);
    transition: border-color .2s, box-shadow .2s, transform .15s;
    cursor: pointer;
}
.jst-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--jst-shadow-lift);
    transform: translateY(-2px);
}

/* ── Card top ─────────────────────────────────────────────────────── */
.jst-card-top { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }

/* ── Logo ─────────────────────────────────────────────────────────── */
/* --jst-logo-radius is set inline by the iframe (from &logo_radius= param) */
.jst-logo {
    width: 44px;
    height: 44px;
    border-radius: var(--jst-logo-radius, 12px);
    flex-shrink: 0;
    background: transparent;             /* no extra colour behind logo image */
    color: var(--jst-ink-2);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: none;
    padding: 0;
    transition: transform .15s;
}
/* When no image — show initial letter with a neutral tint */
.jst-logo.is-initial {
    background: var(--jst-line);
    color: var(--jst-ink-2);
}
.jst-card:hover .jst-logo { transform: scale(1.05); }
/* image inside logo — inherit same radius */
.jst-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: var(--jst-logo-radius, 12px);
    /* Light theme: multiply removes white bg from logo PNGs */
    mix-blend-mode: multiply;
}
/* Dark mode: multiply makes logos invisible on dark bg — revert to normal */
@media (prefers-color-scheme: dark) {
    .jst-logo img { mix-blend-mode: normal; }
}
body.force-light .jst-logo img { mix-blend-mode: multiply; }
body.force-dark  .jst-logo img { mix-blend-mode: normal; }

/* ── Card meta ────────────────────────────────────────────────────── */
.jst-card-meta {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}

/* ── Title ────────────────────────────────────────────────────────── */
.jst-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--jst-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.jst-title a { color: inherit; text-decoration: none; }
.jst-title a:hover { color: var(--jst-indigo); }

/* ── Company ──────────────────────────────────────────────────────── */
.jst-company {
    font-size: 12px;
    color: var(--jst-ink-2);
    font-weight: 500;
    margin: 2px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Deadline pill ────────────────────────────────────────────────── */
.jst-deadline {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: var(--jst-radius-full);
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid transparent;
    line-height: 1.2;
    white-space: nowrap;
}
.jst-deadline.is-ok     { background: #f1f5f9; color: var(--jst-ink-2); border-color: var(--jst-line); }
.jst-deadline.is-warn   { background: #fffbeb; color: #b45309;          border-color: #fde68a; }
.jst-deadline.is-danger { background: #fff1f2; color: #be123c;          border-color: #fecdd3; }
.jst-deadline.is-muted  { background: #f1f5f9; color: var(--jst-ink-3); border-color: var(--jst-line); }
.jst-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* ── Tags ─────────────────────────────────────────────────────────── */
.jst-tags {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, #000 80%, transparent);
    mask-image: linear-gradient(90deg, #000 80%, transparent);
}
.jst-tag {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    background: #f1f5f9;
    color: var(--jst-ink-2);
}
.jst-tag.is-salary { background: #eef2ff; color: #4338ca; }

/* ── Card footer ──────────────────────────────────────────────────── */
.jst-card-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--jst-line);
}
.jst-card-actions { display: flex; align-items: center; gap: 4px; }

/* ── Apply button ─────────────────────────────────────────────────── */
.jst-apply {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 16px;
    border-radius: var(--jst-radius-full);
    background: var(--jst-brand);
    color: #fff !important;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    min-height: 30px;
    transition: filter .15s, transform .12s;
    box-shadow: var(--jst-shadow);
}
.jst-apply:hover  { filter: brightness(1.08); color: #fff !important; }
.jst-apply:active { transform: scale(.97); }

/* ── Footer powered-by ────────────────────────────────────────────── */
.djm-foot { text-align: center; padding: 12px 0 2px; }
.djm-foot a { font-size: 11px; color: var(--jst-ink-3); text-decoration: none; }
.djm-foot a:hover { color: var(--jst-brand); }

/* ── Empty state ──────────────────────────────────────────────────── */
.jst-empty-msg {
    text-align: center;
    padding: 30px;
    color: var(--jst-ink-3);
    grid-column: 1 / -1;
}
