/* =========================================
   Form Kit — Golriz Design System
   مکمل فایل اصلی؛ بعد از استایل داشبورد اضافه شود
========================================= */

/* =========================================
   1) Form Container & Layout
========================================= */
.form{
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-row{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.form-row--3{ grid-template-columns: repeat(3, 1fr); }
.form-row--full{ grid-template-columns: 1fr; }

@media (max-width: 500px){
    .form-row,
    .form-row--3{ grid-template-columns: 1fr; }
}

/* =========================================
   2) Field Base (Label + Input + Help)
========================================= */
.field{
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.field__label{
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.field__label .req{
    color: var(--brand-red);
    font-size: 14px;
    line-height: 1;
}

.field__hint{
    font-size: 10.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.field__hint i{ font-size: 10px; }

/* =========================================
   3) Text Inputs (Base)
========================================= */
.input{
    width: 100%;
    height: 44px;
    padding: 0 14px;

    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);

    background: var(--surface);
    border: 1.5px solid rgba(91, 62, 143, .12);
    border-radius: var(--radius-sm);
    outline: none;

    transition:
        border-color var(--dur) var(--ease),
        box-shadow var(--dur) var(--ease),
        background-color var(--dur) var(--ease);
}

.input::placeholder{
    color: var(--text-soft);
    font-weight: 400;
}

.input:hover{
    border-color: rgba(91, 62, 143, .25);
}

.input:focus{
    border-color: var(--brand-purple);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(91, 62, 143, .1);
}

.input:disabled,
.input[readonly]{
    background: var(--surface-3);
    color: var(--text-soft);
    cursor: not-allowed;
    border-color: rgba(91, 62, 143, .08);
}

/* Textarea */
textarea.input{
    height: auto;
    min-height: 100px;
    padding: 12px 14px;
    resize: vertical;
    line-height: 1.7;
}

/* =========================================
   4) Input with Icon (Start / End)
========================================= */
.input-wrap{
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap .input{
    padding-inline-start: 42px;
}
.input-wrap--end .input{
    padding-inline-start: 14px;
    padding-inline-end: 42px;
}
.input-wrap--both .input{
    padding-inline: 42px;
}

.input-wrap__icon{
    position: absolute;
    inset-inline-start: 14px;
    font-size: 13px;
    color: var(--text-soft);
    pointer-events: none;
    transition: color var(--dur) var(--ease);
}

.input-wrap--end .input-wrap__icon{
    inset-inline-start: auto;
    inset-inline-end: 14px;
}

.input-wrap:focus-within .input-wrap__icon{
    color: var(--brand-purple);
}

/* دکمه داخلی (مثل نمایش رمز) */
.input-wrap__btn{
    position: absolute;
    inset-inline-end: 8px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 13px;
    transition: all var(--dur) var(--ease);
}
.input-wrap__btn:hover{
    background: rgba(91, 62, 143, .08);
    color: var(--brand-purple);
}

/* =========================================
   5) Select Box
========================================= */
.select-wrap{
    position: relative;
    display: flex;
    align-items: center;
}

.select{
    width: 100%;
    height: 44px;
    padding: 0 14px;
    padding-inline-end: 38px;

    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);

    background: var(--surface);
    border: 1.5px solid rgba(91, 62, 143, .12);
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;

    appearance: none;
    -webkit-appearance: none;

    transition:
        border-color var(--dur) var(--ease),
        box-shadow var(--dur) var(--ease);
}
.select:hover{ border-color: rgba(91, 62, 143, .25); }
.select:focus{
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 4px rgba(91, 62, 143, .1);
}
.select:disabled{
    background: var(--surface-3);
    color: var(--text-soft);
    cursor: not-allowed;
}

.select-wrap::after{
    content: "\f078"; /* chevron-down */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    inset-inline-end: 14px;
    font-size: 10px;
    color: var(--text-muted);
    pointer-events: none;
    transition: transform var(--dur) var(--ease);
}
.select-wrap:focus-within::after{
    color: var(--brand-purple);
    transform: translateY(2px);
}

/* =========================================
   6) Checkbox
========================================= */
.check{
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 12.5px;
    color: var(--text);
    line-height: 1.5;
}

.check input{
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.check__box{
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid rgba(91, 62, 143, .25);
    background: var(--surface);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: all var(--dur) var(--ease);
    position: relative;
    margin-top: 1px;
}

.check__box::after{
    content: "";
    width: 10px;
    height: 6px;
    border-inline-start: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) scale(0);
    transition: transform var(--dur) var(--ease-out);
    margin-top: -2px;
}

.check:hover .check__box{
    border-color: var(--brand-purple);
    background: rgba(91, 62, 143, .04);
}

.check input:checked + .check__box{
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-deep));
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(91, 62, 143, .35);
}
.check input:checked + .check__box::after{
    transform: rotate(-45deg) scale(1);
}

.check input:focus-visible + .check__box{
    box-shadow: 0 0 0 4px rgba(91, 62, 143, .15);
}

.check input:disabled + .check__box{
    background: var(--surface-3);
    border-color: rgba(91, 62, 143, .1);
    cursor: not-allowed;
}

/* Checkbox با توضیح */
.check__body{ display: flex; flex-direction: column; gap: 2px; }
.check__title{ font-weight: 600; font-size: 12.5px; }
.check__desc{ font-size: 11px; color: var(--text-muted); font-weight: 400; }

/* =========================================
   7) Radio
========================================= */
.radio{
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 12.5px;
    color: var(--text);
    line-height: 1.5;
}

.radio input{
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio__dot{
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(91, 62, 143, .25);
    background: var(--surface);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: all var(--dur) var(--ease);
    position: relative;
    margin-top: 1px;
}

.radio__dot::after{
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    transform: scale(0);
    transition: transform var(--dur) var(--ease-out);
}

.radio:hover .radio__dot{
    border-color: var(--brand-purple);
    background: rgba(91, 62, 143, .04);
}

.radio input:checked + .radio__dot{
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-deep));
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(91, 62, 143, .35);
}
.radio input:checked + .radio__dot::after{
    transform: scale(1);
}

.radio input:focus-visible + .radio__dot{
    box-shadow: 0 0 0 4px rgba(91, 62, 143, .15);
}

/* Radio Group */
.radio-group{
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
}

/* =========================================
   8) Toggle Switch
========================================= */
.switch{
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 12.5px;
    color: var(--text);
}

.switch input{
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch__track{
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: rgba(91, 62, 143, .2);
    position: relative;
    transition: all var(--dur) var(--ease);
    flex-shrink: 0;
}

.switch__track::after{
    content: "";
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(42, 27, 77, .2);
    transition: all var(--dur) var(--ease-out);
}

.switch:hover .switch__track{
    background: rgba(91, 62, 143, .3);
}

.switch input:checked + .switch__track{
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-deep));
    box-shadow: 0 4px 12px rgba(91, 62, 143, .35);
}
.switch input:checked + .switch__track::after{
    transform: translateX(-18px); /* RTL */
}
html[dir="ltr"] .switch input:checked + .switch__track::after{
    transform: translateX(18px);
}

