﻿/* -------------------------
   Global variables
-------------------------- */
:root {
  --primary: #1f2a68;
  --primary-dark: #182052;
  --text-dark: #1a1a1a;
  --text-light: #ffffff;
  --bg-light: #ffffff;
  --bg-footer: #1f2a68;
  --max-width: 1200px;
}

/* -------------------------
   Reset & base
-------------------------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Segoe UI Light", "Segoe UI Semibold",
               system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-dark);
  background: var(--bg-light);
}

a { color: inherit; text-decoration: none; }

/* -------------------------
   Header
-------------------------- */
.site-header { border-bottom: 2px solid #e5e5e5; }

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.branding { font-size: 20px; font-weight: 600; color: #9a9a9a; }
.branding span { font-weight: 700; color: #bfbfbf; }

.login-btn {
  background: var(--primary);
  color: var(--text-light);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
}

.header-right { font-size: 22px; font-weight: 600; color: var(--primary); }
.header-title { white-space: nowrap; }

.page-home .login-btn { padding: 8px 16px; font-size: 14px; border-radius: 6px; }

/* -------------------------
   Main content
-------------------------- */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 16px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 64px;
}

.hero-text h1 { margin-top: 0; font-size: 28px; }
.hero-text p  { font-size: 16px; line-height: 1.6; }

.hero-image { display: flex; align-items: center; justify-content: center; }
.hero-image img {
  width: 100%; max-width: 360px; height: auto; display: block;
  filter: drop-shadow(0 10px 24px rgba(0,0,0,0.1));
}

/* -------------------------
   Footer
-------------------------- */
.site-footer { background: var(--bg-footer); color: var(--text-light); margin-top: 48px; }

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.footer-section h4 { margin-top: 0; }
.footer-section p  { margin: 6px 0; font-size: 14px; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.2);
  text-align: center;
  padding: 12px;
  font-size: 13px;
}

/* -------------------------
   Responsive
-------------------------- */
@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; gap: 24px; margin-bottom: 48px; }
  .hero-image { order: 2; margin-top: 16px; margin-bottom: 16px; }
  .footer-inner { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; gap: 12px; }
  .hero-image img { max-width: 260px; margin: 0 auto; }
  .hero-text { order: 1; }
}

/* -------------------------
   Login / Auth Pages
-------------------------- */
.auth-container { max-width: 420px; margin: 0 auto; padding: 40px 16px; text-align: center; }
.auth-container h1 { margin-bottom: 24px; font-weight: 600; color: var(--primary); }

.auth-field { text-align: left; margin-bottom: 18px; }
.auth-field label { display: block; font-size: 14px; margin-bottom: 6px; }
.auth-field input {
  width: 100%; padding: 12px; font-size: 15px;
  border: 1px solid #ccc; border-radius: 6px; font-family: inherit;
}

.auth-button {
  width: 100%; background: var(--primary); color: var(--text-light);
  border: none; padding: 14px; border-radius: 8px;
  font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 10px;
}
.auth-button:hover { background: var(--primary-dark); }

.auth-links { margin-top: 16px; font-size: 14px; }
.auth-links a { color: var(--primary); font-weight: 600; }

@media (max-width: 480px) {
  .auth-container { padding: 24px 16px; }
}

/* -------------------------
   Buttons (shared)
-------------------------- */
.btn-primary {
  flex: 1; background: var(--primary); color: #fff;
  border: none; padding: 12px; border-radius: 6px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  flex: 1; background: #fff; color: var(--primary);
  border: 2px solid var(--primary); padding: 10px;
  border-radius: 6px; font-weight: 600; cursor: pointer;
}

.hidden { display: none; }

@media (max-width: 480px) {
  .modal { margin: 16px; padding: 24px 16px; }
  .modal-actions { flex-direction: column; }
}

/* ==========================================================
   Modal – shared overlay + box
   Default: hidden. Add .open to show.
   JS on auth page uses classList.add('open') to show.
========================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.open { display: flex; }

/* Auth / forgot-password modal box */
.modal {
  background: #ffffff;
  width: 100%;
  max-width: 420px;
  padding: 32px 24px;
  border-radius: 10px;
  text-align: center;
}
.modal-title  { margin-top: 0; margin-bottom: 12px; color: var(--primary); font-weight: 600; }
.modal-text   { font-size: 14px; line-height: 1.5; margin-bottom: 24px; color: #333; }
.modal-actions { display: flex; gap: 12px; margin-top: 24px; }

/* Review-page modal box (larger, scrollable) */
.modal-box {
  background: #fff;
  border-radius: 6px;
  padding: 22px 26px;
  min-width: 420px;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
.modal-box h3 { margin: 0 0 14px; font-size: 1rem; }
.modal-box .modal-actions { justify-content: flex-end; }

/* 2-column edit grid inside modals */
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.modal-grid label {
  display: flex; flex-direction: column;
  font-size: 0.82rem; gap: 3px; font-weight: 600;
}
.modal-grid label input,
.modal-grid label select,
.modal-grid label textarea {
  font-size: 0.82rem; padding: 4px 6px;
  border: 1px solid #ccc; border-radius: 3px; font-family: inherit;
}
.modal-grid .full { grid-column: 1 / -1; }


/* ==========================================================
   Lightbox
========================================================== */
#lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 9000;
  align-items: center; justify-content: center;
}
#lightbox.open  { display: flex; }
#lightbox img   { max-width: 92vw; max-height: 90vh; object-fit: contain; border-radius: 4px; }
#lightbox-close {
  position: absolute; top: 16px; right: 20px;
  color: #fff; font-size: 2rem; cursor: pointer;
  line-height: 1; background: none; border: none;
}


