/*
 * Copyright 2025 James Seaward
 * Version: 4.3
 *
 * CHANGELOG:
 * -----------------------------------------------------------------------------
 * v4.3  2026-07-16  Fine-tuned header copyright and tagline optical alignment.
 * v4.2  2026-07-16  Reduced header credit spacing to align the tagline with the title.
 * v4.1  2026-07-16  Reverted header grid layout and raised the tagline within the compact header.
 * v4.0  2026-07-16  Reworked header layout into a two-row grid for tagline/title alignment.
 * v3.9  2026-07-16  Bottom-aligned the header tagline with the title and increased credit spacing.
 * v3.8  2026-07-16  Top-aligned the header credit lockup with the version label.
 * v3.7  2026-07-16  Matched header credit logo placement and opacity to Team Clinic.
 * v3.6  2026-07-16  Moved Seaward logo and copyright styling into the app header.
 * v3.5  2026-07-16  Condensed OCR guidance card spacing and removed header band styling.
 * v3.4  2026-07-16  Strengthened OCR guidance card styling and paired with stylesheet cache busting.
 * v3.3  2026-07-16  Converted the OCR guidance into a distinct card with header and body styling.
 * v3.2  2026-07-16  Refined the OCR guidance card with stronger visual hierarchy.
 * v3.1  2026-07-16  Restyled the OCR notice as an official guidance card inside the form.
 * v3.0  2026-07-16  Added prominent notice styling for scanned PDF OCR guidance.
 * v2.9  2026-07-16  Added custom Choose Folder styling for the folder upload control.
 * v2.8  2026-07-16  Restored compact green header and changed section labels to sans-serif utility headings.
 * v2.7  2026-07-16  Modernized the app styling with cleaner surfaces, inputs, and actions.
 * v2.6  2026-07-16  Matched the compact drag-and-drop PDF field height to standard file inputs.
 * v2.5  2026-07-16  Added Seaward logo and copyright footer styling.
 * v2.4  2026-07-16  Added drag-and-drop drop-zone styling for PDF uploads.
 * v2.3  2026-07-16  Removed boxed upload-field styling and aligned side upload controls.
 * v2.2  2026-07-16  Added compact side-by-side redaction textarea and file upload layout.
 * v2.1  2026-07-16  Replaced viewport-scaled heading type with fixed responsive sizes.
 * v2.0  2026-07-16  Restyled the app with a Team Clinic-inspired emerald and marble theme.
 * v1.3  2026-07-15  Added result action and danger button styling.
 * v1.2  2026-07-15  Added secondary form action styling.
 * v1.1  2026-07-15  Added responsive layout support for paired upload controls.
 * v1.0  2026-07-15  Added the initial redaction app interface styling.
 * =============================================================================
 */

:root {
    color-scheme: light;
    --bg: #f6f7f4;
    --panel: #ffffff;
    --panel-soft: #fbfcfa;
    --text: #24302d;
    --muted: #687371;
    --line: #dfe5df;
    --accent: #0d5c4a;
    --accent-dark: #083d32;
    --gold: #c9a227;
    --danger: #c0392b;
    --danger-dark: #922b21;
    --success: #0d5c4a;
    --shadow: 0 14px 34px rgba(36, 48, 45, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'Lato', Arial, Helvetica, sans-serif;
    line-height: 1.45;
    font-weight: 400;
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0;
}

.app-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
    padding: 24px 30px;
    border: 0;
    border-bottom: 3px solid var(--gold);
    border-radius: 10px;
    background: linear-gradient(135deg, #0d5c4a 0%, #083d32 100%);
    color: white;
    box-shadow: 0 10px 26px rgba(13, 92, 74, 0.2);
}

.result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 6px;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.85rem;
    font-weight: 600;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 8px;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 500;
}

.header-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 24px;
    text-align: right;
}

.header-meta p {
    max-width: none;
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.84);
    font-size: 0.98rem;
    font-weight: 300;
    white-space: nowrap;
    transform: translateY(3px);
}

.header-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.25;
    transform: translateY(-2px);
}

.header-logo {
    width: 27px;
    height: 27px;
    object-fit: contain;
    opacity: 0.72;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.16));
}

