/* ==========================================================================
   PlatSearch - Main Website Branding
   Primary Brand:  #B11216  |  Dim: #8E0E11  |  Dark: #6B0A0D
   Font:           Inter, Noto Sans, sans-serif
   Body color:     #262626
   Error font:     #C74200  |  Error bg: #FFF1EB  |  Error bg-dim: #FBDFD1
   ========================================================================== */

/* --- Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Noto Sans', sans-serif;
}
html, body, div {
    margin: 0;
    padding: 0;
    border: 0 none;
}
body {
    font-family: 'Inter', 'Noto Sans', sans-serif;
    font-size: 1rem;
    color: #262626;
    background: #ffffff;
    line-height: 1.5;
}

/* --- Focus styles (WCAG 2.0) --- */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
    outline: 2px solid #B11216;
    outline-offset: 2px;
}

/* --- Links --- */
a,
a:visited {
    color: #006680;
    text-decoration: underline;
}
a:hover,
a:focus {
    color: #006680;
    text-decoration: underline;
}

/* --- Typography --- */
p {
    line-height: 1.5;
    font-size: 1rem;
    color: #262626;
    padding: 0 0 5px 0;
}
span {
    font-size: 1rem;
}
strong, b {
    font-weight: 600;
}
ul {
    margin-left: 20px;
    margin-top: 0;
    margin-bottom: 10px;
}
h1, h2, h3, h4, h5, h6 {
    color: #8E0E11;
    font-weight: 600;
    line-height: 1.3;
}

/* --- Back link --- */
.backLink {
    float: right;
}

/* --- Form fields --- */
input[type="text"],
input[type="search"],
input[type="number"],
input[type="date"],
select,
textarea {
    font-family: 'Inter', 'Noto Sans', sans-serif;
    font-size: 1rem;
    color: #262626;
    background: #ffffff;
    border: 1px solid #C1C1C1;
    border-radius: 4px;
    padding: 8px 10px;
}
input[type="text"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: #B11216;
    outline: 2px solid #B11216;
    outline-offset: 2px;
}
input[type="text"]:disabled,
select:disabled,
textarea:disabled {
    background: #F5F5F5;
    color: #767676;
    cursor: not-allowed;
}
.date-range-input {
    width: 140px;
    max-width: 100%;
    font-variant-numeric: tabular-nums;
}

/* --- Validation errors --- */
.field-error input,
.field-error select {
    border-color: #C74200;
    background: #FFF1EB;
    color: #C74200;
}
.field-error label,
.field-error legend,
.field-error .inline-fieldset legend {
    color: #C74200;
}
span[id*="Validator"],
.error-message {
    color: #C74200;
    font-size: 0.875rem;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: center;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}
span[id*="Validator"]::before,
.error-message::before {
    content: "\24D8";
    font-style: normal;
    flex-shrink: 0;
    line-height: 1;
}
.input-error,
input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
    border-color: #C74200;
    background: #FFF1EB;
    color: #C74200;
}
.input-error:focus,
input[aria-invalid="true"]:focus,
textarea[aria-invalid="true"]:focus,
select[aria-invalid="true"]:focus {
    border-color: #C74200;
    outline: 2px solid #C74200;
    outline-offset: 2px;
}

/* --- Buttons (Primary - red) --- */
.button,
input[type="submit"] {
    font-family: 'Inter', 'Noto Sans', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: #ffffff;
    background-color: #B11216;
    border: 2px solid #B11216;
    border-radius: 4px;
    padding: 8px 20px;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    margin: 0 4px 0 0;
    display: inline-block;
    text-decoration: none;
}
.button:hover,
input[type="submit"]:hover {
    background-color: #8E0E11;
    border-color: #8E0E11;
}
.button:active,
input[type="submit"]:active {
    background-color: #6B0A0D;
    border-color: #6B0A0D;
}
.button:focus,
input[type="submit"]:focus {
    outline: 2px solid #B11216;
    outline-offset: 2px;
}

/* --- Buttons (Neutral - gray, used for Reset) --- */
.btn-neutral {
    color: #262626;
    background-color: #E0E0E0;
    border: 2px solid #C1C1C1;
}
.btn-neutral:hover {
    background-color: #D0D0D0;
    border-color: #B0B0B0;
}
.btn-neutral:active {
    background-color: #BEBEBE;
}
.btn-neutral:focus {
    outline: 2px solid #B11216;
    outline-offset: 2px;
}

/* --- Button click checkmark animation --- */
@keyframes checkmark-pop {
    0%   { opacity: 0; }
    40%  { opacity: 1; }
    100% { opacity: 1; }
}
.btn-confirmed::after {
    content: " \2713";
    display: inline-block;
    opacity: 0;
    animation: checkmark-pop 0.4s ease forwards;
    font-weight: bold;
    margin-left: 6px;
    color: #ffffff;
}
.btn-neutral.btn-confirmed::after {
    color: #262626;
}