/* ==========================================================
   Shared badge components
========================================================== */
.badge {
  display: inline-block; padding: 1px 6px;
  border-radius: 10px; font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.badge-ok     { background: #d4edda; color: #155724; }
.badge-warn   { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info   { background: #d1ecf1; color: #0c5460; }
.badge-muted  { background: #e2e3e5; color: #383d41; }


/* ==========================================================
   Success / error messages
========================================================== */
.success-message {
  background: #d4edda; color: #155724;
  border: 1px solid #c3e6cb; border-radius: 4px;
  padding: 8px 14px; font-size: 0.88rem; margin-bottom: 6px;
}
.error-message {
  background: #f8d7da; color: #721c24;
  border: 1px solid #f5c6cb; border-radius: 4px;
  padding: 8px 14px; font-size: 0.88rem; margin-bottom: 6px;
}


/* ==========================================================
   Review Registrations – page layout
========================================================== */
.review-page { display: flex; flex-direction: column; gap: 8px; padding: 8px; }

/* toolbar */
.review-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  background: #f5f5f5; border: 1px solid #ddd;
  border-radius: 4px; padding: 6px 10px;
}
.review-toolbar-spacer { flex: 1; }
.upload-form { display: flex; gap: 4px; align-items: center; }

/* ── Toolbar buttons ─────────────────────────────────────────────── */
.review-toolbar button,
.review-toolbar .button-link {
  background: #232a69;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
  white-space: nowrap;
  transition: background 0.15s;
}
.review-toolbar button:hover,
.review-toolbar .button-link:hover { background: #1a2050; }

/* Export / Recapture – lighter blue */
.review-toolbar .btn-export        { background: #3b4281; }
.review-toolbar .btn-export:hover  { background: #2e3468; }

/* File input inside toolbar keeps default look */
.review-toolbar input[type="file"] { font-size: 0.82rem; }

/* two-column layout */
.review-layout { display: grid; grid-template-columns: 220px 1fr; gap: 8px; }
.review-layout.legend-collapsed                { grid-template-columns: 1fr; }
.review-layout.legend-collapsed .review-legend { display: none; }

.review-legend {
  font-size: 0.82rem;
  overflow: hidden;
  background: #6167a0;
  border-radius: 6px;
  padding: 10px 8px 6px;
}
.review-legend h3 {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.legend-card > div {
  background: #fff;
  border-radius: 5px;
  margin-bottom: 8px;
  overflow: hidden;
}
.legend-card strong {
  display: block;
  background: #3b4281;
  color: #fff;
  font-size: 0.81rem;
  font-weight: 700;
  padding: 5px 10px;
  text-align: center;
  letter-spacing: 0.03em;
}
.legend-card p {
  margin: 0;
  color: #333;
  line-height: 1.5;
  font-size: 0.79rem;
  padding: 7px 10px;
}
/* map colour swatches inside white box */
.legend-map-list {
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.79rem;
  color: #333;
}

.review-main { display: flex; flex-direction: column; gap: 8px; overflow: visible; min-width: 0; }

/* map */
#binMap { height: 340px; border: 1px solid #ccc; border-radius: 4px; }

.map-bar {
  display: flex; gap: 10px; font-size: 0.78rem;
  align-items: center; flex-wrap: wrap; padding: 2px 0;
}
.map-dot {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block; margin-right: 3px;
  border: 1px solid rgba(0,0,0,.22);
}

/* bulk action bar */
#bulkBar {
  display: none; align-items: center; gap: 8px;
  background: #e8f0fe; border: 1px solid #c5d3f5;
  border-radius: 4px; padding: 5px 10px; font-size: 0.83rem;
}
#bulkBar.visible { display: flex; }

/* action select colour-coding */
select.action-select              { font-size: 0.82rem; padding: 1px 4px; }
select.action-select.act-process  { background: #fff3cd; }
select.action-select.act-reject   { background: #f8d7da; }
select.action-select.act-accept   { background: #d4edda; }

/* table row states */
#registrationsTable tbody tr              { cursor: pointer; }
#registrationsTable tbody tr.selected-row { background: #e8f0fe !important; }

/* lat/long inputs */
.latlng-input {
  width: 90px; font-size: 0.78rem; padding: 1px 3px;
  border: 1px solid #bbb; border-radius: 3px; background: #fffde7;
}
.latlng-input.changed { border-color: #f39c12; background: #fff3cd; }

/* DataTables layout & scroll */
.dataTables_wrapper { width: 100%; min-width: 0; }

/* Scroll containers */
.dataTables_scrollHead { overflow: hidden !important; }
.dataTables_scrollBody { overflow-y: auto !important; overflow-x: auto !important; }
.dataTables_scrollBody > table { margin-top: 0 !important; }

/* Constrain form+table to available column width */
#actionsForm           { width: 100%; min-width: 0; }
#actionsForm > div     { width: 100%; min-width: 0; }
/* Let DataTables scrollX handle horizontal overflow */
.dataTables_wrapper    { max-width: 100%; }

/* Length / filter / info labels */
.dataTables_length,
.dataTables_filter { font-size: 0.83rem; display: inline-block; }

.dataTables_length label,
.dataTables_filter label { display: flex; align-items: center; gap: 6px; }

.dataTables_length select,
.dataTables_filter input {
  padding: 3px 6px;
  font-size: 0.83rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Buttons */
.dt-buttons { display: inline-flex; gap: 4px; vertical-align: middle; }
.dt-button  { font-size: 0.83rem !important; padding: 3px 10px !important; cursor: pointer; }

/* Info + pagination */
.dataTables_info     { font-size: 0.82rem; color: #555; padding-top: 4px; }
.dataTables_paginate { font-size: 0.82rem; }

/* photo viewer */
.photo-viewer { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 4px; }

.photo-panel {
  border: none;
  border-radius: 6px;
  overflow: hidden;
  background: #2c52a3;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.photo-panel-title {
  background: #232a69;
  padding: 7px 12px;
  font-size: 0.80rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.03em;
}
.photo-panel img      { width: 100%; height: auto; object-fit: contain; display: block; cursor: zoom-in; }
.photo-panel .no-photo {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.70); font-size: 0.82rem; padding: 20px;
}
/* ==========================================================
   Export Registrations page
========================================================== */
.export-page           { max-width: 740px; margin: 24px auto; padding: 0 16px; }
.export-page h2        { margin-bottom: 6px; color: #232a69; }
.export-intro          { font-size: 0.85rem; color: #555; margin-bottom: 18px; line-height: 1.5; }
.export-intro strong   { color: #232a69; }

.filter-grid           { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; margin-bottom: 20px; }
.filter-grid .full-width { grid-column: 1 / -1; }

.filter-label          { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.filter-label > span   { font-weight: 600; color: #232a69; }

/* multi-select */
.filter-label select[multiple] {
  border: 1px solid #bbb;
  border-radius: 6px;
  font-size: 0.84rem;
  padding: 4px;
  background: #fff;
  overflow-y: auto;
  transition: border-color 0.15s;
}
.filter-label select[multiple]:focus         { border-color: #3b4281; outline: none; }
.filter-label select[multiple] option        { padding: 4px 6px; }
.filter-label select[multiple] option:checked { background: #232a69; color: #fff; }

/* date inputs */
.filter-label input[type="date"] {
  border: 1px solid #bbb; border-radius: 6px;
  padding: 5px 8px; font-size: 0.84rem; font-family: inherit;
}
.filter-label input[type="date"]:focus { border-color: #3b4281; outline: none; }

.multi-hint { font-size: 0.73rem; color: #888; font-style: italic; }

/* checkboxes */
.checkbox-group { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 4px; }
.checkbox-row   { display: flex; gap: 6px; align-items: center; font-size: 0.85rem; cursor: pointer; }
.checkbox-row input { cursor: pointer; }

/* export action buttons */
.export-actions { display: flex; gap: 10px; margin-top: 8px; align-items: center; }

.btn-export-submit {
  background: #232a69; color: #fff; border: none;
  border-radius: 20px; padding: 7px 22px;
  font-size: 0.86rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.btn-export-submit:hover { background: #1a2050; }

.btn-clear {
  background: none; color: #666; border: 1px solid #ccc;
  border-radius: 20px; padding: 6px 16px;
  font-size: 0.84rem; cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-clear:hover { border-color: #999; color: #333; }

.btn-back-link {
  background: #6167a0; color: #fff; text-decoration: none;
  border-radius: 20px; padding: 7px 20px;
  font-size: 0.86rem; font-weight: 600;
  display: inline-block; transition: background 0.15s;
}
.btn-back-link:hover { background: #4e5288; }

.result-note { font-size: 0.79rem; color: #777; margin-top: 10px; }

/* photo panel loading state */
.photo-panel .no-photo.loading {
  color: rgba(255,255,255,0.5);
  font-style: italic;
}
