body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 2em 1em;
    background-color: #f7fafc;
}
.container {
    max-width: 800px;
    margin: 0 auto;
}
.header {
    text-align: center;
    margin-bottom: 2em;
}
.header h1 {
    font-size: 1.8em;
    color: #2d3748;
    margin: 0.2em 0;
}
.header h1 .icon { color: #e53e3e; }
.header p {
    font-size: 1em;
    color: #718096;
    max-width: 400px;
    margin: 0.5em auto 0 auto;
}
.tab-container {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}
.tab-nav {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
}
.tab-nav a {
    flex: 1;
    padding: 1em;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    color: #718096;
    background-color: #f1f5f9;
    border-bottom: 3px solid transparent;
}
.tab-nav a:first-child { border-top-left-radius: 8px; }
.tab-nav a:last-child { border-top-right-radius: 8px; }

/* --- Tab Active States --- */
.tab-nav a.active.nav-search {
    color: #2f855a;
    background-color: #ffffff;
    border-bottom-color: #38a169;
}
.tab-nav a.active.nav-post {
    color: #2b6cb0;
    background-color: #ffffff;
    border-bottom-color: #3182ce;
}
.tab-nav a.active.nav-request {
    color: #b83280;
    background-color: #ffffff;
    border-bottom-color: #d63384;
}
.tab-nav a.active.nav-list {
    color: #5a32b8;
    background-color: #ffffff;
    border-bottom-color: #6f42c1;
}
.tab-nav a.active.nav-stats {
    color: #dd6b20; /* Orange color */
    background-color: #ffffff;
    border-bottom-color: #dd6b20;
}
.tab-nav a.active.nav-admin-pending {
    color: #c53030; /* Red */
    background-color: #ffffff;
    border-bottom-color: #e53e3e;
}

.tab-content {
    padding: 2em;
}

/* --- Base Form Styles --- */
form { display: grid; grid-gap: 1.25em; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 1em;
}
form label { font-weight: 600; color: #4a5568; margin-bottom: 0.5em; display: block; }
form input[type="text"], form textarea, form select {
    width: 100%;
    padding: 0.8em;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 1em;
    font-family: inherit;
    box-sizing: border-box;
}
form textarea { min-height: 80px; }
form input[type="submit"] {
    padding: 1em;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #ffffff;
}
input[type="date"] {
    height: 45px; /* Match other form fields */
}

/* --- Button Color Styles --- */
form input[type="submit"].btn-search { background-color: #38a169; }
form input[type="submit"].btn-search:hover { background-color: #2f855a; }

form input[type="submit"].btn-post { background-color: #3182ce; }
form input[type="submit"].btn-post:hover { background-color: #2b6cb0; }

form input[type="submit"].btn-request { background-color: #d63384; }
form input[type="submit"].btn-request:hover { background-color: #b83280; }

.btn-delete {
    background-color: #e53e3e; /* Red */
    color: white;
    padding: 0.3em 0.8em;
    font-size: 0.9em;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-delete:hover {
    background-color: #c53030; /* Darker Red */
}

/* --- Page Header Styles --- */
.requests-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5em;
}
.header-buttons {
    display: flex;
    gap: 10px; /* Adds space between the buttons */
    align-items: center;
}
.requests-header a.btn-primary {
    background-color: #3182ce;
    color: white;
    padding: 0.75em 1.25em;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
}
.requests-header a.btn-primary:hover {
    background-color: #2b6cb0;
}
.btn-primary.btn-search { /* For Export buttons */
    background-color: #38a169;
}
.btn-primary.btn-search:hover {
    background-color: #2f855a;
}

/* --- Flash Messages (Alerts) --- */
.flash {
    padding: 1em; margin-bottom: 1em; border-radius: 6px;
    font-weight: 600;
}
.flash.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* --- Search Results Styling (Homepage) --- */
.search-results { margin-top: 2em; }
.search-results h2 { color: #2d3748; }
.report-list { list-style-type: none; padding: 0; }
.report-item {
    background: #f9f9f9;
    border: 1px solid #e2e8f0;
    padding: 1.5em;
    margin-bottom: 1em;
    border-radius: 8px;
}
.report-item p { margin: 0.5em 0; line-height: 1.5; }
.report-item strong { color: #2d3748; }
.report-time { font-size: 0.9em; color: #718096; }


/* --- Styles for Table Lists (Survivor & Request Pages) --- */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}
.survivor-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5em;
    font-size: 0.95em;
}
.survivor-table th,
.survivor-table td {
    padding: 0.75em 0.5em;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.survivor-table thead th {
    background-color: #f7fafc;
    border-bottom-width: 2px;
}
.survivor-table th a {
    text-decoration: none;
    color: #4a5568;
    font-weight: 600;
}
.survivor-table th a.sort-active { color: #000; }
.survivor-table th a:hover { color: #000; }
.survivor-table tbody tr:nth-child(even) {
    background-color: #fdfdfd;
}

/* --- Pagination Styles --- */
.pagination {
    margin-top: 2em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    color: #718096;
}
.pagination .page-links a,
.pagination .page-links span {
    padding: 0.5em 0.75em;
    margin: 0 2px;
    border-radius: 6px;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    color: #2b6cb0;
    background: #fff;
}
.pagination .page-links a:hover {
    background-color: #f7fafc;
}
.pagination .page-links a.active {
    background-color: #3182ce;
    color: white;
    border-color: #3182ce;
}
.pagination .page-links span.disabled {
    color: #cbd5e0;
    background: #f7fafc;
}
.pagination .page-links span.ellipsis {
    border: none;
    background: none;
    padding: 0.5em 0.25em;
}

/* --- Page Instructions Banner --- */
.doc-banner {
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
    border-radius: 6px;
    padding: 0.8em 1em;
    margin-bottom: 2em;
    color: #1890ff;
    font-size: 0.9em;
}
.doc-banner strong {
    color: #1263c9;
}

/* --- Filter Form Styles (Survivor & Request Pages) --- */
.search-filter-form {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    padding: 1em;
    border-radius: 6px;
    margin-bottom: 2em;
}
.filter-controls {
    display: flex;
    align-items: center;
    gap: 1em;
}
/* Specific layout for the 2-column survivor list filter */
.filter-controls.survivor-filter {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1em;
    align-items: flex-end;
}
.filter-controls.survivor-filter .filter-buttons {
    display: flex;
    gap: 0.5em;
}
.filter-controls label {
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 0.5em; 
    display: block; 
}
.filter-controls select,
.filter-controls input[type="text"] {
    flex-grow: 1; 
    max-width: 300px;
    width: 100%; 
    height: 45px; 
    box-sizing: border-box;
}
.filter-controls .btn-secondary {
    background-color: #555;
    color: white;
    padding: 0.8em 1.2em;
    font-size: 0.9em;
    border: none;
    cursor: pointer;
    height: 45px; 
    line-height: 1.5;
    border-radius: 6px;
}
.filter-controls .btn-secondary:hover {
    background-color: #333;
}
.btn-clear-filter {
    color: #3182ce;
    text-decoration: none;
    font-size: 0.9em;
    padding: 0.8em 1.2em;
    display: inline-block;
    height: 45px; 
    line-height: 1.5;
    box-sizing: border-box;
}
.btn-clear-filter:hover {
    text-decoration: underline;
}

/* --- Stats Page Styles --- */
.page-description {
    margin-top: 0; 
    color: #718096;
}
.parish-summary {
    margin-bottom: 2em;
    padding: 15px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.parish-summary h4 {
    margin-top: 5px;
    margin-bottom: 15px;
}
.parish-summary-total {
    font-size: 0.9em; 
    color: #718096;
    margin-top: -10px;
    margin-bottom: 15px;
}
.parish-stats-list {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 12px;
    font-size: 0.9em;
}
.parish-bar-item { 
    font-size: 0.9em;
}
.parish-bar-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
}
.parish-bar-header strong {
    color: #4a5568;
}
.progress-bar-bg {
    background: #e2e8f0;
    height: 10px;
    border-radius: 5px;
    overflow: hidden; 
}
.progress-bar-fill {
    background: #3182ce;
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease-out; 
}
.progress-bar-fill-danger {
    background: #e53e3e; 
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease-out;
}

/* --- "Report Found" Workflow Styles --- */
.btn-report-found {
    background-color: #38a169;
    color: white !important;
    padding: 0.3em 0.8em;
    font-size: 0.9em;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn-report-found:hover {
    background-color: #2f855a;
}
.status-pending {
    font-size: 0.9em;
    font-weight: 600;
    color: #dd6b20; /* Orange */
}
.admin-action-buttons {
    display: flex;
    gap: 8px;
}
.admin-action-buttons form {
    display: inline-block;
}
.admin-action-buttons input[type="submit"] {
    padding: 0.3em 0.8em;
    font-size: 0.9em;
}

/* --- Responsive Styles --- */
@media (max-width: 768px) {
    .pagination {
        flex-direction: column;
        gap: 1em;
    }
    
    .survivor-table {
        font-size: 0.8em;
    }
}

/* --- Styles for Conversion Total Box --- */
.conversion-total-box {
    text-align: center;
    padding: 1.5em 1em;
    background-color: #f7fafc;
    border-radius: 6px;
}
.conversion-total-box h1 {
    font-size: 3em;
    color: #2f855a; /* Green */
    margin: 0;
}
.conversion-total-box p {
    margin: 0;
    font-weight: 600;
    color: #4a5568;
}

@media (max-width: 600px) {
    body { padding: 0; }
    .container { padding: 0.5em; }
    .tab-content { padding: 1em; }
    .form-row { grid-template-columns: 1fr; }
    .header h1 { font-size: 1.5em; }

    /* Filter forms stacking */
    .filter-controls,
    .filter-controls.survivor-filter {
        flex-direction: column;
        grid-template-columns: 1fr; /* Stack everything */
        align-items: stretch;
        gap: 0.5em;
    }
    .filter-controls select,
    .filter-controls input[type="text"] {
        max-width: 100%;
    }
    .filter-controls label, 
    .filter-controls .btn-secondary, 
    .filter-controls .btn-clear-filter {
        width: 100%;
        text-align: center;
    }
    .filter-controls.survivor-filter .filter-buttons {
        flex-direction: column;
    }

    /* Navbar stacking */
    .tab-nav {
        flex-direction: column; /* Stack tabs vertically */
    }
    .tab-nav a:first-child { 
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
        border-bottom-left-radius: 0; /* Remove bottom radius */
    }
    .tab-nav a:last-child { 
        border-top-right-radius: 0; /* Remove top radius */
        border-bottom-left-radius: 8px;
        border-bottom-right-radius: 8px;
    }
    .tab-nav a:not(:last-child) {
        border-bottom: 1px solid #e2e8f0;
    }
    .tab-nav a.active {
        border-bottom-color: transparent !important;
    }
    
    /* Header button stacking */
    .requests-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .requests-header .header-buttons {
        width: 100%;
        flex-direction: column; 
        margin-top: 1em;
        gap: 0.75em; 
    }
    .requests-header a.btn-primary {
        width: 100%;
        text-align: center;
        margin-top: 0; 
        box-sizing: border-box;
    }
}