/* --- Data grid / results table --- */
.mGrid {
    border: 1px solid #E7D8C1;
    background-color: #ffffff;
    margin: 8px 0 12px 0;
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}
.mGrid td {
    border: 1px solid #E7D8C1;
    padding: 12px 16px;
    color: #262626;
    font-size: 0.9375rem;
    font-family: 'Inter', 'Noto Sans', sans-serif;
    line-height: 1.4;
    text-align: center;
    vertical-align: middle;
    background-color: #ffffff;
}
.mGrid th {
    padding: 12px 16px;
    text-align: center;
    background-color: #F5EFE6;
    color: #715933;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.4;
    font-family: 'Inter', 'Noto Sans', sans-serif;
    border: 1px solid #CAAB77;
    vertical-align: middle;
}
.mGrid .alt {
    background-color: #ffffff;
}
.mGrid .alt td {
    background-color: #ffffff;
}
.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid #FAF7F2;
    border-radius: 4px;
    background-color: #FAF7F2;
    font-size: 0.9375rem;
    color: #715933;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}
.page-ellipsis:hover,
.page-ellipsis:focus {
    background-color: #F5EFE6;
    border-color: #CAAB77;
    color: #8E0E11;
}
.page-jump {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}
.page-jump-modal[hidden] {
    display: none;
}
.page-jump-modal {
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(38, 38, 38, 0.45);
}
.page-jump-modal-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    border: 1px solid #CAAB77;
    border-radius: 4px;
    background-color: #ffffff;
    box-shadow: 0 4px 16px rgba(38, 38, 38, 0.25);
}
.page-jump-label {
    color: #262626;
    font-weight: 600;
}
.page-jump-input {
    width: 56px;
    min-height: 48px;
    padding: 0 8px;
    border: 1px solid #CAAB77;
    border-radius: 4px;
    font-size: 0.9375rem;
    line-height: 1.4;
    text-align: center;
}
.page-jump-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid #FAF7F2;
    border-radius: 4px;
    background-color: #FAF7F2;
    color: #006680;
    font-size: 0.9375rem;
    line-height: 1.4;
    text-decoration: none;
}
.page-jump-close {
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid #E5E5E5;
    border-radius: 4px;
    background-color: #E5E5E5;
    color: #262626;
    cursor: pointer;
}
.page-jump-close:hover,
.page-jump-close:focus {
    background-color: #D9D9D9;
}
.page-jump-btn:hover,
.page-jump-btn:focus {
    background-color: #F5EFE6;
    border-color: #CAAB77;
    color: #006680;
    text-decoration: none;
}
.grid-sort-header {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}
.grid-sort-label {
    color: #715933;
    font-weight: 700;
    text-decoration: none;
}
.grid-sort-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    vertical-align: middle;
}
.grid-sort-button:hover,
.grid-sort-button:focus {
    opacity: 0.8;
}
.grid-sort-button:focus {
    outline: 2px solid #B11216;
    outline-offset: 2px;
}
.mGrid th[data-sort-state="Ascending"] .grid-sort-label,
.mGrid th[data-sort-state="Descending"] .grid-sort-label {
    color: #715933;
}
.mGrid caption {
    caption-side: top;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: #8E0E11;
    padding-bottom: 8px;
}
.mGrid .pgr {
    background-color: #ffffff;
}
.mGrid .pgr table {
    margin: 0;
}
.mGrid .pgr td {
    padding: 16px 0 0 0;
    border: 0;
    background-color: #ffffff;
}
.mGrid a {
    color: #006680;
    text-decoration: underline;
}
.mGrid a:hover {
    color: #006680;
}
.mGrid a.page-btn {
    text-decoration: none;
}
.mGrid a.page-btn:hover,
.mGrid a.page-btn:focus {
    text-decoration: none;
}
.mGrid a.page-jump-btn,
.mGrid a.page-jump-btn:hover,
.mGrid a.page-jump-btn:focus {
    text-decoration: none;
}
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    font-family: 'Inter', 'Noto Sans', sans-serif;
}
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}
.page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
}
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 4px;
    font-family: 'Inter', 'Noto Sans', sans-serif;
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.4;
    box-sizing: border-box;
    text-decoration: none;
}
.page-btn.primary,
.page-btn.active {
    background-color: #B11216;
    color: #ffffff;
    border: 1px solid #B11216;
    font-weight: 700;
}
.page-btn.inactive {
    background-color: #FAF7F2;
    color: #262626;
    border: 1px solid #FAF7F2;
}
.page-btn.disabled {
    background-color: #E5E5E5;
    color: #999999;
    border: 1px solid #C1C1C1;
    cursor: default;
}
.page-btn.inactive:hover,
.page-btn.inactive:focus,
.page-btn.primary:hover,
.page-btn.primary:focus {
    text-decoration: none;
}
.page-btn.inactive:hover,
.page-btn.inactive:focus {
    background-color: #F5EFE6;
    border-color: #CAAB77;
    color: #262626;
}
.page-btn.primary:hover,
.page-btn.primary:focus {
    background-color: #8E0E11;
    border-color: #8E0E11;
    color: #ffffff;
}
.page-btn:focus,
.page-btn.active:focus {
    outline: 2px solid #B11216;
    outline-offset: 2px;
}
.page-btn.disabled:focus {
    outline: 2px solid #767676;
    outline-offset: 2px;
}
.pagination-text {
    color: #715933;
    font-size: 0.9375rem;
    line-height: 1.4;
    font-weight: 400;
    vertical-align: middle;
    text-align: center;
}

