/* ====================================================================
   Creativelines — Forms (Phase 1)
   Floating labels · checkboxes/radios · switches · file dropzones ·
   range sliders · search · validation · multi-step indicators
   ==================================================================== */


/* ============================================================
   FORM LAYOUT
   ============================================================ */

.form { width: 100%; }

.form-row {
    display: grid;
    gap: var(--sp-4);
    grid-template-columns: 1fr 1fr;
}
@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
}

.form-section {
    padding: var(--sp-6) 0;
    border-bottom: 1px solid var(--cl-border);
}
.form-section:last-child { border-bottom: none; }
.form-section__title {
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    font-weight: 600;
    margin-bottom: var(--sp-2);
    letter-spacing: -0.02em;
}
.form-section__sub {
    color: var(--cl-fg-muted);
    font-size: var(--fs-sm);
    margin-bottom: var(--sp-5);
}

.form-help {
    display: block;
    font-size: var(--fs-xs);
    color: var(--cl-fg-muted);
    margin-top: var(--sp-1);
}

.form-required {
    color: var(--cl-red);
    margin-left: 2px;
}


/* ============================================================
   FLOATING LABEL INPUT
   ============================================================ */

.field {
    position: relative;
    margin-bottom: var(--sp-5);
}

.field__input,
.field__textarea,
.field__select {
    display: block;
    width: 100%;
    padding: 1.6em var(--input-pad-x) 0.6em;
    background: var(--input-bg);
    color: var(--cl-fg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--input-radius);
    font-size: var(--fs-base);
    font-family: inherit;
    transition: border-color var(--t-base), background var(--t-base);
}

.field__input::placeholder,
.field__textarea::placeholder { color: transparent; }

.field__label {
    position: absolute;
    top: 1.05em;
    left: var(--input-pad-x);
    color: var(--cl-fg-subtle);
    font-size: var(--fs-base);
    pointer-events: none;
    transition: all var(--t-base) var(--ease-out);
    background: transparent;
}

.field__input:focus,
.field__textarea:focus,
.field__select:focus {
    outline: none;
    border-color: var(--input-border-focus);
}

/* Label floats up on focus or when filled */
.field__input:focus + .field__label,
.field__input:not(:placeholder-shown) + .field__label,
.field__textarea:focus + .field__label,
.field__textarea:not(:placeholder-shown) + .field__label,
.field--filled .field__label {
    top: 0.55em;
    font-size: var(--fs-xs);
    color: var(--cl-yellow);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 600;
}

.field__textarea { min-height: 140px; resize: vertical; }


/* States */
.field--error .field__input,
.field--error .field__textarea,
.field--error .field__select { border-color: var(--status-error); }
.field--error .field__label { color: var(--status-error) !important; }
.field__error {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    font-size: var(--fs-xs);
    color: var(--status-error);
    margin-top: var(--sp-1);
}

.field--success .field__input,
.field--success .field__textarea,
.field--success .field__select { border-color: var(--status-success); }


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

.checkbox {
    display: inline-flex;
    align-items: flex-start;
    gap: var(--sp-3);
    cursor: pointer;
    position: relative;
    line-height: 1.4;
    user-select: none;
}
.checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.checkbox__box {
    flex-shrink: 0;
    width: 22px; height: 22px;
    border: 1.5px solid var(--cl-border-strong);
    border-radius: var(--r-sm);
    background: var(--cl-bg-elevated);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-base) var(--ease-out);
    margin-top: 1px;
}
.checkbox__box svg {
    width: 14px; height: 14px;
    color: var(--cl-black);
    transform: scale(0);
    transition: transform var(--t-base) var(--ease-bounce);
}
.checkbox input:checked ~ .checkbox__box {
    background: var(--cl-yellow);
    border-color: var(--cl-yellow);
}
.checkbox input:checked ~ .checkbox__box svg {
    transform: scale(1);
}
.checkbox:hover .checkbox__box { border-color: var(--cl-yellow); }
.checkbox input:focus-visible ~ .checkbox__box {
    box-shadow: 0 0 0 4px rgba(232,185,35,0.25);
}
.checkbox__label { color: var(--cl-fg); font-size: var(--fs-sm); }


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

.radio {
    display: inline-flex;
    align-items: flex-start;
    gap: var(--sp-3);
    cursor: pointer;
    line-height: 1.4;
    user-select: none;
}
.radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.radio__box {
    flex-shrink: 0;
    width: 22px; height: 22px;
    border: 1.5px solid var(--cl-border-strong);
    border-radius: 50%;
    background: var(--cl-bg-elevated);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-base) var(--ease-out);
    margin-top: 1px;
}
.radio__box::after {
    content: '';
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--cl-yellow);
    transform: scale(0);
    transition: transform var(--t-base) var(--ease-bounce);
}
.radio input:checked ~ .radio__box::after { transform: scale(1); }
.radio input:checked ~ .radio__box { border-color: var(--cl-yellow); }
.radio:hover .radio__box { border-color: var(--cl-yellow); }
.radio__label { color: var(--cl-fg); font-size: var(--fs-sm); }


/* ============================================================
   SWITCH (toggle)
   ============================================================ */

