/* ═══════════════════════════════════════════════════════════════════
   Astro-HR — Candidate Comparison Widget Styles
   ═══════════════════════════════════════════════════════════════════ */

/* ── Widget Container ─────────────────────────────────────────────── */

.hr-widget {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.hr-widget__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.hr-widget__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    color: var(--accent);
    flex-shrink: 0;
}

.hr-widget__title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

.hr-widget__subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ── Form Controls ────────────────────────────────────────────────── */

.hr-widget__form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.hr-fieldset {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem 1.25rem;
    margin: 0;
    background: rgba(255, 255, 255, 0.02);
}

.hr-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    padding: 0 0.5rem;
}

.hr-legend__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
}

.hr-legend__badge--a {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.hr-legend__badge--b {
    background: linear-gradient(135deg, var(--warning-alt), var(--danger));
}

.hr-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.hr-field + .hr-field {
    margin-top: 0.75rem;
}

.hr-field-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.hr-field-row--4 {
    grid-template-columns: 2fr 1fr 1fr 1fr;
}

.hr-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.hr-input,
.hr-select {
    background: var(--bg-card, rgba(0, 0, 0, 0.2));
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.hr-input:focus,
.hr-select:focus {
    outline: none;
    border-color: var(--accent);
}

.hr-select {
    cursor: pointer;
}

/* Details / Summary */

.hr-details {
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 0;
}

.hr-details[open] {
    padding: 0 1rem 1rem;
}

.hr-summary {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.hr-summary::before {
    content: '▸ ';
}

.hr-details[open] > .hr-summary::before {
    content: '▾ ';
}

/* Compare button */

.hr-btn-compare {
    margin-top: 0.5rem;
    width: 100%;
    padding: 0.8rem;
    font-size: 0.9rem;
    font-weight: 600;
}

/* ── Custom Toggle Switch ─────────────────────────────────────────── */

.hr-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    margin: 1rem 0;
    user-select: none;
}

.hr-toggle__input {
    display: none;
}

.hr-toggle__track {
    position: relative;
    width: 2.25rem;
    height: 1.25rem;
    background-color: var(--border);
    border-radius: 1rem;
    transition: background-color 0.3s ease;
}

.hr-toggle__handle {
    position: absolute;
    top: 0.125rem;
    left: 0.125rem;
    width: 1rem;
    height: 1rem;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.hr-toggle__input:checked + .hr-toggle__track {
    background-color: var(--accent);
}

.hr-toggle__input:checked + .hr-toggle__track .hr-toggle__handle {
    transform: translateX(1rem);
}

.hr-toggle__label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ── Mode Switcher ────────────────────────────────────────────────── */

.hr-mode-switcher {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.hr-mode-btn {
    flex: 1;
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.hr-mode-btn:hover {
    background: rgba(255, 255, 255, 0.04);
}

.hr-mode-btn--active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    color: var(--accent);
}

/* ── Single Evaluation Verdict ────────────────────────────────────── */

.hr-single-verdict {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border-radius: 14px;
    margin-bottom: 1.25rem;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
}

.hr-single-verdict.hr-score--high {
    background: rgba(34, 197, 94, 0.06);
    border-color: rgba(34, 197, 94, 0.25);
}

.hr-single-verdict.hr-score--mid {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.25);
}

.hr-single-verdict.hr-score--low {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.25);
}

.hr-single-verdict__score {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    flex-shrink: 0;
}

.hr-single-verdict__emoji {
    font-size: 1.6rem;
    margin-right: 0.5rem;
}

.hr-single-verdict__text {
    flex: 1;
}

.hr-single-verdict__text strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.hr-single-verdict__text p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.hr-card--single {
    border: 1px solid var(--border);
    border-top: 3px solid #6366f1;
    border-radius: 12px;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
}

/* ── Results ──────────────────────────────────────────────────────── */

.hr-results {
    margin-top: 1.5rem;
}

.hr-error {
    padding: 1rem;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    font-size: 0.85rem;
}

/* Recommendation banner */

.hr-rec {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.hr-rec--equal {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
}

.hr-rec__badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), rgba(139, 92, 246, 0.8));
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.hr-rec__text {
    flex: 1;
}

.hr-rec__text strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.hr-rec__text p {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.hr-rec__confidence {
    font-size: 0.72rem;
    color: var(--text-tertiary, var(--text-secondary));
    opacity: 0.8;
}

/* Side-by-side comparison */

.hr-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 800px) {
    .hr-comparison {
        grid-template-columns: 1fr;
    }
    .hr-field-row {
        grid-template-columns: 1fr;
    }
}

/* Candidate cards */

.hr-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
}

