/* KlokIn Checkbox — Nordic Precision */

.klokin-checkbox {
    --klokin-checkbox-active: #0f172a;
    --klokin-checkbox-border: #cbd5e1;
    --klokin-checkbox-surface: #ffffff;
    --klokin-checkbox-muted: #e2e8f0;
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    vertical-align: middle;
    isolation: isolate;
}

.klokin-checkbox__native {
    position: absolute !important;
    z-index: 2;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    clip: auto !important;
    clip-path: none !important;
    overflow: visible !important;
    white-space: normal !important;
    opacity: 0 !important;
    cursor: pointer;
}

.klokin-checkbox__control {
    position: relative;
    z-index: 1;
    display: flex;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.klokin-checkbox--default {
    width: 20px;
    height: 20px;
}

.klokin-checkbox--default .klokin-checkbox__control {
    width: 20px;
    height: 20px;
    border: 1px solid var(--klokin-checkbox-border);
    border-radius: 5px;
    background: var(--klokin-checkbox-surface);
    color: #ffffff;
    transform: scale(1);
    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        transform 120ms ease;
}

.klokin-checkbox__check {
    width: 14px;
    height: 14px;
    overflow: visible;
}

.klokin-checkbox__check path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 18;
    stroke-dashoffset: 18;
    transition: stroke-dashoffset 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.klokin-checkbox--default .klokin-checkbox__native:checked + .klokin-checkbox__control,
.klokin-checkbox--default .klokin-checkbox__native:indeterminate + .klokin-checkbox__control {
    border-color: var(--klokin-checkbox-active);
    background: var(--klokin-checkbox-active);
}

.klokin-checkbox--default .klokin-checkbox__native:checked + .klokin-checkbox__control .klokin-checkbox__check path {
    stroke-dashoffset: 0;
}

.klokin-checkbox--default .klokin-checkbox__native:indeterminate + .klokin-checkbox__control .klokin-checkbox__check path {
    d: path("M4 8h8");
    stroke-dasharray: 8;
    stroke-dashoffset: 0;
}

.klokin-checkbox--default .klokin-checkbox__native:active + .klokin-checkbox__control {
    transform: scale(0.9);
}

.klokin-checkbox--choice {
    min-width: 40px;
    height: 36px;
}

.klokin-checkbox--choice .klokin-checkbox__control {
    min-width: 40px;
    height: 36px;
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}

.klokin-checkbox--choice .klokin-checkbox__choice-label {
    display: block;
    white-space: nowrap;
}

.klokin-checkbox--choice .klokin-checkbox__native:checked + .klokin-checkbox__control {
    border-color: #0f172a;
    background: #0f172a;
    color: #ffffff;
}

.klokin-checkbox--choice .klokin-checkbox__native:active + .klokin-checkbox__control {
    transform: scale(0.94);
}

.klokin-checkbox--radio,
.klokin-checkbox--radio-card {
    width: 20px;
    height: 20px;
}

.klokin-checkbox--radio .klokin-checkbox__control,
.klokin-checkbox--radio-card .klokin-checkbox__control {
    width: 20px;
    height: 20px;
    border: 1px solid var(--klokin-checkbox-border);
    border-radius: 50%;
    background: var(--klokin-checkbox-surface);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}

.klokin-checkbox__radio-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--klokin-checkbox-active);
    opacity: 0;
    transform: scale(0.45);
    transition: opacity 140ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.klokin-checkbox--radio .klokin-checkbox__native:checked + .klokin-checkbox__control,
.klokin-checkbox--radio-card .klokin-checkbox__native:checked + .klokin-checkbox__control {
    border-color: var(--klokin-checkbox-active);
}

.klokin-checkbox--radio .klokin-checkbox__native:checked + .klokin-checkbox__control .klokin-checkbox__radio-dot,
.klokin-checkbox--radio-card .klokin-checkbox__native:checked + .klokin-checkbox__control .klokin-checkbox__radio-dot {
    opacity: 1;
    transform: scale(1);
}

.klokin-checkbox--radio .klokin-checkbox__native:active + .klokin-checkbox__control,
.klokin-checkbox--radio-card .klokin-checkbox__native:active + .klokin-checkbox__control {
    transform: scale(0.9);
}

.klokin-checkbox--switch {
    width: 44px;
    height: 24px;
}

.klokin-checkbox--switch .klokin-checkbox__control {
    width: 44px;
    height: 24px;
    padding: 2px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--klokin-checkbox-muted);
    transition:
        background-color 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.klokin-checkbox__thumb {
    display: block;
    width: 20px;
    height: 20px;
    margin-right: auto;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 5px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
    transform: translateX(0);
    transition:
        transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
        width 120ms ease,
        box-shadow 180ms ease;
}

.klokin-checkbox--switch .klokin-checkbox__native:checked + .klokin-checkbox__control {
    background: var(--klokin-checkbox-active);
}

.klokin-checkbox--switch .klokin-checkbox__native:checked + .klokin-checkbox__control .klokin-checkbox__thumb {
    transform: translateX(20px);
}

.klokin-checkbox--switch .klokin-checkbox__native:active + .klokin-checkbox__control .klokin-checkbox__thumb {
    width: 23px;
}

.klokin-checkbox--switch .klokin-checkbox__native:checked:active + .klokin-checkbox__control .klokin-checkbox__thumb {
    transform: translateX(17px);
}

.klokin-checkbox__native:focus-visible + .klokin-checkbox__control {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgba(226, 232, 240, 0.9);
}

.klokin-checkbox__native:disabled {
    cursor: not-allowed;
}

.klokin-checkbox__native:disabled + .klokin-checkbox__control {
    opacity: 0.48;
}

.dark .klokin-checkbox {
    --klokin-checkbox-active: #f4f4f5;
    --klokin-checkbox-border: #52525b;
    --klokin-checkbox-surface: #09090b;
    --klokin-checkbox-muted: #27272a;
}

.dark .klokin-checkbox--default .klokin-checkbox__native:checked + .klokin-checkbox__control,
.dark .klokin-checkbox--default .klokin-checkbox__native:indeterminate + .klokin-checkbox__control {
    color: #09090b;
}

.dark .klokin-checkbox--switch .klokin-checkbox__native:checked + .klokin-checkbox__control {
    background: #f4f4f5;
}

.dark .klokin-checkbox--switch .klokin-checkbox__native:checked + .klokin-checkbox__control .klokin-checkbox__thumb {
    border-color: #09090b;
    background: #09090b;
    box-shadow: none;
}

.dark .klokin-checkbox--choice .klokin-checkbox__control {
    border-color: #3f3f46;
    background: #18181b;
    color: #d4d4d8;
}

.dark .klokin-checkbox--choice .klokin-checkbox__native:checked + .klokin-checkbox__control {
    border-color: #f4f4f5;
    background: #f4f4f5;
    color: #09090b;
}

.dark .klokin-checkbox__native:focus-visible + .klokin-checkbox__control {
    border-color: #71717a;
    box-shadow: 0 0 0 3px rgba(39, 39, 42, 0.9);
}

@media (prefers-reduced-motion: reduce) {
    .klokin-checkbox__control,
    .klokin-checkbox__check path,
    .klokin-checkbox__thumb {
        transition-duration: 0.01ms !important;
    }
}
