:root {
    --otf-blue: #1565c0;
    --otf-blue-dark: #0d47a1;
    --otf-amber: #ffa000;
    --otf-bg: #f5f5f5;
    --otf-surface: #ffffff;
    --otf-text: #212121;
    --otf-secondary-text: #616161;
    --otf-error: #c62828;
    --otf-success: #2e7d32;
    --otf-radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--otf-bg);
    color: var(--otf-text);
}

/* ==========================================================================
   Header (public pages) — top image row + menu row below
   ========================================================================== */

.site-header {
    background-color: var(--otf-blue);
    color: white;
    position: relative;
}

.site-header-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 16px 24px;
}

.header-logo {
    grid-column: 1;
    justify-self: start;
    height: 72px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    color: transparent;
}

.header-picture {
    grid-column: 2;
    justify-self: center;
    height: 110px;
    width: auto;
    max-width: 360px;
    object-fit: contain;
    border-radius: 8px;
    color: transparent; /* hides alt text + broken-image icon if the file is missing */
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 24px;
    background-color: var(--otf-blue);
}

.nav-links-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    flex: 1;
}

.nav-links-row a,
.nav-link-button {
    color: black;
    text-decoration: none;
    margin: 0 12px;
    font-size: 14px;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-links-row a.active,
.nav-links-row a:hover,
.nav-link-button:hover {
    border-bottom-color: var(--otf-amber);
}

.nav-dropdown-toggle {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid white;
    color: white;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.nav-dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 24px;
    background: var(--otf-surface);
    border-radius: 0 var(--otf-radius) var(--otf-radius) var(--otf-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 500;
    min-width: 220px;
}

.nav-dropdown-menu[hidden] {
    display: none;
}

.nav-dropdown-menu a,
.nav-dropdown-menu .nav-link-button {
    color: var(--otf-text);
    text-decoration: none;
    padding: 12px 16px;
    font-size: 14px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    border-bottom: 1px solid #eee;
}

.nav-dropdown-menu a:last-child,
.nav-dropdown-menu .nav-link-button:last-child {
    border-bottom: none;
}

.nav-dropdown-menu a.active,
.nav-dropdown-menu a:hover,
.nav-dropdown-menu .nav-link-button:hover {
    background-color: var(--otf-bg);
}

.nav-dropdown-inert {
    color: var(--otf-secondary-text) !important;
    cursor: default !important;
}

.nav-dropdown-inert:hover {
    background-color: transparent !important;
}

/* "More" submenu — anchored to the nav row itself, independent of the ☰ dropdown */
.more-menu-wrapper {
    position: relative;
    display: inline-block;
}

.more-toggle {
    white-space: nowrap;
}

.more-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--otf-surface);
    border-radius: 0 var(--otf-radius) var(--otf-radius) var(--otf-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 500;
    min-width: 200px;
}

.more-dropdown-menu[hidden] {
    display: none;
}

.more-dropdown-menu a {
    color: var(--otf-text);
    text-decoration: none;
    padding: 10px 16px;
    font-size: 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.more-dropdown-menu a:last-child {
    border-bottom: none;
}

.more-dropdown-menu a.active,
.more-dropdown-menu a:hover {
    background-color: var(--otf-bg);
}

.site-main {
    min-height: 70vh;
}

/* ==========================================================================
   Project Gallery
   ========================================================================== */

.gallery-project {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin-bottom: 24px;
}

.gallery-project h2 {
    color: var(--otf-blue);
    margin: 0 0 8px;
}

.gallery-project-description {
    color: var(--otf-secondary-text);
    margin-bottom: 16px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.gallery-item {
    margin: 0;
}

.gallery-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.gallery-item figcaption {
    font-size: 13px;
    color: var(--otf-secondary-text);
    margin-top: 6px;
    text-align: center;
}

.admin-gallery-project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.admin-gallery-project-header h2 {
    margin: 0;
    color: var(--otf-blue);
    font-size: 18px;
}

.admin-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.admin-gallery-thumb {
    background: var(--otf-bg);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

.admin-gallery-thumb img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.admin-gallery-thumb .table-action-button {
    margin-top: 8px;
    background-color: var(--otf-error);
}

#addProjectButton {
    width: auto;
    padding: 10px 18px;
    margin-bottom: 16px;
}

/* ==========================================================================
   Donate page
   ========================================================================== */

/* ==========================================================================
   Access hub (Member/Admin landing page)
   ========================================================================== */

.access-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.access-hub-card {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.access-hub-card h2 {
    margin: 0 0 4px;
    font-size: 18px;
    color: var(--otf-blue);
}

.access-hub-card p {
    margin: 0 0 12px;
    color: var(--otf-secondary-text);
    font-size: 14px;
}

.access-hub-card .button-link {
    margin-top: 4px;
}

.donate-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.donate-option-button {
    background: var(--otf-surface);
    border: 2px solid #ddd;
    border-radius: var(--otf-radius);
    padding: 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--otf-text);
    cursor: pointer;
    text-align: center;
    line-height: 1.8;
}

.donate-option-button:hover {
    border-color: var(--otf-blue);
}

.donate-option-button.active {
    border-color: var(--otf-blue);
    background-color: #e3f2fd;
}

.donate-section {
    margin-top: 8px;
}

#bankingDetailsTable th {
    background-color: var(--otf-blue);
    color: white;
    width: 40%;
}


.site-footer {
    text-align: center;
    padding: 16px;
    color: var(--otf-secondary-text);
    font-size: 13px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.social-link {
    color: var(--otf-blue);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.social-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Public pages (Home, general content)
   ========================================================================== */

.page-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 16px;
}

.page-container h1 {
    color: var(--otf-blue);
}

.lead {
    color: var(--otf-secondary-text);
    line-height: 1.6;
}

.card {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin: 20px 0;
}

.home-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.button-link {
    padding: 12px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.button-link.primary {
    background-color: var(--otf-blue);
    color: white;
}

.button-link.secondary {
    background-color: transparent;
    color: var(--otf-blue);
    border: 1px solid var(--otf-blue);
}

/* ==========================================================================
   Forms (Report Problem, Contact/Feedback)
   ========================================================================== */

.app-form {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.app-form label {
    margin-top: 14px;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}

.app-form input,
.app-form select,
.app-form textarea {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
}

.app-form input:focus,
.app-form select:focus,
.app-form textarea:focus {
    outline: none;
    border-color: var(--otf-blue);
}

.app-form button[type="submit"] {
    margin-top: 24px;
    padding: 12px;
    background-color: var(--otf-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.app-form button[type="submit"]:hover {
    background-color: var(--otf-blue-dark);
}

.app-form button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.status-message {
    max-width: 720px;
    margin: 16px auto 0;
    padding: 12px 16px;
    background-color: #e3f2fd;
    color: var(--otf-blue-dark);
    border-radius: 6px;
}

/* ==========================================================================
   Media preview + pinch zoom (Report Problem)
   ========================================================================== */

.media-preview-container {
    margin-top: 16px;
    text-align: center;
}

.media-preview-zoom-wrapper {
    max-width: 100%;
    max-height: 320px;
    overflow: auto;
    touch-action: pinch-zoom;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.media-preview-zoomable {
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

.media-preview-zoomable[hidden] {
    display: none;
}

.remove-media-button {
    margin-top: 10px;
    background: none;
    border: 1px solid var(--otf-error);
    color: var(--otf-error);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
}

.hint {
    font-size: 12px;
    color: var(--otf-secondary-text);
    margin-top: 6px;
}

/* ==========================================================================
   WhatsApp confirmation dialog (Report Problem)
   ========================================================================== */

.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
}

/* Ensure the [hidden] attribute is respected — without this rule, the
   display:flex above overrides the browser's default hidden{display:none} */
.dialog-overlay[hidden] {
    display: none;
}

.dialog-box {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    padding: 24px;
    max-width: 400px;
    width: 100%;
}

.dialog-box h3 {
    margin-top: 0;
}

.dialog-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.dialog-primary {
    background-color: var(--otf-blue);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.dialog-secondary {
    background: none;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
}

.dialog-cancel {
    background: none;
    border: 1px solid var(--otf-error);
    color: var(--otf-error);
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
}

/* ==========================================================================
   Project Events
   ========================================================================== */

.events-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.event-card {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 20px;
}

.event-title {
    margin: 0 0 8px;
    color: var(--otf-blue);
    font-size: 18px;
}

.event-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--otf-secondary-text);
    margin-bottom: 6px;
}

.event-location {
    font-size: 14px;
    color: var(--otf-secondary-text);
    margin-bottom: 10px;
}

.event-description {
    margin: 0;
    line-height: 1.6;
}

/* ==========================================================================
   Admin — Dashboard link cards, tables, stats, status badges
   ========================================================================== */

.dashboard-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.dashboard-link-card {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 20px;
    text-decoration: none;
    color: var(--otf-text);
    display: block;
}

.dashboard-link-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.dashboard-link-card h3 {
    margin: 0 0 8px;
    color: var(--otf-blue);
    font-size: 16px;
}

.dashboard-link-card p {
    margin: 0;
    font-size: 13px;
    color: var(--otf-secondary-text);
}

.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 20px;
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--otf-blue);
}

.stat-label {
    font-size: 13px;
    color: var(--otf-secondary-text);
    margin-top: 4px;
}

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--otf-surface);
    border: 1px solid #ccc;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 10px 12px;
    border: 1px solid #ccc;
    font-size: 13px;
}

.admin-table th {
    background-color: var(--otf-blue);
    color: white;
    font-weight: 600;
}

.table-action-button {
    width: auto;
    padding: 6px 12px;
    font-size: 12px;
    background-color: var(--otf-blue);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background-color: #e0e0e0;
    color: #424242;
}

.status-badge.status-SUBMITTED { background-color: #e3f2fd; color: #1565c0; }
.status-badge.status-IN_REVIEW { background-color: #fff3e0; color: #ef6c00; }
.status-badge.status-IN_PROGRESS { background-color: #fff8e1; color: #f9a825; }
.status-badge.status-RESOLVED { background-color: #e8f5e9; color: #2e7d32; }
.status-badge.status-CLOSED { background-color: #eeeeee; color: #616161; }

.dialog-box-wide {
    max-width: 520px;
}

.dialog-box-wide form label {
    margin-top: 12px;
    margin-bottom: 4px;
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.dialog-box-wide form input,
.dialog-box-wide form select,
.dialog-box-wide form textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.dialog-box-wide form input:disabled {
    background-color: #f0f0f0;
}

#addEventButton,
#addUserButton {
    width: auto;
    padding: 10px 18px;
    margin-bottom: 16px;
}

/* ==========================================================================
   Admin — Login
   ========================================================================== */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.auth-card {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 32px;
    width: 100%;
    max-width: 380px;
}

.auth-card h1 {
    margin: 0 0 4px;
    font-size: 24px;
    color: var(--otf-blue);
}

.subtitle {
    margin: 0 0 24px;
    color: var(--otf-secondary-text);
    font-size: 14px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--otf-blue);
}

button {
    width: 100%;
    padding: 12px;
    background-color: var(--otf-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    background-color: var(--otf-blue-dark);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    margin-top: 16px;
    color: var(--otf-error);
    font-size: 14px;
    text-align: center;
}

/* ==========================================================================
   Admin — Dashboard
   ========================================================================== */

.dashboard-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.dashboard-header h1 {
    color: var(--otf-blue);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.logout-link {
    color: var(--otf-error);
    text-decoration: none;
    font-weight: 600;
}

.dashboard-note {
    color: var(--otf-secondary-text);
    margin-bottom: 24px;
}

.dashboard-card {
    background: var(--otf-surface);
    border-radius: var(--otf-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin-bottom: 24px;
}

.dashboard-card h2 {
    margin-top: 0;
    font-size: 18px;
}

.dashboard-card code {
    background: #eeeeee;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.test-result {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
}

.test-result.success {
    background-color: #e8f5e9;
    color: var(--otf-success);
}

.test-result.failure {
    background-color: #ffebee;
    color: var(--otf-error);
}

.exit-link {
    display: inline-block;
    color: var(--otf-blue);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--otf-blue);
    padding: 10px 16px;
    border-radius: 6px;
}

.exit-link:hover {
    background-color: var(--otf-blue);
    color: white;
}

/* ==========================================================================
   PWA install banner
   ========================================================================== */

.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--otf-blue-dark);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    z-index: 2000;
    font-size: 14px;
}

.pwa-install-actions {
    display: flex;
    gap: 8px;
}

.pwa-install-actions button {
    width: auto;
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

#pwaInstallButton {
    background-color: var(--otf-amber);
    color: #212121;
}

.pwa-dismiss {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
}