.eyebrow {
    margin-bottom: 4px;
    color: inherit;
    opacity: 0.78;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.panel {
    margin-bottom: 18px;
    padding: 28px;
    background: var(--panel);
    border: 1px solid rgba(36, 48, 45, 0.08);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.guidance-card {
    margin: 0 0 24px;
    border: 2px solid rgba(13, 92, 74, 0.38);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    box-shadow: 0 12px 28px rgba(13, 92, 74, 0.14);
    overflow: hidden;
}

.guidance-card-body {
    padding: 14px 16px;
    background: #fff;
}

.guidance-card strong {
    display: inline;
    margin-right: 4px;
    color: #24302d;
    font-size: 1rem;
    font-weight: 800;
}

.guidance-card p {
    margin: 0;
    color: var(--muted);
}

.field {
    margin-bottom: 18px;
}

.form-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid #eeeeea;
}

.form-section:last-of-type {
    border-bottom: 0;
}

.section-title {
    margin-bottom: 16px;
    color: var(--accent);
    font-family: 'Lato', Arial, Helvetica, sans-serif;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.split-field {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.split-field .hint {
    grid-column: 1 / -1;
}

.redaction-pair {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(240px, 0.7fr);
    column-gap: 22px;
    row-gap: 14px;
    align-items: start;
}

.redaction-pair .field {
    margin-bottom: 0;
}

.upload-field {
    padding-top: 0;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #3f4a47;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

input[type="file"],
textarea {
    display: block;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

input[type="file"] {
    padding: 13px 14px;
    background: #fff;
}

input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--panel-soft);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.drop-zone {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 51px;
    padding: 13px 14px;
    border: 1px dashed #b3c4bf;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.drop-zone input[type="file"] {
    padding: 0;
    border: 0;
    width: auto;
    background: transparent;
}

.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(13, 92, 74, 0.04);
    box-shadow: 0 0 0 3px rgba(13, 92, 74, 0.12);
}

.drop-zone-text {
    margin: 0;
    color: var(--accent);
    font-size: 0.92rem;
    font-weight: 600;
}

.folder-upload {
    display: flex;
    align-items: center;
    min-height: 51px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.screen-reader-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.file-proxy-button {
    min-height: 0;
    margin-right: 10px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--panel-soft);
    color: var(--text);
    box-shadow: none;
    font-size: 0.92rem;
    letter-spacing: 0;
}

.file-proxy-button:hover {
    border-color: var(--accent);
    background: rgba(13, 92, 74, 0.035);
    color: var(--accent);
    box-shadow: none;
    transform: none;
}

.file-proxy-status {
    color: var(--muted);
    font-size: 0.92rem;
}

textarea {
    min-height: 132px;
    padding: 13px 14px;
    resize: vertical;
}

input[type="file"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 92, 74, 0.15);
}

.hint {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(13, 92, 74, 0.18);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.secondary-button {
    border: 1px solid var(--line);
    background: #fff;
    color: #555;
    box-shadow: none;
}

.secondary-button:hover {
    border-color: var(--accent);
    background: rgba(13, 92, 74, 0.035);
    color: var(--accent);
}

.danger-button {
    background: var(--danger);
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.25);
}

.danger-button:hover {
    background: var(--danger-dark);
    box-shadow: 0 6px 18px rgba(192, 57, 43, 0.35);
}

button:hover,
.button-link:hover {
    background: var(--accent-dark);
    box-shadow: 0 10px 22px rgba(13, 92, 74, 0.24);
    transform: translateY(-2px);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 8px;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid #eeeeea;
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--panel-soft);
    color: #3f4a47;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

tr:hover td {
    background: rgba(13, 92, 74, 0.035);
}

.status {
    color: var(--muted);
    font-weight: 600;
}

.status.processed {
    color: var(--success);
}

.status.error {
    color: var(--danger);
}

.error-panel {
    border-top-color: var(--danger);
}

.success-panel {
    border-top-color: var(--success);
}

@media (max-width: 720px) {
    h1 {
        font-size: 2.35rem;
    }

    .app-header,
    .result-head {
        display: block;
    }

    .header-meta {
        align-items: flex-start;
        margin-top: 16px;
        text-align: left;
        gap: 10px;
    }

    .header-meta p {
        white-space: normal;
    }

    .guidance-card {
        margin-bottom: 22px;
    }

    .button-link {
        margin-top: 12px;
    }

    .result-actions {
        justify-content: flex-start;
        margin-top: 12px;
    }

    .split-field,
    .redaction-pair {
        grid-template-columns: 1fr;
    }
}
