/**
 * Input Component Styles
 * Matches CodeSignal Design System
 */

:root {
    /* Input Variables */
    --Colors-Input-Background-Default: var(--Colors-Base-Neutral-00);
    --Colors-Input-Border-Default: var(--Colors-Stroke-Default);
    --Colors-Input-Border-Hover: var(--Colors-Stroke-Strong);
    --Colors-Input-Border-Focus: var(--Colors-Stroke-Primary);
    --Colors-Input-Text-Default: var(--Colors-Text-Body-Default);
    --Colors-Input-Text-Placeholder: var(--Colors-Text-Body-Light);
    --Colors-Input-Shadow-Focus: rgba(92, 148, 255, 0.12);
}

@media (prefers-color-scheme: dark) {
    :root {
        --Colors-Input-Background-Default: var(--Colors-Base-Neutral-Alphas-1400-50);
        --Colors-Input-Border-Default: var(--Colors-Base-Neutral-1250);
        --Colors-Input-Border-Hover: var(--Colors-Base-Neutral-1150);
        --Colors-Input-Border-Focus: var(--Colors-Base-Primary-600);
        --Colors-Input-Text-Default: var(--Colors-Text-Body-Strong);
        --Colors-Input-Text-Placeholder: var(--Colors-Text-Body-Light);
        --Colors-Input-Shadow-Focus: rgba(92, 148, 255, 0.12);
    }
}

.input {
    display: flex;
    width: 100%;
    height: var(--UI-Input-md);
    padding: var(--UI-Spacing-spacing-none) var(--UI-Spacing-spacing-ms);
    align-items: center;
    gap: var(--UI-Spacing-spacing-xs);
    flex-shrink: 0;
    border-radius: var(--UI-Radius-radius-s);
    background: var(--Colors-Input-Background-Default);
    border: 1px solid var(--Colors-Input-Border-Default);
    
    color: var(--Colors-Input-Text-Default);
    
    font-family: var(--body-family);
    font-size: var(--Fonts-Body-Default-md);
    font-style: normal;
    font-weight: 400;
    line-height: 145%;
    letter-spacing: -0.16px;
    
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input::placeholder {
    color: var(--Colors-Input-Text-Placeholder);
}

.input:hover,
.input.hover {
    border-color: var(--Colors-Input-Border-Hover);
}

.input:focus,
.input.focus {
    outline: none;
    border-color: var(--Colors-Input-Border-Focus);
    box-shadow: 0 0 0 4px var(--Colors-Input-Shadow-Focus);
}

.input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Number Input Spinner Buttons */
/* WebKit browsers (Chrome, Safari, Edge) */
/* Style the spinner buttons to be more subtle and better integrated */
.input[type="number"]::-webkit-inner-spin-button {
    opacity: 0.6;
    height: 36px;
    width: 32px;
    cursor: pointer;
    margin-right: -4px;
    transition: opacity 0.2s ease;
}

.input[type="number"]::-webkit-outer-spin-button {
    opacity: 0.6;
    height: 36px;
    width: 32px;
    cursor: pointer;
    margin-right: -4px;
    transition: opacity 0.2s ease;
}

.input[type="number"]:hover::-webkit-inner-spin-button,
.input[type="number"]:hover::-webkit-outer-spin-button {
    opacity: 0.9;
}

.input[type="number"]:focus::-webkit-inner-spin-button,
.input[type="number"]:focus::-webkit-outer-spin-button {
    opacity: 1;
}

/* Firefox */
.input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.input[type="number"]::-moz-number-spin-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 2px;
    border: none;
    background: transparent;
}

