/* ===== POG FORM STYLES ===== */

/* ===== BASE FORM ELEMENTS ===== */
form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    font-size: 14px;
    font-weight: 600;
    color: #323130;
    margin-bottom: 4px;
    display: block;
}

/* ===== INPUT FIELDS ===== */
.form-control {
    padding: 8px 12px;
    border: 1px solid #8a8886;
    border-radius: 2px;
    font-size: 14px;
    line-height: 20px;
    background-color: #ffffff;
    color: #323130;
    transition: all 0.1s ease-in-out;
    min-height: 32px;
}

.form-control:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 1px #0078d4;
}

.form-control:hover:not(:focus):not(:disabled) {
    border-color: #605e5c;
}

.form-control:disabled {
    background-color: #f3f2f1;
    border-color: #c8c6c4;
    color: #a19f9d;
    cursor: not-allowed;
}

.form-control.error {
    border-color: #d13438;
    box-shadow: 0 0 0 1px #d13438;
}

/* ===== SELECT DROPDOWNS ===== */
select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23605e5c' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
    appearance: none;
}

select.form-control:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%230078d4' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

/* ===== TEXTAREA ===== */
textarea.form-control {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* ===== FILE INPUTS ===== */
input[type="file"].form-control {
    padding: 6px 8px;
    cursor: pointer;
}

input[type="file"].form-control::-webkit-file-upload-button {
    background-color: #f3f2f1;
    border: 1px solid #8a8886;
    border-radius: 2px;
    padding: 4px 8px;
    margin-right: 8px;
    cursor: pointer;
    font-size: 12px;
    color: #323130;
}

input[type="file"].form-control::-webkit-file-upload-button:hover {
    background-color: #edebe9;
}

/* ===== FORM TEXT AND HELPERS ===== */
.form-text {
    font-size: 12px;
    color: #605e5c;
    margin-top: 4px;
    line-height: 16px;
}

.form-text.error {
    color: #d13438;
}

.form-text.success {
    color: #107c10;
}

/* ===== REQUIRED FIELD INDICATOR ===== */
.required::after {
    content: " *";
    color: #d13438;
}

/* ===== INPUT GROUPS ===== */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: 0;
    border-right: none;
}

.input-group .form-control:first-child {
    border-radius: 2px 0 0 2px;
}

.input-group .form-control:last-child {
    border-radius: 0 2px 2px 0;
    border-right: 1px solid #8a8886;
}

.input-group-addon {
    background-color: #f3f2f1;
    border: 1px solid #8a8886;
    border-left: none;
    padding: 8px 12px;
    font-size: 14px;
    color: #605e5c;
    display: flex;
    align-items: center;
}

.input-group-addon:first-child {
    border-left: 1px solid #8a8886;
    border-right: none;
    border-radius: 2px 0 0 2px;
}

.input-group-addon:last-child {
    border-radius: 0 2px 2px 0;
}

/* ===== CHECKBOXES AND RADIOS ===== */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.form-check-input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #0078d4;
    cursor: pointer;
}

.form-check-label {
    font-weight: 400;
    cursor: pointer;
    margin-bottom: 0;
}

/* ===== CUSTOM CHECKBOX ===== */
.custom-checkbox {
    position: relative;
    display: inline-block;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.custom-checkbox input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

.custom-checkbox .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 16px;
    height: 16px;
    background-color: #ffffff;
    border: 1px solid #8a8886;
    border-radius: 2px;
    transition: all 0.1s ease;
}

.custom-checkbox:hover .checkmark {
    border-color: #605e5c;
}

.custom-checkbox input[type="checkbox"]:checked + .checkmark {
    background-color: #0078d4;
    border-color: #0078d4;
}

.custom-checkbox input[type="checkbox"]:focus + .checkmark {
    box-shadow: 0 0 0 1px #0078d4;
}

.custom-checkbox .checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox input[type="checkbox"]:checked + .checkmark::after {
    display: block;
}

/* ===== FORM VALIDATION STATES ===== */
.was-validated .form-control:valid {
    border-color: #107c10;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23107c10' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

.was-validated .form-control:invalid {
    border-color: #d13438;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23d13438' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

.valid-feedback {
    display: none;
    font-size: 12px;
    color: #107c10;
    margin-top: 4px;
}

.invalid-feedback {
    display: none;
    font-size: 12px;
    color: #d13438;
    margin-top: 4px;
}

.was-validated .form-control:valid ~ .valid-feedback {
    display: block;
}

.was-validated .form-control:invalid ~ .invalid-feedback {
    display: block;
}

/* ===== FORM LAYOUTS ===== */
.form-horizontal {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 16px;
    align-items: start;
}

.form-horizontal .form-group {
    display: contents;
}

.form-horizontal label {
    justify-self: end;
    padding-top: 8px;
    margin-bottom: 0;
}

/* ===== SEARCH FORMS ===== */
.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 200px;
}

.search-btn {
    flex-shrink: 0;
}

/* ===== MODAL FORMS ===== */
.modal-form {
    padding: 0;
}

.modal-form .form-group:last-child {
    margin-bottom: 0;
}

/* ===== FLOATING LABELS ===== */
.form-floating {
    position: relative;
}

.form-floating > .form-control {
    padding: 12px 12px 4px 12px;
    height: 56px;
}

.form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    padding: 16px 12px;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
    color: #605e5c;
    font-weight: 400;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* ===== NUMBER INPUTS WITH SPINNERS ===== */
input[type="number"].form-control {
    padding-right: 8px;
}

input[type="number"].form-control::-webkit-outer-spin-button,
input[type="number"].form-control::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"].form-control {
    -moz-appearance: textfield;
}

/* ===== RESPONSIVE FORM STYLES ===== */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .form-horizontal {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .form-horizontal label {
        justify-self: start;
        padding-top: 0;
        margin-bottom: 4px;
    }
    
    .search-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .form-group {
        gap: 8px;
    }
    
    form {
        gap: 12px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group .form-control,
    .input-group .input-group-addon {
        border-radius: 2px;
        border: 1px solid #8a8886;
    }
    
    .input-group .form-control:not(:last-child) {
        border-bottom: none;
        border-radius: 2px 2px 0 0;
    }
    
    .input-group .form-control:not(:first-child),
    .input-group .input-group-addon:not(:first-child) {
        border-radius: 0 0 2px 2px;
    }
}