.switch input:focus-visible + .switch__track{
    box-shadow: 0 0 0 4px rgba(91, 62, 143, .15);
}

/* =========================================
   9) File Upload
========================================= */
.file{
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;

    background: var(--surface-2);
    border: 2px dashed rgba(91, 62, 143, .22);
    border-radius: var(--radius);
    transition: all var(--dur) var(--ease);
}

.file:hover{
    border-color: var(--brand-purple);
    background: rgba(91, 62, 143, .04);
}
.file:hover .file__icon{
    transform: translateY(-3px) scale(1.05);
    color: var(--brand-purple);
}

.file input{
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file__icon{
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(91, 62, 143, .1);
    color: var(--brand-purple);
    font-size: 18px;
    transition: all var(--dur) var(--ease);
}

.file__title{
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}
.file__title span{
    color: var(--brand-purple);
    text-decoration: underline;
}
.file__hint{
    font-size: 11px;
    color: var(--text-muted);
}

/* =========================================
   10) Range Slider
========================================= */
.range{
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(91, 62, 143, .12);
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    cursor: pointer;
}

.range::-webkit-slider-thumb{
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-deep));
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(91, 62, 143, .4);
    cursor: grab;
    transition: transform var(--dur) var(--ease);
}
.range::-webkit-slider-thumb:hover{
    transform: scale(1.15);
}
.range::-webkit-slider-thumb:active{
    cursor: grabbing;
    transform: scale(1.05);
}

