/* ============================================================================
   _game-calc.css — Zone 2: the calculator CONSOLE (one sleek panel)
   ============================================================================
   ONE cohesive, flat panel — hairline border, tiny shadow, tight internal
   rhythm with a hairline divider between the "Jouw systeem" inputs and the
   settings block — instead of a stack of gray cards. Modern SaaS-dashboard
   density (Linear / Vercel): small uppercase micro-eyebrow labels, compact
   sleeker controls, tight gaps, no gamer power-strips.

   Uses the shared type + spacing scale declared in _game-hero.css (resolves at
   use-time regardless of stylesheet order). Tokens only; active filled states
   pair --accent with --bg-primary text so they hold AA contrast in BOTH themes.
   ============================================================================ */

/* ---------- Shell: site-standard width, tight vertical rhythm --------- */

.fps-calc-shell {
    max-width: 1400px;
    margin-inline: auto;
    padding-inline: clamp(1rem, 3vw, 1.5rem);
    display: flex;
    flex-direction: column;
    gap: var(--fps-rhythm);
}

/* The shell's gap owns vertical rhythm — drop standalone margins. */
.fps-calc-shell > * {
    margin-block: 0;
}

/* ---------- Dashboard: compact 2-col console + live readout ----------- */
/* The whole tool fits in ~one desktop viewport: LEFT = the calculator console
   (inputs + settings), RIGHT = the live results readout. They stack on mobile
   (console first, then results). The console sticks while the taller readout /
   chart scrolls, so the controls stay in reach — dashboard behaviour. */

.fps-dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--fps-rhythm);
    align-items: start;
}

.fps-dashboard__console,
.fps-dashboard__readout {
    min-width: 0;
}

/* The readout owns its own vertical rhythm between the result panel /
   empty-state and any toast, matching the console's internal gaps. */
.fps-dashboard__readout {
    display: flex;
    flex-direction: column;
    gap: var(--fps-gap);
}

@media (min-width: 960px) {
    .fps-dashboard {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        gap: clamp(1rem, 2vw, 1.5rem);
    }

    /* Console sticks so inputs stay visible while the readout/chart scrolls. */
    .fps-dashboard__console {
        position: sticky;
        top: clamp(0.75rem, 2vh, 1.25rem);
        align-self: start;
    }
}

/* ---------- Console: one flat, hairline panel ------------------------- */

.fps-calc-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--fps-pad);
    background: var(--bg-secondary);
    border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border));
    border-radius: var(--radius-lg);
    /* Softer two-layer depth: the token shadow + a low, wide accent-tinted bleed. */
    box-shadow: var(--shadow-sm),
                0 12px 30px -16px color-mix(in srgb, var(--accent) 24%, transparent);
    padding: var(--fps-pad);
}

/* Refined top edge — a 1px accent→transparent hairline that catches the light. */
.fps-calc-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: clamp(0.75rem, 3vw, 1.5rem);
    right: clamp(0.75rem, 3vw, 1.5rem);
    height: 1px;
    background: linear-gradient(90deg,
                transparent,
                color-mix(in srgb, var(--accent) 55%, transparent),
                transparent);
    pointer-events: none;
}

/* Hairline divider between inputs and settings — depth without a second box. */
.fps-calc-card .fps-settings {
    padding-top: var(--fps-pad);
    border-top: 1px solid var(--border);
}

/* ---------- "Jouw systeem" inputs ------------------------------------- */

.fps-sys {
    display: flex;
    flex-direction: column;
    gap: var(--fps-gap);
}

.fps-sys__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.fps-sys__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--fps-fs-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

/* Game switch chip — compact, replaces the old duplicate cover sidebar. */
.fps-gameswitch {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    max-width: 100%;
    padding: 0.3125rem 0.6875rem;
    background: color-mix(in srgb, var(--accent) 8%, var(--bg-tertiary));
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: var(--fps-fs-sm);
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.fps-gameswitch:hover,
.fps-gameswitch:focus-visible {
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.fps-gameswitch svg {
    color: var(--accent);
    flex-shrink: 0;
}

.fps-gameswitch__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fps-gameswitch__action {
    flex-shrink: 0;
    color: var(--accent);
    font-weight: 700;
}

/* Auto-fit so GPU/CPU/RAM pack into the ACTUAL console width (not the viewport):
   3 across in the wide left column, gracefully folding to 2/1 when narrow. */
.fps-sys__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: var(--fps-gap);
}

.fps-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

.fps-field__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    min-height: 1.25rem;
}

/* Micro uppercase eyebrow; the icon doubles as the accent tick. */
.fps-field__label-text {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--fps-fs-eyebrow);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.fps-field__label-text svg {
    width: 14px;
    height: 14px;
    color: var(--accent);
    flex-shrink: 0;
}