.hr-card--a {
    border-top: 3px solid #6366f1;
}

.hr-card--b {
    border-top: 3px solid var(--warning-alt);
}

.hr-card__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

.hr-card__score {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.hr-score-value {
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.hr-score-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Score colors */

.hr-score--high, .hr-score--high {
    color: var(--success);
}

.hr-score--mid {
    color: var(--warning-alt);
}

.hr-score--low {
    color: var(--danger);
}

/* Progress bars */

.hr-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.hr-bar--sm {
    height: 4px;
    margin-bottom: 0;
}

.hr-bar--empty {
    background: transparent !important;
}

.hr-bar__fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
}

.hr-bar__fill.hr-score--high {
    background: linear-gradient(90deg, var(--success), var(--badge-great-friend-border));
}

.hr-bar__fill.hr-score--mid {
    background: linear-gradient(90deg, var(--warning-alt), var(--warning-alt));
}

.hr-bar__fill.hr-score--low {
    background: linear-gradient(90deg, var(--danger), var(--badge-great-enemy-border));
}

/* Metrics */

.hr-card__metrics {
    margin-top: 1rem;
}

.hr-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.hr-metric__label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.hr-metric__value {
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Timing flags */

.hr-flags {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border);
}

.hr-flags__title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 0.5rem;
}

.hr-flag {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    line-height: 1.45;
}

.hr-flag--risk {
    background: rgba(239, 68, 68, 0.06);
    border-left: 3px solid var(--danger);
}

.hr-flag--peak {
    background: rgba(34, 197, 94, 0.06);
    border-left: 3px solid var(--success);
}

.hr-flag--neutral {
    background: rgba(245, 158, 11, 0.06);
    border-left: 3px solid var(--warning-alt);
}

.hr-flag__icon {
    flex-shrink: 0;
    font-size: 0.9rem;
}

.hr-flag strong {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.8rem;
}

.hr-flag p {
    margin: 0;
    color: var(--text-secondary);
}

/* Factor details (collapsible) */

.hr-details--factors {
    margin-top: 1rem;
    border: none;
    border-top: 1px dashed var(--border);
    border-radius: 0;
    padding: 0;
}

.hr-details--factors[open] {
    padding: 0;
}

.hr-details--factors > .hr-summary {
    padding: 0.75rem 0;
}

.hr-factor-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hr-factor {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.25rem 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
}

.hr-factor__name {
    font-size: 0.78rem;
    font-weight: 500;
}

.hr-factor__val {
    font-size: 0.78rem;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.hr-factor .hr-bar--sm {
    grid-column: 1 / -1;
}

.hr-factor__note {
    grid-column: 1 / -1;
    font-size: 0.68rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ── Best-Fit Ranking ─────────────────────────────────────────────── */

.hr-bestfit-header {
    text-align: center;
    padding: 1.5rem 1rem 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 14px;
}

.hr-bestfit-crown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.hr-bestfit-crown__icon {
    font-size: 2.4rem;
    filter: drop-shadow(0 2px 6px rgba(234, 179, 8, 0.35));
}

.hr-bestfit-crown__info {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.hr-bestfit-crown__title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.hr-bestfit-crown__score {
    font-size: 1.6rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.hr-bestfit-crown__verdict {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.hr-bestfit-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hr-bestfit-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s;
}

.hr-bestfit-row:hover {
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.1);
}

.hr-bestfit-row--first {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.06), rgba(245, 158, 11, 0.04));
    border-color: rgba(234, 179, 8, 0.18);
}

.hr-bestfit-row--top {
    border-color: rgba(99, 102, 241, 0.08);
}

.hr-bestfit-row__medal {
    font-size: 1.3rem;
    width: 2rem;
    text-align: center;
    flex-shrink: 0;
}

.hr-bestfit-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    border: 1px solid var(--border);
}

