/* Focus outlines for accessibility */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Hide parcel form by default */
#parcelIdForm {
    display: none;
}

/* ===========================
   Form Container and Loading
=========================== */
.form-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background-color: #f2f2f2;
    border-radius: 6px;
    position: relative;
}

.form-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999; /* Below lojic-nav-basic */
}

.form-loading-content {
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ccc;
    border-top: 4px solid #005ea2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

.loading-text {
    font-size: 1rem;
    font-weight: 500;
}

/* ===========================
   Form Fields
=========================== */
.form-field {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

span[aria-label="required"] {
    font-weight: normal;
    font-weight: normal;
    font-size: 0.875em;
    color: #666;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="search"],
select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

input:focus,
select:focus {
    outline: 3px solid #4d90fe;
    outline-offset: 2px;
    border-color: #0066cc;
}

input[data-valid="true"] {
    border: 2px solid #2e7d32;
    outline: none;
}

input[data-valid="true"]:focus {
    border-color: #4caf50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

input[aria-invalid="true"] {
    border-color: #d93025;
}
input[aria-invalid="true"]:focus {
    border-color: #d32f2f;
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.2);
}

/* ===========================
   Search Tabs
=========================== */
#searchTypeDiv {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.searchTypeButton {
    flex: 1;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border: 2px solid #ccc;
    border-radius: 4px;
    background: white;
    transition: all 0.3s;
}

.searchTypeButton.active {
    background: #2C882D;
    color: white;
    border-color: #5ebf64;
}

.searchTypeButton:hover {
    border-color: #418545;
}

.searchTypeButton:focus {
    outline: 3px solid #77bc1f;
    outline-offset: 2px;
}

/* Responsive two-column rows */
@media (min-width: 768px) {
    .form-row {
        display: flex;
        gap: 20px;
    }
}

/* ===========================
   Submit Button
=========================== */
#submitButton {
    background: #2C882D;
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 4px;
    font-size: 18px;
    cursor: pointer;
    text-align: center;
    transition: background 0.3s;
}

#submitButton:hover {
    background: #227C23;
}

#submitButton:focus {
    outline: 3px solid #77bc1f;
    outline-offset: 2px;
}

/* ===========================
   Hints
=========================== */
.hint-text {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

/* ===========================
   Address Input + Spinner
=========================== */
.input-wrapper {
    position: relative; /* required for spinner and dropdown positioning */
    display: flex;
}

.spinner-container {
    position: absolute;
    top: 50%;
    right: 35px;
    transform: translateY(-50%);
    pointer-events: none;
    width: 18px;
    height: 18px;
    z-index: 10;
}

/* Spinner circle */
.spinner {
    width: 100%;
    height: 100%;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #0079c1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: block;
}

/* ===========================
   Address Dropdown
=========================== */
.search-field-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    overflow-y: auto;
    max-height: 150px;
    z-index: 1000;
}

.search-field-dropdown::before {
    content: "Please select an address from the list below.";
    display: block;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 6px;
    background: #fff3cd;
    color: #856404;
}

.search-field__dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.search-field__dropdown-item:last-child {
    border-bottom: none;
}

.search-field__dropdown-item:hover,
.search-field__dropdown-item.selected {
    background-color: #f0f0f0;
}

/* ===========================
   Errors
=========================== */
.search-field-error {
    margin-top: 8px;
    color: #C9261B;
    font-size: 14px;
    min-height: 20px;
}

.error-message {
    color: #C9261B;
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

.error-message[aria-hidden="false"] {
    display: block;
}

/* Screen reader helper */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}