.input[type="number"]::-moz-number-spin-up-button,
.input[type="number"]::-moz-number-spin-down-button {
    width: 10px;
    height: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.input[type="number"]::-moz-number-spin-up-button:hover,
.input[type="number"]::-moz-number-spin-down-button:hover {
    opacity: 1;
}

.input[type="number"]::-moz-number-spin-up-button {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='6' viewBox='0 0 8 6'%3E%3Cpath fill='%23999' d='M4 0L0 6h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.input[type="number"]::-moz-number-spin-down-button {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='6' viewBox='0 0 8 6'%3E%3Cpath fill='%23999' d='M4 6L0 0h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

/* ===== CHECKBOX INPUT ===== */

/* Checkbox Wrapper */
.input-checkbox {
    display: flex;
    align-items: center;
    gap: var(--UI-Spacing-spacing-mxs);
    cursor: pointer;
    user-select: none;
}

.input-checkbox.disabled {
    cursor: not-allowed;
}

/* Hide native checkbox */
.input-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

/* Custom Checkbox Box */
.input-checkbox-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--Colors-Input-Background-Default);
    border: 1.5px solid var(--Colors-Input-Border-Default);
    border-radius: var(--UI-Radius-radius-s);
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    width: 26px;
    height: 26px;
}

/* Small Size (26px) */
.input-checkbox-small {
    gap: var(--UI-Spacing-spacing-s);
}

.input-checkbox-small .input-checkbox-box {
    width: 26px;
    height: 26px;
}

/* XSmall Size (20px) */
.input-checkbox-xsmall {
    gap: var(--UI-Spacing-spacing-xs);
}

.input-checkbox-xsmall .input-checkbox-box {
    width: 20px;
    height: 20px;
    border-radius: var(--UI-Radius-radius-xs);
}

/* Checkmark Icon */
.input-checkbox-checkmark {
    display: none;
    width: 18px;
    height: 18px;
    position: relative;
}

.input-checkbox-small .input-checkbox-checkmark {
    width: 18px;
    height: 18px;
}

.input-checkbox-xsmall .input-checkbox-checkmark {
    width: 14px;
    height: 14px;
}

.input-checkbox-checkmark::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--Colors-Base-Neutral-00);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Cpath d='M3 9L7 13L15 5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Cpath d='M3 9L7 13L15 5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.input-checkbox-xsmall .input-checkbox-checkmark::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M2 7L5 10L12 3' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M2 7L5 10L12 3' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Checked State */
.input-checkbox input[type="checkbox"]:checked + .input-checkbox-box {
    background: var(--Colors-Primary-Default);
    border-color: var(--Colors-Primary-Default);
}

.input-checkbox input[type="checkbox"]:checked + .input-checkbox-box .input-checkbox-checkmark {
    display: block;
}

/* Hover State */
.input-checkbox:not(.disabled):hover .input-checkbox-box {
    border-color: var(--Colors-Stroke-Primary);
}

.input-checkbox input[type="checkbox"]:checked + .input-checkbox-box:hover {
    border-color: var(--Colors-Primary-Default);
}

/* Focus State */
.input-checkbox input[type="checkbox"]:focus + .input-checkbox-box {
    outline: none;
    border-color: var(--Colors-Input-Border-Focus);
}

.input-checkbox input[type="checkbox"]:checked:focus + .input-checkbox-box {
    border-color: var(--Colors-Primary-Default);
}

/* Disabled State */
.input-checkbox input[type="checkbox"]:disabled + .input-checkbox-box {
    opacity: 0.45;
    cursor: not-allowed;
}

.input-checkbox input[type="checkbox"]:disabled ~ .input-checkbox-label {
    opacity: 0.2;
    cursor: not-allowed;
}

.input-checkbox.disabled .input-checkbox-box {
    opacity: 0.45;
    cursor: not-allowed;
}

.input-checkbox.disabled .input-checkbox-label {
    opacity: 0.2;
    cursor: not-allowed;
}

/* Checkbox Label */
.input-checkbox-label {
    font-family: var(--body-family);
    font-size: var(--Fonts-Body-Default-lg);
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: -0.17px;
    color: var(--Colors-Text-Body-Strong);
    cursor: pointer;
}

.input-checkbox-small .input-checkbox-label {
    font-size: var(--Fonts-Body-Default-md);
    line-height: 1.45;
    letter-spacing: -0.16px;
}

.input-checkbox-xsmall .input-checkbox-label {
    font-size: var(--Fonts-Body-Default-xs);
    line-height: 1.35;
    letter-spacing: -0.14px;
}

.input-checkbox input[type="checkbox"]:disabled ~ .input-checkbox-label {
    cursor: not-allowed;
}

/* Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
    .input-checkbox-box {
        background: var(--Colors-Input-Background-Default);
        border-color: var(--Colors-Input-Border-Default);
    }
}

/* ===== RADIO INPUT ===== */

/* Radio Wrapper */
.input-radio {
    display: flex;
    align-items: center;
    gap: var(--UI-Spacing-spacing-mxs);
    cursor: pointer;
    user-select: none;
}

.input-radio.disabled {
    cursor: not-allowed;
}

/* Hide native radio */
.input-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

/* Custom Radio Circle */
.input-radio-circle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--Colors-Input-Background-Default);
    border: 1.5px solid var(--Colors-Input-Border-Default);
    border-radius: 50%;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    width: 26px;
    height: 26px;
}

/* Small Size (26px) */
.input-radio-small {
    gap: var(--UI-Spacing-spacing-s);
}

.input-radio-small .input-radio-circle {
    width: 26px;
    height: 26px;
}

/* XSmall Size (20px) */
.input-radio-xsmall {
    gap: var(--UI-Spacing-spacing-xs);
}

.input-radio-xsmall .input-radio-circle {
    width: 20px;
    height: 20px;
}

/* Radio Inner Dot */
.input-radio-dot {
    display: none;
    width: 14px;
    height: 14px;
    position: relative;
}

.input-radio-small .input-radio-dot {
    width: 12px;
    height: 12px;
}

.input-radio-xsmall .input-radio-dot {
    width: 10px;
    height: 10px;
}

.input-radio-dot::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--Colors-Base-Neutral-00);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2014%2014%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20cx%3D%227%22%20cy%3D%227%22%20r%3D%227%22%20fill%3D%22black%22%2F%3E%3C%2Fsvg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2014%2014%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20cx%3D%227%22%20cy%3D%227%22%20r%3D%227%22%20fill%3D%22black%22%2F%3E%3C%2Fsvg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

/* Checked State */
.input-radio input[type="radio"]:checked + .input-radio-circle {
    background: var(--Colors-Primary-Default);
    border-color: var(--Colors-Primary-Default);
}

.input-radio input[type="radio"]:checked + .input-radio-circle .input-radio-dot {
    display: block;
}

/* Hover State */
.input-radio:not(.disabled):hover .input-radio-circle {
    border-color: var(--Colors-Stroke-Primary);
}

.input-radio input[type="radio"]:checked + .input-radio-circle:hover {
    border-color: var(--Colors-Primary-Default);
}

/* Focus State */
.input-radio input[type="radio"]:focus + .input-radio-circle {
    outline: none;
    border-color: var(--Colors-Input-Border-Focus);
}

.input-radio input[type="radio"]:checked:focus + .input-radio-circle {
    border-color: var(--Colors-Primary-Default);
}

/* Disabled State */
.input-radio input[type="radio"]:disabled + .input-radio-circle {
    opacity: 0.45;
    cursor: not-allowed;
}

.input-radio input[type="radio"]:disabled ~ .input-radio-label {
    opacity: 0.2;
    cursor: not-allowed;
}

.input-radio.disabled .input-radio-circle {
    opacity: 0.45;
    cursor: not-allowed;
}

.input-radio.disabled .input-radio-label {
    opacity: 0.2;
    cursor: not-allowed;
}

/* Radio Label */
.input-radio-label {
    font-family: var(--body-family);
    font-size: var(--Fonts-Body-Default-lg);
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: -0.17px;
    color: var(--Colors-Text-Body-Strong);
    cursor: pointer;
}

.input-radio-small .input-radio-label {
    font-size: var(--Fonts-Body-Default-md);
    line-height: 1.45;
    letter-spacing: -0.16px;
}

.input-radio-xsmall .input-radio-label {
    font-size: var(--Fonts-Body-Default-xs);
    line-height: 1.35;
    letter-spacing: -0.14px;
}

.input-radio input[type="radio"]:disabled ~ .input-radio-label {
    cursor: not-allowed;
}

/* Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
    .input-radio-circle {
        background: var(--Colors-Input-Background-Default);
        border-color: var(--Colors-Input-Border-Default);
    }
}

