/* Forms */
.form-control,
.form-select {
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: var(--transition);
    /* background-color, not the background shorthand: the shorthand also
       resets background-image, which is where Bootstrap draws a select's
       dropdown chevron, so every .form-select lost its arrow. */
    background-color: var(--surface-card);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.form-label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.required::after {
    content: '*';
    color: var(--danger);
    margin-left: 4px;
}

/* Toggle switch - the binary-setting control used across the admin pages
   (Platform Config, Platform Stats, per-user Manage). It lives in this
   global stylesheet rather than in admin_base.html because two of those
   templates override base's extra_head block wholesale, with no
   block.super, so anything defined in admin_base.html never reaches them.
   base.html loads this file on every page, which sidesteps that entirely. */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-strong);
    transition: var(--transition);
    border-radius: 24px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

/* The track is only 24px tall, under the 44px minimum touch target, so an
   invisible overlay centred on it takes the taps instead. Visual size is
   unchanged; only the hit area grows. */
.switch-slider:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
}

.switch input:checked + .switch-slider {
    background-color: var(--primary);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(20px);
}

.switch input:focus-visible + .switch-slider {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