.switch {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    cursor: pointer;
    user-select: none;
}
.switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.switch__track {
    position: relative;
    width: 44px; height: 24px;
    background: var(--cl-bg-elevated);
    border: 1.5px solid var(--cl-border-strong);
    border-radius: var(--r-pill);
    transition: all var(--t-base) var(--ease-out);
    flex-shrink: 0;
}
.switch__thumb {
    position: absolute;
    top: 2px; left: 2px;
    width: 17px; height: 17px;
    background: var(--cl-fg-muted);
    border-radius: 50%;
    transition: all var(--t-base) var(--ease-out);
}
.switch input:checked ~ .switch__track {
    background: var(--cl-yellow);
    border-color: var(--cl-yellow);
}
.switch input:checked ~ .switch__track .switch__thumb {
    transform: translateX(20px);
    background: var(--cl-black);
}
.switch__label {
    font-size: var(--fs-sm);
    color: var(--cl-fg);
}


/* ============================================================
   FILE DROPZONE
   ============================================================ */

.dropzone {
    position: relative;
    display: block;
    padding: var(--sp-10) var(--sp-6);
    background: var(--cl-bg-elevated);
    border: 2px dashed var(--cl-border-strong);
    border-radius: var(--r-lg);
    text-align: center;
    cursor: pointer;
    transition: all var(--t-base) var(--ease-out);
}
.dropzone:hover,
.dropzone.is-drag {
    border-color: var(--cl-yellow);
    background: color-mix(in srgb, var(--cl-yellow) 6%, var(--cl-bg-elevated));
}
.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.dropzone__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px; height: 56px;
    background: var(--cl-yellow);
    color: var(--cl-black);
    border-radius: 50%;
    margin-bottom: var(--sp-4);
}
.dropzone__icon svg { width: 24px; height: 24px; }
.dropzone__text {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--cl-fg);
    margin-bottom: var(--sp-1);
}
.dropzone__text strong { color: var(--cl-yellow); }
.dropzone__hint {
    font-size: var(--fs-xs);
    color: var(--cl-fg-muted);
}

.dropzone__preview {
    margin-top: var(--sp-4);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: var(--sp-3);
}
.dropzone__file {
    position: relative;
    aspect-ratio: 1;
    background: var(--cl-bg-alt);
    border-radius: var(--r-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-xs);
}
.dropzone__file img { width: 100%; height: 100%; object-fit: cover; }


/* ============================================================
   SEARCH INPUT
   ============================================================ */

.search {
    position: relative;
    display: flex;
    align-items: center;
}
.search__input {
    width: 100%;
    padding: 0.9em 1em 0.9em 2.6em;
    background: var(--cl-bg-elevated);
    color: var(--cl-fg);
    border: 1.5px solid var(--cl-border);
    border-radius: var(--r-pill);
    font-size: var(--fs-base);
    transition: border-color var(--t-base);
}
.search__input:focus {
    outline: none;
    border-color: var(--cl-yellow);
}
.search__icon {
    position: absolute;
    left: 1em;
    width: 18px; height: 18px;
    color: var(--cl-fg-subtle);
    pointer-events: none;
}
.search__clear {
    position: absolute;
    right: 0.5em;
    width: 28px; height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--cl-fg-subtle);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--t-base);
}
.search__clear:hover { background: var(--cl-bg-alt); color: var(--cl-fg); }


/* ============================================================
   RANGE SLIDER (custom styled)
   ============================================================ */

.range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--cl-bg-elevated);
    border-radius: var(--r-pill);
    outline: none;
    cursor: pointer;
}
.range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px; height: 22px;
    background: var(--cl-yellow);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--cl-bg);
    box-shadow: var(--shadow-md);
    transition: transform var(--t-base) var(--ease-bounce);
}
.range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.range::-moz-range-thumb {
    width: 22px; height: 22px;
    background: var(--cl-yellow);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--cl-bg);
    box-shadow: var(--shadow-md);
}


/* ============================================================
   STEP INDICATOR (multi-step forms)
   ============================================================ */

.steps {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-8);
    overflow-x: auto;
}
.step {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-shrink: 0;
}
.step__num {
    width: 36px; height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--cl-bg-elevated);
    color: var(--cl-fg-muted);
    border: 1.5px solid var(--cl-border);
    border-radius: 50%;
    font-weight: 700;
    font-size: var(--fs-sm);
    transition: all var(--t-base) var(--ease-out);
}
.step__label {
    color: var(--cl-fg-muted);
    font-size: var(--fs-sm);
    font-weight: 500;
}
.step__connector {
    flex: 1;
    height: 1.5px;
    background: var(--cl-border);
    min-width: 30px;
}
.step.is-active .step__num {
    background: var(--cl-yellow);
    color: var(--cl-black);
    border-color: var(--cl-yellow);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--cl-yellow) 25%, transparent);
}
.step.is-active .step__label { color: var(--cl-fg); }
.step.is-complete .step__num {
    background: var(--cl-yellow);
    color: var(--cl-black);
    border-color: var(--cl-yellow);
}
.step.is-complete + .step__connector,
.step.is-complete .step__connector { background: var(--cl-yellow); }


/* ============================================================
   LABEL GROUPS (button-style choices)
   ============================================================ */

.choice-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}
.choice {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0.7em 1.2em;
    border: 1.5px solid var(--cl-border);
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: all var(--t-base) var(--ease-out);
    background: transparent;
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--cl-fg-muted);
}
.choice input { position: absolute; opacity: 0; }
.choice:hover {
    border-color: var(--cl-yellow);
    color: var(--cl-fg);
}
.choice:has(input:checked),
.choice.is-active {
    background: var(--cl-yellow);
    color: var(--cl-black);
    border-color: var(--cl-yellow);
}
