/* =====================================================
   AFJU — Bootstrap 5 form styles for Yii-generated forms
   ===================================================== */

/* ── Form container ── */
div.form {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.25rem;
    max-width: 680px;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* ── Rows ── */
div.form .row {
    margin-bottom: 0.875rem;
}

/* ── Labels ── */
div.form label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.25rem;
}

/* ── Inputs ── */
div.form input[type=text],
div.form input[type=email],
div.form input[type=password],
div.form input[type=number],
div.form input[type=date],
div.form input[type=tel],
div.form textarea,
div.form select {
    width: 100%;
    padding: 0.45rem 0.65rem;
    font-size: 0.9rem;
    color: #212529;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    appearance: auto;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
    margin: 0;
}

div.form input[type=text]:focus,
div.form input[type=email]:focus,
div.form input[type=password]:focus,
div.form input[type=number]:focus,
div.form input[type=date]:focus,
div.form input[type=tel]:focus,
div.form textarea:focus,
div.form select:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,.18);
}

div.form textarea {
    min-height: 90px;
    resize: vertical;
}

/* ── Submit button ── */
div.form input[type=submit],
div.form button[type=submit] {
    background-color: #1b3a6b;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s;
}

div.form input[type=submit]:hover,
div.form button[type=submit]:hover {
    background-color: #2563eb;
}

/* ── Buttons row ── */
div.row.buttons,
div.form .row.buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

div.row.buttons a,
div.form .row.buttons a {
    display: inline-block;
    padding: 0.45rem 1rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: #495057;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 6px;
    text-decoration: none;
    transition: background .15s;
}

div.row.buttons a:hover,
div.form .row.buttons a:hover {
    background: #dee2e6;
    color: #212529;
}

/* ── Hint & notes ── */
div.form .hint {
    margin: 0.15rem 0 0 0;
    padding: 0;
    font-size: 0.78rem;
    color: #6c757d;
}

div.form .note {
    font-style: italic;
    font-size: 0.82rem;
    color: #6c757d;
}

/* ── Required marker ── */
div.form span.required {
    color: #dc3545;
    font-weight: 700;
}

/* ── Validation errors ── */
div.form div.error label:first-child,
div.form label.error,
div.form span.error {
    color: #842029;
}

div.form div.error input,
div.form div.error textarea,
div.form div.error select,
div.form input.error,
div.form textarea.error,
div.form select.error {
    background: #fff1f1;
    border-color: #dc3545;
}

div.form div.error input:focus,
div.form div.error textarea:focus,
div.form div.error select:focus {
    box-shadow: 0 0 0 3px rgba(220,53,69,.2);
}

/* ── Error message inline ── */
div.form .errorMessage {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

/* ── Error summary ── */
div.form .errorSummary {
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    border-radius: 6px;
    color: #842029;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

div.form .errorSummary p {
    margin: 0 0 0.3rem 0;
    font-weight: 600;
}

div.form .errorSummary ul {
    margin: 0;
    padding: 0 0 0 1.25rem;
}

/* ── Success state ── */
div.form div.success input,
div.form div.success textarea,
div.form div.success select,
div.form input.success,
div.form textarea.success,
div.form select.success {
    background: #f0fdf4;
    border-color: #86efac;
}

div.form div.success label {
    color: inherit;
}

/* ── rememberMe inline ── */
div.form .rememberMe label {
    display: inline;
    font-weight: normal;
    margin-left: 0.3rem;
}

/* ── Checkbox inline (form & column layout) ── */
div.form input[type=checkbox] {
    display: inline;
    width: auto;
}

div.column input[type=checkbox],
div.column label {
    display: inline;
    width: auto;
}

/* ── Fieldset ── */
div.form fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    margin: 0 0 1rem 0;
}

div.form fieldset legend {
    font-size: 0.88rem;
    font-weight: 600;
    color: #374151;
    padding: 0 0.4rem;
    width: auto;
}

/* ── jQuery UI / Datepicker ── */
div.form input.hasDatepicker,
input.ui-autocomplete-input {
    width: 100%;
}

/* ── Wide form variant ── */
div.wide.form label {
    float: left;
    margin-right: 10px;
    position: relative;
    text-align: right;
    width: 130px;
}

div.wide.form .row {
    clear: left;
}

div.wide.form .buttons,
div.wide.form .hint,
div.wide.form .errorMessage {
    clear: left;
    padding-left: 140px;
}