.range::-moz-range-thumb{
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-deep));
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(91, 62, 143, .4);
    cursor: pointer;
}

/* =========================================
   11) Number Stepper
========================================= */
.stepper{
    display: inline-flex;
    align-items: center;
    height: 44px;
    background: var(--surface);
    border: 1.5px solid rgba(91, 62, 143, .12);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all var(--dur) var(--ease);
}
.stepper:focus-within{
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 4px rgba(91, 62, 143, .1);
}

.stepper__btn{
    width: 40px;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 12px;
    transition: all var(--dur) var(--ease);
}
.stepper__btn:hover{
    background: rgba(91, 62, 143, .08);
    color: var(--brand-purple);
}

.stepper__input{
    width: 60px;
    height: 100%;
    border: 0;
    outline: none;
    text-align: center;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    background: transparent;
}
.stepper__input::-webkit-outer-spin-button,
.stepper__input::-webkit-inner-spin-button{
    appearance: none;
    margin: 0;
}

/* =========================================
   12) Validation States
========================================= */
.field--error .input,
.field--error .select,
.field--error .stepper{
    border-color: var(--brand-red);
    background: rgba(196, 30, 58, .03);
}
.field--error .input:focus{
    box-shadow: 0 0 0 4px rgba(196, 30, 58, .12);
}
.field--error .field__hint{
    color: var(--brand-red);
}

.field--success .input,
.field--success .select,
.field--success .stepper{
    border-color: var(--brand-green);
    background: rgba(46, 158, 107, .03);
}
.field--success .input:focus{
    box-shadow: 0 0 0 4px rgba(46, 158, 107, .12);
}
.field--success .field__hint{
    color: var(--brand-green);
}

.field--warning .input,
.field--warning .select{
    border-color: var(--brand-gold-3);
    background: rgba(212, 175, 55, .04);
}
.field--warning .field__hint{
    color: var(--brand-gold-3);
}

/* =========================================
   13) List Box (Multi-select style)
========================================= */
.listbox{
    background: var(--surface);
    border: 1.5px solid rgba(91, 62, 143, .12);
    border-radius: var(--radius-sm);
    padding: 6px;
    max-height: 220px;
    overflow-y: auto;
    transition: all var(--dur) var(--ease);
}
.listbox:focus-within{
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 4px rgba(91, 62, 143, .1);
}

.listbox__item{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--text);
    transition: all var(--dur) var(--ease);
}
.listbox__item:hover{
    background: var(--surface-3);
}

.listbox__item input{
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.listbox__check{
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid rgba(91, 62, 143, .25);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: all var(--dur) var(--ease);
}
.listbox__check::after{
    content: "";
    width: 9px;
    height: 5px;
    border-inline-start: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) scale(0);
    transition: transform var(--dur) var(--ease-out);
    margin-top: -2px;
}

.listbox__item input:checked + .listbox__check{
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-deep));
    border-color: transparent;
}
.listbox__item input:checked + .listbox__check::after{
    transform: rotate(-45deg) scale(1);
}

.listbox__item input:checked ~ .listbox__label{
    color: var(--brand-purple);
    font-weight: 700;
}

