/*
 * DEEPTASK Reusable Number Stepper Module.
 * Replaces native browser <input type="number"> spin buttons with a tokenized,
 * pure-CSS chevron stepper that works inside .dt-input-shell or standalone.
 * 100% var(--deeptask-*) color tokens; zero SVG/icon markup.
 */

/* Hide ugly native browser spin buttons on number inputs */
.deeptask-scope input[type="number"].dt-input::-webkit-inner-spin-button,
.deeptask-scope input[type="number"].dt-input::-webkit-outer-spin-button,
.deeptask-scope .dt-number-stepper-ready input[type="number"]::-webkit-inner-spin-button,
.deeptask-scope .dt-number-stepper-ready input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.deeptask-scope input[type="number"].dt-input,
.deeptask-scope .dt-number-stepper-ready input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Standalone host wrapper when used outside .dt-input-shell */
.deeptask-scope .dt-number-stepper {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Visually hidden source <input type="number"> when formatted currency display is active */
.deeptask-scope .dt-number-source {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    border: 0 !important;
}

/* Reserve space on the right edge for the custom vertical stepper */
.deeptask-scope .dt-input-shell.dt-number-stepper-ready .dt-input-control,
body.deeptask-admin-screen .deeptask-scope .dt-input-shell.dt-number-stepper-ready .dt-input-control,
.deeptask-scope .dt-number-stepper.dt-number-stepper-ready > :is(input[type="number"], .dt-number-display) {
    padding-right: 40px;
}

/* Stepper control container */
.deeptask-scope .dt-number-stepper__controls {
    position: absolute;
    z-index: 2;
    top: 4px;
    right: 4px;
    bottom: 4px;
    display: flex;
    flex-direction: column;
    width: 30px;
    border-radius: var(--deeptask-radius-sm);
    border: 1px solid var(--deeptask-color-border);
    background: var(--deeptask-color-panel);
    overflow: hidden;
    box-sizing: border-box;
    transition: border-color 180ms ease, background 180ms ease;
}

.deeptask-scope .dt-input-shell.dt-input-disabled .dt-number-stepper__controls,
.deeptask-scope .dt-input-shell.dt-input-readonly .dt-number-stepper__controls,
.deeptask-scope .dt-number-stepper.is-disabled .dt-number-stepper__controls {
    border-color: var(--deeptask-color-border);
    background: var(--deeptask-color-disabled-bg);
}

/* Individual up / down stepper buttons */
.deeptask-scope .dt-number-stepper__btn {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--deeptask-color-transparent);
    color: var(--deeptask-color-text-muted);
    cursor: pointer;
    box-shadow: none;
    outline: none;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 140ms ease, color 140ms ease;
}

.deeptask-scope .dt-number-stepper__btn + .dt-number-stepper__btn {
    border-top: 1px solid var(--deeptask-color-border);
}

/* Pure-CSS geometric chevrons (zero SVG) */
.deeptask-scope .dt-number-stepper__btn::before {
    content: "";
    display: block;
    width: 6px;
    height: 6px;
    border-right: 1.75px solid currentColor;
    border-bottom: 1.75px solid currentColor;
    box-sizing: border-box;
}

.deeptask-scope .dt-number-stepper__btn--up::before {
    transform: translateY(1.5px) rotate(-135deg);
}

.deeptask-scope .dt-number-stepper__btn--down::before {
    transform: translateY(-1.5px) rotate(45deg);
}

@media (hover: hover) {
    .deeptask-scope .dt-number-stepper__btn:not(:disabled):hover {
        background: var(--deeptask-color-primary-soft);
        color: var(--deeptask-color-primary);
    }
}

.deeptask-scope .dt-number-stepper__btn:not(:disabled):active {
    background: var(--deeptask-color-primary-tint);
    color: var(--deeptask-color-primary);
}

.deeptask-scope .dt-number-stepper__btn:disabled {
    color: var(--deeptask-color-text-disabled);
    background: var(--deeptask-color-transparent);
    cursor: not-allowed;
}
