/* ============================================================
   eWarehouse — Global Modern Form Styling
   Applies app-wide on top of DashForge (Bootstrap 4).
   ============================================================ */

/* ---------- Inputs ---------- */
.form-control,
select.form-control,
textarea.form-control {
    border-radius: 10px !important;
    border: 1px solid #dce3ed;
    background-color: #fff;
    font-size: 14px;
    color: #2d3748;
    padding: 0.55rem 0.85rem;
    min-height: 42px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea.form-control { min-height: 80px; }

.form-control:hover:not(:focus):not(.is-invalid) { border-color: #c3cede; }

.form-control:focus {
    border-color: #7aaefc;
    box-shadow: 0 0 0 3px rgba(1, 104, 250, 0.12);
    outline: none;
}

.form-control::placeholder { color: #a0aec0; }

.form-control-sm { min-height: 36px; padding: 0.35rem 0.7rem; }

/* File inputs */
input[type="file"].form-control {
    padding: 0.45rem 0.7rem;
    line-height: 1.6;
    cursor: pointer;
}
.file-chosen-name {
    display: inline-block;
    margin-top: 5px;
    font-size: 12px;
    color: #0168fa;
    font-weight: 600;
}

/* ---------- Labels ---------- */
.form-group label,
.form-group > label,
form label {
    font-size: 12.5px;
    font-weight: 600;
    color: #4a5568;
    letter-spacing: 0.02em;
    margin-bottom: 6px;
}
.custom-control-label { font-size: 14px; font-weight: 500; text-transform: none; }

.req-star { color: #e53935; margin-left: 3px; font-weight: 700; }

.form-hint { font-size: 12px; color: #8492a6; margin-top: 4px; display: block; }

/* ---------- Validation states ---------- */
.form-control.is-invalid,
.was-validated .form-control:invalid {
    border-color: #e53935;
    background-image: none;
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.08);
}
.invalid-feedback {
    display: none;
    font-size: 12px;
    font-weight: 600;
    color: #e53935;
    margin-top: 4px;
}
.form-control.is-invalid ~ .invalid-feedback,
.was-validated .form-control:invalid ~ .invalid-feedback { display: block; }

.form-control.is-valid,
.was-validated .form-control:valid:not([type="file"]) {
    border-color: #dce3ed; /* keep neutral — avoid a wall of green */
    background-image: none;
}

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 600; transition: all 0.15s ease; }
.btn:active { transform: scale(0.98); }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(1, 104, 250, 0.3); }
.btn-danger:hover { box-shadow: 0 4px 12px rgba(229, 57, 53, 0.3); }
.btn-success:hover { box-shadow: 0 4px 12px rgba(16, 183, 89, 0.3); }
.rounded-pill { border-radius: 50rem !important; }

/* Loading state (double-submit guard) */
.btn-loading { position: relative; pointer-events: none; opacity: 0.75; }
.btn-loading::after {
    content: "";
    display: inline-block;
    width: 14px; height: 14px;
    margin-left: 8px;
    vertical-align: -2px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: fm-spin 0.6s linear infinite;
}
@keyframes fm-spin { to { transform: rotate(360deg); } }

/* ---------- Modals ---------- */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 60px rgba(20, 40, 80, 0.18);
}
.modal-header {
    border-bottom: 1px solid #f0f2f5;
    padding: 18px 24px;
}
.modal-header .modal-title { font-weight: 700; color: #2d3748; }
.modal-body { padding: 22px 24px; }
.modal-footer { border-top: 1px solid #f0f2f5; padding: 14px 24px; }

/* ---------- Select2 to match ---------- */
.select2-container--default .select2-selection--single {
    height: 42px !important;
    border: 1px solid #dce3ed !important;
    border-radius: 10px !important;
    background-color: #fff;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 40px !important;
    font-size: 14px;
    color: #2d3748;
    padding-left: 13px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 40px !important; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #7aaefc !important;
    box-shadow: 0 0 0 3px rgba(1, 104, 250, 0.12);
}
.select2-dropdown {
    border: 1px solid #dce3ed !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 30px rgba(20, 40, 80, 0.12);
    overflow: hidden;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #dce3ed !important;
    border-radius: 8px !important;
    padding: 6px 10px;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: #0168fa; }
.select2-container { width: 100% !important; }
.is-invalid + .select2-container--default .select2-selection--single { border-color: #e53935 !important; }

/* ---------- Form section headings ---------- */
.form-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #0168fa;
    border-bottom: 2px solid #eef3fb;
    padding-bottom: 8px;
    margin: 22px 0 16px;
}
.form-section-title:first-child { margin-top: 0; }

/* ---------- Dynamic item rows (requisition / purchase request) ---------- */
.item-row {
    background: #f8fafc;
    border: 1px solid #edf1f7;
    border-radius: 14px;
    padding: 14px 14px 4px;
    margin-bottom: 12px;
    position: relative;
}
.item-row .remove-row {
    position: absolute;
    top: 10px; right: 12px;
    color: #e53935;
    background: #ffebee;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    cursor: pointer;
}
.item-row .remove-row:hover { background: #e53935; color: #fff; }
.item-row-number {
    font-size: 11px;
    font-weight: 700;
    color: #8492a6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.code-feedback { font-size: 12px; font-weight: 600; margin-top: 4px; display: block; }
.code-feedback.found { color: #10b759; }
.code-feedback.not-found { color: #e53935; }

/* ---------- Misc form polish ---------- */
.form-group { margin-bottom: 1.05rem; }
.card form .table th { font-size: 12px; }
.alert { border-radius: 12px; }
