/* ========================================
   RUDDHAACONNECT - FORMS & INPUTS
   ======================================== */

@import url('variables.css');

.form-group {
    margin-bottom: 14px;
}

/* FIX: used across ~20 pages (Customers, Vendors, Bank Import,
   Chart of Accounts, CRM, HR, Payments, Receipts, Project Management,
   and more) as a label+input wrapper, but never actually defined
   anywhere — every one of those pages' form fields rendered with the
   label sitting inline with its input using pure browser defaults,
   not stacked with any real spacing. Matches .form-group's own
   spacing exactly, so both conventions look consistent wherever a
   page happens to use one or the other. */
.field {
    margin-bottom: 14px;
}
.field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #444;
    text-transform: uppercase;
    margin-bottom: 5px;
}

/* FIX: used across ~10 files (CRM, HR, Payments, Receipts, Salary,
   Templates) as an inline modal error/status message area, never
   defined anywhere except locally in inventory.html's own <style>
   block. Same definition, made global so every other page using it
   doesn't need its own local copy. */
.msg-inline {
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}
.msg-inline:not(:empty) {
    background: #fdecec;
    color: #c0392b;
}

/* FIX: used in hr-masters.html and templates.html as a dedicated
   error message div, never defined anywhere. */
.err-msg {
    font-size: 12px;
    color: #c0392b;
    margin-top: 6px;
    min-height: 16px;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #444;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

input:disabled,
textarea:disabled,
select:disabled {
    background: #f5f5f5;
    opacity: 0.6;
    cursor: not-allowed;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select {
    cursor: pointer;
}

/* ══ FIELD ROW ══ */
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.field-row.three {
    grid-template-columns: 1fr 1fr 1fr;
}

.field-row.four {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

/* ══ FORM VALIDATION ══ */
.form-control.is-invalid {
    border-color: #e53935;
}

.form-control.is-valid {
    border-color: #4caf50;
}

.invalid-feedback {
    display: none;
    color: #e53935;
    font-size: 12px;
    margin-top: 4px;
}

.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

.valid-feedback {
    display: none;
    color: #4caf50;
    font-size: 12px;
    margin-top: 4px;
}

.form-control.is-valid ~ .valid-feedback {
    display: block;
}

/* ══ CHECKBOX & RADIO ══ */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin-right: 6px;
    cursor: pointer;
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.form-check-label {
    margin-bottom: 0;
    cursor: pointer;
    display: inline;
    font-size: 13px;
}

/* ══ SELECT2 STYLE ══ */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    padding-right: 32px;
}

.select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #666;
    font-size: 10px;
}

/* ══ FORM SECTION ══ */
.form-section {
    background: #f9f9f9;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.form-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

/* ══ HELP TEXT ══ */
.form-text {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* ══ DATALIST ══ */
input[list] {
    width: 100%;
}

datalist {
    display: none;
}

/* ══ FILE INPUT ══ */
input[type="file"] {
    padding: 8px;
    border: 1.5px dashed #ddd;
    border-radius: 6px;
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: var(--primary-color);
}