/* --- Form layout helpers --- */
.search-form {
    max-width: 600px;
    margin-bottom: 16px;
}
.search-form fieldset {
    border: none;
    padding: 0;
    margin: 0;
}
.search-form legend {
    font-size: 1.125rem;
    font-weight: 600;
    color: #8E0E11;
    margin-bottom: 12px;
}
.form-group {
    margin-bottom: 12px;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: #262626;
}
.subdivision-search-options {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: start;
    align-items: flex-start;
    gap: 16px;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;
}
.subdivision-match-option {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: row;
    flex-direction: row;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-item-align: center;
    align-self: center;
    min-width: 0;
}
.subdivision-match-option input[type="checkbox"] {
    -ms-flex-negative: 0;
    flex-shrink: 0;
    margin-right: 6px;
    margin-top: 0;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    cursor: pointer;
}
.subdivision-match-option input[type="checkbox"]:checked {
    background-color: #000000;
    border-color: #000000;
    accent-color: #000000;
}
.subdivision-match-option label {
    display: inline;
    margin-bottom: 0;
    white-space: nowrap;
    cursor: pointer;
    font-size: 0.8125rem;
}
.subdivision-match-hint {
    -ms-flex-preferred-size: 100%;
    flex-basis: 100%;
    margin-top: 2px;
    padding-left: 22px;
    white-space: normal;
    font-size: 0.6875rem;
    color: #767676;
}
.range-input-group {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-align: end;
    align-items: flex-end;
    gap: 8px;
}
.range-input-column {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
}
.range-input-column label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: #262626;
}
.range-separator {
    display: inline-block;
    padding-bottom: 10px;
}
.search-form .inline-fieldset legend {
    color: #262626;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.form-hint {
    font-size: 0.8125rem;
    color: #767676;
    display: block;
    margin-top: 2px;
}
.button-group {
    display: -ms-flexbox;
    display: flex;
    gap: 8px;
    margin-top: 12px;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

@media (max-width: 767px) {
    .subdivision-search-options {
        -ms-flex-direction: column;
        flex-direction: column;
        gap: 8px;
    }

    .subdivision-match-option label {
        white-space: normal;
    }
    .subdivision-match-hint {
        white-space: normal;
        padding-left: 22px;
    }
}

/* --- Skip link (accessibility) --- */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background-color: #B11216;
    color: #ffffff;
    padding: 8px 16px;
    z-index: 1000;
    text-decoration: none;
    font-weight: 600;
}
.skip-link:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
}

/* --- Screen-reader only --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Nav link list (Row.aspx quick links) --- */
nav ul,
ul {
    margin-left: 20px;
    margin-top: 0;
    margin-bottom: 10px;
}
nav ul li,
ul li {
    margin-bottom: 4px;
}

.details-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #8E0E11;
    margin: 0 0 16px 0;
}

.details-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #8E0E11;
    margin: 0 0 12px 0;
}

.document-downloads {
    margin: 0 0 20px 0;
}

.document-group {
    margin: 0 0 16px 0;
}

.document-group-title {
    font-size: 1rem;
    font-weight: 600;
    color: #262626;
    margin: 0 0 8px 0;
}

.document-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.document-item {
    margin: 0 0 8px 0;
}

.document-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #006680;
    text-decoration: none;
    padding: 8px 10px;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    background-color: #ffffff;
    min-height: 44px;
}

.document-link:hover,
.document-link:focus {
    color: #006680;
    background-color: #FAF0F0;
    text-decoration: none;
}

.document-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
}

.document-meta {
    display: inline-flex;
    flex-direction: column;
}