/* =========================================
   14) Chips / Tags Input
========================================= */
.chips{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 6px 10px;
    background: var(--surface);
    border: 1.5px solid rgba(91, 62, 143, .12);
    border-radius: var(--radius-sm);
    transition: all var(--dur) var(--ease);
}
.chips:focus-within{
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 4px rgba(91, 62, 143, .1);
}

.chip{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--brand-purple);
    background: rgba(91, 62, 143, .1);
    border-radius: 999px;
    animation: chip-in .25s var(--ease-out);
}
@keyframes chip-in{
    from{ opacity: 0; transform: scale(.85); }
    to{ opacity: 1; transform: scale(1); }
}

.chip__x{
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(91, 62, 143, .15);
    color: var(--brand-purple);
    font-size: 8px;
    transition: all var(--dur) var(--ease);
}
.chip__x:hover{
    background: var(--brand-red);
    color: #fff;
}

.chips__input{
    flex: 1;
    min-width: 100px;
    height: 28px;
    border: 0;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 12.5px;
    color: var(--text);
}

/* =========================================
   15) Date / Time Input
========================================= */
.input[type="date"],
.input[type="time"],
.input[type="datetime-local"],
.input[type="month"]{
    cursor: pointer;
}

.input[type="date"]::-webkit-calendar-picker-indicator,
.input[type="time"]::-webkit-calendar-picker-indicator,
.input[type="datetime-local"]::-webkit-calendar-picker-indicator{
    cursor: pointer;
    opacity: .5;
    filter: hue-rotate(240deg);
    transition: opacity var(--dur) var(--ease);
}
.input[type="date"]:hover::-webkit-calendar-picker-indicator{
    opacity: 1;
}

/* =========================================
   16) Buttons (هم‌خانواده با فرم)
========================================= */
.btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    height: 44px;
    padding: 0 20px;

    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -.2px;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;

    border: 0;
    border-radius: var(--radius-sm);
    transition: all var(--dur) var(--ease);
}

.btn i{ font-size: 12px; }

.btn:focus-visible{
    outline: 2px solid var(--brand-gold);
    outline-offset: 3px;
}

.btn--primary{
    color: #fff;
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-deep));
    box-shadow: 0 6px 16px rgba(91, 62, 143, .35);
}
.btn--primary:hover{
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(91, 62, 143, .45);
}
.btn--primary:active{ transform: translateY(0) scale(.98); }

.btn--gold{
    color: var(--brand-deeper);
    background: linear-gradient(135deg, var(--brand-gold-2), var(--brand-gold-3));
    box-shadow: 0 6px 16px rgba(212, 175, 55, .35);
}
.btn--gold:hover{
    filter: brightness(1.08);
    transform: translateY(-2px);
}

.btn--danger{
    color: #fff;
    background: linear-gradient(135deg, var(--brand-red), var(--brand-magenta));
    box-shadow: 0 6px 16px rgba(196, 30, 58, .35);
}
.btn--danger:hover{
    filter: brightness(1.12);
    transform: translateY(-2px);
}

.btn--ghost{
    color: var(--brand-purple);
    background: rgba(91, 62, 143, .08);
}
.btn--ghost:hover{
    background: rgba(91, 62, 143, .15);
}

.btn--outline{
    color: var(--brand-purple);
    background: transparent;
    border: 1.5px solid rgba(91, 62, 143, .25);
}
.btn--outline:hover{
    background: rgba(91, 62, 143, .06);
    border-color: var(--brand-purple);
}

.btn--block{ width: 100%; }

.btn:disabled{
    opacity: .5;
    cursor: not-allowed;
    transform: none !important;
    filter: none !important;
    box-shadow: none;
}

/* =========================================
   17) Card wrapper برای فرم‌ها
========================================= */
.form-card{
    background: var(--surface);
    border: 1px solid rgba(91, 62, 143, .08);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.form-card__head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px dashed rgba(91, 62, 143, .12);
}

.form-card__title{
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-card__title::before{
    content: "";
    width: 4px;
    height: 14px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--brand-gold), var(--brand-magenta));
}