.fps-field__links {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

/* Dropdowns fill their field column. */
.fps-field .hardware-dropdown,
.fps-field .ram-dropdown-wrapper {
    width: 100%;
}

/* Sleeker control height + radius, scoped to the console (44px stays the
   default elsewhere, e.g. the game-selector modal). */
.fps-calc-card .dropdown-trigger {
    min-height: var(--fps-control-h);
    border-radius: var(--radius-md);
}

/* Accent focus ring for keyboard users (control internals owned by
   _dropdowns.css; only the surrounding depth is added here). */
.fps-field .hardware-dropdown:focus-within .dropdown-trigger,
.fps-field .ram-dropdown-wrapper:focus-within .dropdown-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.fps-field__hint {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    font-size: var(--fps-fs-xs);
    color: var(--text-muted);
}

.fps-field__hint strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ---------- Modern selects (console-scoped restyle) ------------------- */
/* Sleeker triggers + a detached, fully-rounded floating menu with a subtle
   accent focus ring. Scoped to .fps-dashboard__console so the shared
   game-selector modal (which reuses _dropdowns.css) is untouched. Only the
   presentation changes — every Alpine binding stays as-is. */

.fps-dashboard__console .dropdown-trigger {
    min-height: var(--fps-control-h);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border-color: var(--border);
    box-shadow: none;
    font-weight: 500;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.fps-dashboard__console .dropdown-trigger:hover {
    border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
    background: color-mix(in srgb, var(--accent) 4%, var(--bg-secondary));
    box-shadow: none;
}

.fps-dashboard__console .dropdown-trigger.is-open {
    /* Keep it a rounded button — no bottom-flattening; the menu detaches. */
    border-radius: var(--radius-md);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* Detached, fully-rounded floating menu (modern popover, not a stuck drawer). */
.fps-dashboard__console .dropdown-menu {
    top: calc(100% + 6px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Clean selected state — accent tint + a tidy leading accent bar (kept). */
.fps-dashboard__console .dropdown-option.is-selected {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* Native selects (upscaling / RT / resolution steps) share the trigger radius. */
.fps-dashboard__console .config-select {
    border-radius: var(--radius-md);
}

.fps-dashboard__console .config-select:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

@media (prefers-reduced-motion: reduce) {
    .fps-dashboard__console .dropdown-trigger {
        transition: none;
    }
}

/* ---------- Settings: preset-first, compact control panel ------------- */

.fps-settings {
    display: flex;
    flex-direction: column;
    gap: var(--fps-gap);
}

.fps-set-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fps-set-block__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Uppercase micro-eyebrow with a small accent tick before it. */
.fps-set-block__label {
    position: relative;
    padding-left: 0.75rem;
    font-size: var(--fps-fs-eyebrow);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* Accent tick — a 3px rounded vertical bar (was a round dot). */
.fps-set-block__label::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0.6875rem;
    border-radius: 2px;
    background: var(--accent);
}

.fps-set-block__info-wrap {
    position: relative;
    display: inline-flex;
}

.fps-set-block__info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease;
}

.fps-set-block__info:hover {
    color: var(--accent);
}

/* ---------- Preset segmented control — refined, compact --------------- */

/* iOS-style segmented control: an inset, fully-rounded track holding pill
   segments. The active segment is an accent pill; inactive are plain text. */
.fps-preset__segments {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 3px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    box-shadow: inset 0 1px 2px color-mix(in srgb, var(--border) 55%, transparent);
}

.fps-preset__btn {
    flex: 1 1 4rem;
    min-width: 3.75rem;
    min-height: var(--fps-segment-h);
    padding: 0.375rem 0.5rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: var(--fps-fs-sm);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.fps-preset__btn:hover:not(.is-active) {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.fps-preset__btn.is-active {
    background: var(--accent);
    color: var(--bg-primary);
    font-weight: 700;
    box-shadow: 0 1px 4px color-mix(in srgb, var(--accent) 32%, transparent);
}

/* ---------- Compact control grid: upscaling + RT + resolution --------- */

/* Auto-fit to the console width so upscaling + RT + resolution stay a tidy
   multi-column grid regardless of the surrounding dashboard column. */
.fps-controls__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: var(--fps-gap);
    align-items: start;
}

/* The upscaling multi-selector always claims the full control row. */
.fps-ctrl--wide {
    grid-column: 1 / -1;
}

.fps-ctrl {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

.fps-ctrl__label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 1.125rem;
}

.fps-ctrl__label-text {
    font-size: var(--fps-fs-eyebrow);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fps-ctrl__info-wrap {
    position: relative;
    display: inline-flex;
    margin-left: auto;
}

.fps-ctrl__control {
    min-width: 0;
}

/* Controls fill their cell at the sleeker console height. */
.fps-ctrl__control .config-select {
    width: 100%;
    min-height: var(--fps-control-h);
}

.fps-ctrl__control .resolution-dropdown-wrapper,
.fps-ctrl__control .upscaling-dropdown-wrapper {
    position: relative;
    width: 100%;
}

.fps-ctrl__control .dropdown-trigger {
    width: 100%;
}

.fps-ctrl__control .resolution-dropdown-wrapper:focus-within .dropdown-trigger,
.fps-ctrl__control .upscaling-dropdown-wrapper:focus-within .dropdown-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* Ray-tracing style pill toggles stretch to fill the cell. */
.fps-ctrl__control .gscat-pill-toggle {
    display: flex;
    width: 100%;
}

.fps-ctrl__control .gscat-pill-toggle__btn {
    flex: 1 1 0;
    min-width: 0;
}

/* v6 upscaling multi-selector — neat wrapping row of compact controls. */
.fps-ctrl .upscaling-v6-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    width: 100%;
}

.fps-ctrl .upscaling-v6-wrapper .config-select {
    width: auto;
    flex: 1 1 7.5rem;
    min-width: 6rem;
}

.fps-ctrl .upscaling-framegen-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    flex: 1 1 auto;
    min-height: var(--fps-control-h);
    padding: 0 0.6875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--fps-fs-sm);
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.fps-ctrl .upscaling-framegen-toggle:hover {
    border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
}

.fps-ctrl .upscaling-framegen-toggle input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ---------- Advanced — subtle, compact collapsible toggle ------------- */

.fps-advanced {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.fps-advanced__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    width: auto;
    min-height: var(--fps-control-h);
    padding: 0.375rem 0.875rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: var(--fps-fs-sm);
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.fps-advanced__toggle:hover {
    color: var(--text-primary);
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.fps-advanced__chevron {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
}

.fps-advanced__toggle.is-open .fps-advanced__chevron {
    transform: rotate(90deg);
    color: var(--accent);
}

.fps-advanced__count {
    color: var(--text-muted);
    font-weight: 600;
}

.fps-advanced__body {
    display: flex;
    flex-direction: column;
    gap: var(--fps-gap);
    width: 100%;
    margin-top: 0.625rem;
    padding: var(--fps-pad-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.fps-advanced__group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.fps-advanced__group-label {
    padding-top: 0.25rem;
    font-size: var(--fps-fs-eyebrow);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.fps-advanced__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 0;
}

.fps-advanced__row + .fps-advanced__row {
    border-top: 1px solid var(--border);
}

.fps-advanced__row-left {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.fps-advanced__name {
    font-size: var(--fps-fs-base);
    color: var(--text-primary);
}

.fps-advanced__row-control {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.fps-advanced__row-control .config-select {
    min-width: 9rem;
    min-height: var(--fps-control-h);
}

/* ---------- Calculate button — sleeker height, scoped to the console --- */

.fps-calc-card .btn-calculate {
    min-height: var(--fps-control-h);
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: var(--fps-fs-base);
    /* Filled accent with a subtle top-lit vertical gradient; --bg-primary text
       holds AA contrast in both themes. */
    background: linear-gradient(180deg,
                color-mix(in srgb, var(--accent) 85%, white),
                var(--accent));
    color: var(--bg-primary);
    box-shadow: var(--shadow-sm),
                0 4px 12px -6px color-mix(in srgb, var(--accent) 40%, transparent);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.fps-calc-card .btn-calculate:hover:not(:disabled) {
    background: linear-gradient(180deg,
                color-mix(in srgb, var(--accent) 92%, white),
                color-mix(in srgb, var(--accent) 96%, white));
    box-shadow: var(--shadow-sm),
                0 8px 22px -6px color-mix(in srgb, var(--accent) 48%, transparent);
    transform: translateY(-1px);
}

.fps-calc-card .btn-calculate:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
    box-shadow: var(--shadow-sm),
                0 3px 10px -6px color-mix(in srgb, var(--accent) 40%, transparent);
}

.fps-calc-card .btn-calculate:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
    box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    .fps-gameswitch,
    .fps-preset__btn,
    .fps-advanced__toggle,
    .fps-advanced__chevron,
    .fps-set-block__info,
    .fps-calc-card .btn-calculate,
    .fps-ctrl .upscaling-framegen-toggle {
        transition: none;
    }

    .fps-calc-card .btn-calculate:hover:not(:disabled),
    .fps-calc-card .btn-calculate:active:not(:disabled) {
        transform: none;
    }
}