.document-name {
    font-weight: 600;
    line-height: 1.2;
}

.document-size {
    font-size: 0.8125rem;
    color: #C74200;
    line-height: 1.2;
}

.spDTC {
    height: auto;
}

/* ==========================================================================
   Document Card Grid
   ========================================================================== */

.doc-section {
    margin: 0 0 20px 0;
}

.doc-section-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #8E0E11;
    margin: 0 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 2px solid #B11216;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.doc-instructions {
    font-size: 0.8125rem;
    color: #595959;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.doc-card-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.doc-card {
    margin: 0;
    padding: 0;
    flex: 0 1 auto;
}

/* Compact horizontal card button */
.doc-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #D9D9D9;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    font-family: 'Inter', 'Noto Sans', sans-serif;
    font-size: 0.875rem;
    color: #262626;
    white-space: nowrap;
    min-height: 44px;
    min-width: 44px;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    position: relative;
}

.doc-card-btn:hover {
    border-color: #B11216;
    box-shadow: 0 1px 4px rgba(177, 18, 22, 0.10);
    background: #FFF8F8;
}

.doc-card-btn:focus {
    outline: 3px solid #B11216;
    outline-offset: 2px;
    border-color: #B11216;
}

.doc-card-btn:active {
    background: #FFF1EB;
}

/* Confirmed/opened state */
.doc-card-btn.doc-confirmed {
    border-color: #197A3A;
    background: #F0FBF4;
}

.doc-card-btn.doc-confirmed .doc-card-label {
    color: #197A3A;
}

/* Icon — inline with label */
.doc-card-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 1;
}

.doc-card-icon img {
    display: block;
    width: 20px;
    height: 20px;
}

/* Label */
.doc-card-label {
    font-weight: 600;
    color: #006680;
    line-height: 1.3;
    white-space: nowrap;
}

.validation-modal[hidden] {
    display: none;
}

.validation-modal {
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(38, 38, 38, 0.45);
}

.validation-modal-content {
    max-width: 420px;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #CAAB77;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(38, 38, 38, 0.25);
}

.validation-modal-content h2 {
    color: #8E0E11;
    margin-bottom: 12px;
}

.validation-modal-message {
    display: none;
}

/* File size badge */
.doc-card-size {
    display: inline-block;
    font-size: 0.6875rem;
    color: #595959;
    background: #F3F3F3;
    border-radius: 3px;
    padding: 1px 6px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Checkmark — hidden until .doc-confirmed */
.doc-card-check {
    display: none;
    font-size: 0.9rem;
    color: #197A3A;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    animation: doc-pop 0.25s ease;
}

.doc-card-btn.doc-confirmed .doc-card-check {
    display: inline;
}

@keyframes doc-pop {
    0%   { transform: scale(0.5); opacity: 0; }
    70%  { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1);   opacity: 1; }
}

/* Empty state */
.doc-empty {
    color: #C74200;
    font-size: 0.875rem;
    margin: 0;
}

/* --- Mobile / iframe-friendly responsive --- */
@media (max-width: 480px) {
    body {
        font-size: 0.875rem;
        padding: 4px;
    }

    .search-form {
        padding: 8px;
    }

    .search-form input[type="text"],
    .search-form select {
        width: 100%;
    }

    .mGrid {
        font-size: 0.8125rem;
    }

    .mGrid th,
    .mGrid td {
        padding: 6px 4px;
    }

    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    .page-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 0 10px;
        font-size: 0.8125rem;
    }

    .page-ellipsis {
        min-width: 40px;
        min-height: 40px;
        padding: 0 8px;
        font-size: 0.8125rem;
    }

    .page-jump {
        gap: 3px;
    }

    .page-jump-input {
        width: 42px;
        min-height: 40px;
        padding: 0 4px;
        font-size: 0.8125rem;
    }

    .page-jump-modal-content {
        flex-wrap: wrap;
        max-width: 92%;
        padding: 16px;
    }

    .page-jump-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 0 8px;
        font-size: 0.8125rem;
    }

    .pagination-controls .btn-prev {
        order: 2;
        margin-right: auto;
    }

    .pagination-controls .btn-next {
        order: 3;
        margin-left: auto;
    }

    .pagination-controls .page-numbers {
        order: 1;
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 4px;
        flex-wrap: nowrap;
        margin-bottom: 12px;
    }

    .doc-card-grid {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .doc-card {
        flex: 0 0 calc(50% - 4px);
    }

    .doc-card-btn {
        width: 100%;
        white-space: normal;
        padding: 6px 8px;
        font-size: 0.8125rem;
        min-height: 40px;
    }

    .details-title {
        font-size: 1.125rem;
    }
}