.hr-bestfit-row__info {
    flex: 1;
    min-width: 0;
}

.hr-bestfit-row__title {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.hr-bestfit-row__bars {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.hr-bestfit-row__bar-group {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: 1;
    min-width: 0;
}

.hr-bestfit-row__bar-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    width: 2.5rem;
    flex-shrink: 0;
}

.hr-bestfit-row__bar-val {
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    width: 2rem;
    text-align: right;
    flex-shrink: 0;
}

.hr-bestfit-row__score {
    flex-shrink: 0;
    text-align: right;
    min-width: 3rem;
}

.hr-bestfit-row__score .hr-score-value {
    font-size: 1.15rem;
    font-weight: 800;
}

/* ── Methodology ──────────────────────────────────────────────────── */

.hr-methodology {
    margin-top: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.01);
}

.hr-methodology .hr-summary {
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
}

.hr-methodology__content {
    padding: 0 1rem 1rem;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.hr-methodology__intro {
    margin: 0 0 1rem;
}

.hr-methodology__layer {
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid rgba(99, 102, 241, 0.25);
    border-radius: 0 8px 8px 0;
    background: rgba(99, 102, 241, 0.03);
}

.hr-methodology__layer h5 {
    margin: 0 0 0.3rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.hr-methodology__layer p {
    margin: 0;
}

.hr-methodology__flags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 0.5rem;
}

.hr-mflag {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.hr-mflag--pos {
    background: rgba(34, 197, 94, 0.10);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.15);
}

.hr-mflag--neg {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.12);
}

.hr-methodology__footer {
    margin: 0.75rem 0 0;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    font-style: italic;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* ── Simulator Mode ─────────────────────────────────────────────────── */

.hr-sim {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.hr-sim__ring-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    position: relative;
}

.hr-sim__ring {
    width: 140px;
    height: 140px;
}

.hr-sim__ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 10;
}

.hr-sim__ring-fill {
    fill: none;
    stroke: #6366f1;
    stroke-width: 10;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;
}

.hr-sim__ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.hr-sim__score-val {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

.hr-sim__score-lbl {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.hr-sim__legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.75rem;
}

.hr-sim__legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hr-sim__dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.hr-sim__bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.hr-sim__bar-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hr-sim__bar-label {
    width: 80px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.hr-sim__bar-track {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.06);
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
}

.hr-sim__bar-fill {
    height: 100%;
    transition: width 0.5s ease;
}

.hr-sim__bar-val {
    font-size: 0.8rem;
    width: 90px;
    flex-shrink: 0;
}

.hr-sim__divider {
    border: none;
    border-top: 1px dashed var(--border);
    margin: 1.5rem 0;
}

.hr-sim__verdict {
    display: flex;
    justify-content: space-around;
    text-align: center;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 10px;
}

.hr-sim__verdict-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hr-sim__verdict-lbl {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hr-sim__verdict-val {
    font-size: 1.2rem;
    font-weight: 600;
}

.hr-sim__controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 600px) {
    .hr-sim__controls {
        grid-template-columns: 1fr;
    }
}

.hr-sim__ctrl {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.hr-sim__ctrl-lbl {
    font-size: 0.8rem;
    color: var(--text-primary);
}

.hr-sim__ctrl-hint {
    font-size: 0.68rem;
    color: var(--text-secondary);
    opacity: 0.75;
    margin-top: 2px;
    line-height: 1.3;
    max-width: 220px;
}

.hr-sim__range {
    width: 80px;
    accent-color: var(--accent);
}

.hr-sim__weight {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    min-width: 36px;
    text-align: center;
}
