/* ========================================================================
   Salary Guide — page styling on top of tokens.css + resources.css.

   All rules are scoped to `.sg-` wrappers so the form/input styling beats the
   footer.css `.form-group { display:flex }` global leak by specificity AND
   load order (same trap fixed on post-job / resume-builder). No color-mix(),
   no :root redefinition, reduced-motion respected, mobile-first.

   Role data renders into `.sg-results` grouped by sector; each role is a
   `.sg-role-card` with three `.sg-level` columns (Entry / Mid / Senior).
   ======================================================================== */

.sg-main {
    padding: 2rem 0 3rem;
}

/* ---------- Disclaimer ---------- */
.sg-disclaimer {
    margin-bottom: 1.75rem;
    align-items: flex-start;
}

.sg-disclaimer strong { color: var(--gray-800); }
.sg-disclaimer i { font-size: 1.05rem; }

/* ---------- Controls (scoped form — neutralises footer.css flex leak) ---------- */
.sg-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 240px);
    gap: 0.85rem 1rem;
    align-items: end;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 2px hsl(220 25% 10% / 0.04), 0 8px 22px hsl(220 25% 10% / 0.06);
    padding: 1.1rem 1.15rem;
    margin-bottom: 1.1rem;
}

.sg-control { display: block; margin: 0; padding: 0; border: 0; background: none; min-width: 0; }

.sg-control-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    margin: 0 0 0.4rem;
    letter-spacing: 0.01em;
}

/* Search box */
.sg-search-box { position: relative; }

.sg-search-box > i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.9rem;
    pointer-events: none;
}

.sg-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.7rem 2.4rem 0.7rem 2.4rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--gray-900);
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.sg-search-input::placeholder { color: var(--gray-400); }
.sg-search-input:hover { border-color: var(--gray-300); }
.sg-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

.sg-search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--gray-100);
    color: var(--gray-500);
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
}

.sg-search-clear:hover { background: var(--gray-200); color: var(--gray-700); }

/* Sector select */
.sg-select-wrap { position: relative; }

.sg-select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.7rem 2.25rem 0.7rem 0.85rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--gray-900);
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.sg-select:hover { border-color: var(--gray-300); }
.sg-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

.sg-select-wrap > i {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--gray-400);
    font-size: 0.7rem;
}

/* ---------- Legend ---------- */
.sg-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 0.7rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.sg-legend-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray-400);
}

.sg-legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.sg-legend-item strong { color: var(--gray-800); font-weight: 700; }

.sg-dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    flex: 0 0 auto;
}

.sg-dot--entry { background: var(--gray-400); }
.sg-dot--mid { background: var(--primary-light); }
.sg-dot--senior { background: var(--primary-dark); }

/* ---------- Result count ---------- */
.sg-result-count {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0 0 1rem;
    font-weight: 500;
}

.sg-result-count strong { color: var(--gray-800); font-weight: 700; }

/* ---------- Results / sector groups ---------- */
.sg-results { display: flex; flex-direction: column; gap: 1.75rem; }

.sg-sector-group { scroll-margin-top: 6rem; }

.sg-sector-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0 0 0.9rem;
}

.sg-sector-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: var(--radius-md);
    background: var(--primary-tint);
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sg-sector-name {
    font-family: var(--font-secondary);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    letter-spacing: -0.01em;
}

.sg-sector-count {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-400);
}

/* ---------- Role grid ---------- */
.sg-role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.sg-role-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.15rem 1.15rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.sg-role-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.sg-role-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.9rem;
    line-height: 1.3;
}

/* Three levels */
.sg-levels { display: flex; flex-direction: column; gap: 0.55rem; }

.sg-level {
    display: grid;
    grid-template-columns: 4.25rem 1fr;
    align-items: center;
    gap: 0.65rem;
}

.sg-level-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gray-500);
}

.sg-level-tag .sg-dot { width: 0.55rem; height: 0.55rem; }

.sg-level-body { min-width: 0; }

.sg-level-range {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    line-height: 1.2;
    white-space: nowrap;
}

.sg-level-range .sg-cur { font-size: 0.7rem; font-weight: 600; color: var(--gray-400); margin-left: 0.2rem; }
.sg-level-range .sg-dash { color: var(--gray-300); margin: 0 0.15rem; font-weight: 500; }

/* Subtle range bar — purely decorative, the text above is authoritative */
.sg-level-bar {
    position: relative;
    height: 5px;
    margin-top: 0.3rem;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.sg-level-bar-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: var(--radius-full);
}

.sg-level--entry .sg-level-bar-fill { background: var(--gray-400); }
.sg-level--mid .sg-level-bar-fill { background: var(--primary-light); }
.sg-level--senior .sg-level-bar-fill { background: var(--primary-dark); }

/* ---------- Empty state ---------- */
.sg-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--white);
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius-lg);
}

.sg-empty i { font-size: 2rem; color: var(--gray-300); margin-bottom: 0.85rem; }
.sg-empty h3 { font-size: 1.0625rem; font-weight: 700; color: var(--gray-800); margin: 0 0 0.35rem; }
.sg-empty p { font-size: 0.9375rem; color: var(--gray-500); margin: 0 0 1.1rem; }

/* ========================================================================
   What affects your pay
   ======================================================================== */
.sg-factors {
    margin-top: 3rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--gray-200);
}

.sg-factors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sg-factor {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: border-color 0.25s ease, transform 0.25s ease;
}

.sg-factor:hover { border-color: var(--gray-300); transform: translateY(-2px); }

.sg-factor-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--primary-tint);
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
}

.sg-factor h3 { font-size: 1rem; font-weight: 700; color: var(--gray-900); margin: 0 0 0.35rem; }
.sg-factor p { font-size: 0.875rem; color: var(--gray-600); line-height: 1.55; margin: 0; }

/* Negotiation callout */
.sg-negotiation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem;
    background: linear-gradient(135deg, var(--gray-50), var(--primary-tint));
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.5rem;
}

.sg-negotiation-text { flex: 1 1 320px; min-width: 0; }

.sg-negotiation-text h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.4rem;
}

.sg-negotiation-text h3 i { color: var(--primary-color); }
.sg-negotiation-text p { font-size: 0.9375rem; color: var(--gray-600); line-height: 1.55; margin: 0; }

.sg-negotiation-links { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* ========================================================================
   Responsive
   ======================================================================== */
@media (max-width: 720px) {
    .sg-controls {
        grid-template-columns: 1fr;
    }
    .sg-role-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sg-main { padding: 1.5rem 0 2.5rem; }
    .sg-legend { gap: 0.4rem 0.85rem; }
    .sg-role-card { padding: 1rem; }
    /* Keep the level rows readable on very small screens */
    .sg-level { grid-template-columns: 3.75rem 1fr; gap: 0.5rem; }
    .sg-level-range { font-size: 0.875rem; }
    .sg-negotiation { padding: 1.2rem; }
    .sg-negotiation-links { width: 100%; }
    .sg-negotiation-links .r-btn { flex: 1 1 auto; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .sg-role-card,
    .sg-factor,
    .sg-search-input,
    .sg-select,
    .sg-search-clear { transition: none; }
    .sg-role-card:hover,
    .sg-factor:hover { transform: none; }
}
