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

/* 1. Root height chain */
html,
body {
    height: 100%;
    margin: 0;
}

/* 2. Page structure */
body {
    display: flex;
    flex-direction: column;
}

body {
  font-family: system-ui, sans-serif;
  background-color: #f9f9f9;
  color: #333;
  line-height: 1.6;
  padding: 1rem;
}


/* Header and navigation */
header,
footer {
    flex: 0 0 auto; /* fixed height */
}


header {
  background-color: #005f73;
  padding: 1rem 0.5rem;
  margin-bottom: 1rem;
  border-radius: 6px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

nav a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  transition: opacity 0.2s ease-in-out;
}

nav a:hover {
  opacity: 0.8;
}

nav a.active {
  border-bottom: 2px solid #fff;
  padding-bottom: 2px;
}

/* Put items in the centre */
.centre {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: auto;
}

.centered-form {
  padding-top: 1rem;
  text-align: center;
}

/* Main content */
/* 3. Main must define available vertical space */
main {
    flex: 1 1 auto;
    min-height: 0; /* CRITICAL */
    display: flex;
    flex-direction: column;
}

main {
  padding: 1rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  min-height: 0; /* for flexbox layouts */
}

/* Login modal errors */
#modalLoginError {
  display: none;
  margin-bottom: 1rem;
}

.form-note {
  margin-top: 1rem;
}

/* Map placeholder */
.no-gps-placeholder {
  color: white;
  text-align: center;
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropbtn:hover {
  text-decoration: underline;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #444;
  min-width: 160px;
  right: 0;
  z-index: 9999;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.dropdown-content a {
  color: white;
  padding: 10px 12px;
  text-decoration: none;
  display: block;
}

.dropdown-content a:hover {
  background-color: #555;
}

/* Show when toggled */
.dropdown.open .dropdown-content {
  display: block;
}

/* Journey header */
/* 4. Journey header sits above editor */
.journey-header {
    flex: 0 0 auto;
}

.journey-header {
  padding: 10px 16px;
  border-bottom: 1px solid #ccc;
  background: #fafafa;
}

.journey-scroll {
  flex: 1;
  overflow-y: auto;
}

.journey-title {
  margin: 0 0 6px;
}

.journey-description {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3rem;
  max-height: 3.9rem; /* roughly 3 lines */
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.journey-description.expanded {
  max-height: 500px; /* enough space to animate fully */
}

.read-more-btn {
  margin-top: 4px;
  padding: 2px 4px;
  border: none;
  background: none;
  color: #0066cc;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9rem;
  display: none; /* shown only if needed */
}

/* Modal dialog */
/* Title row */
.journey-title-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.journey-actions {
  display: flex;
  flex: 1;
  justify-content: space-between;
  align-items: center;
}

.main-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.danger-actions {
  display: flex;
  align-items: center;
}

/* Add button */
.add-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.add-btn:hover {
  background: #0066d3;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 11000;
}

.modal-overlay.active {
  display: flex;
}

/* Modal window */
.modal-box {
  background: white;
  width: 420px;
  padding: 20px;
  border-radius: 10px;
  animation: fadeIn 0.3s;
}

.modal-section {
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.cancel-btn {
  background: #ccc;
  border: none;
  padding: 6px 10px;
}
.save-btn {
  background: #28a745;
  border: none;
  padding: 6px 10px;
  color: white;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

/* Modal dialog to create new journey */
.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 11000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-content {
  position: relative;
  background: #fff;
  max-width: 500px;

  /* NEW */
  max-height: calc(100vh - 40px);
  overflow-y: auto;

  margin: 20px auto;
  padding: 24px;
  border-radius: 8px;
}


.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.modal[hidden] {
  display: none;
}

/* Journey edit page layout */

/* 5. Two-column editor fills remaining space */
.edit-container {
    flex: 1 1 auto;
    min-height: 0;          /* CRITICAL */
    display: flex;
    overflow-y: auto;       /* scrollbar if viewport too small */
}

/* 6. Left column */
.forms {
    flex: 1 1 auto;            /* take remaining space but allow shrinking */
    min-width: 240px;      /* CRITICAL: allow shrinking */
    padding-right: 16px;
}

.forms h3 {
  margin-top: 1rem;
}

.grant-access-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;       /* allow wrapping on smaller screens */
}

.grant-access-form label {
  white-space: nowrap;   /* keep "Find user:" together */
}

.grant-access-form input {
  flex: 1;               /* input expands on wide screens */
  min-width: 200px;      /* prevents collapsing too much */
}

.grant-access-form select {
  flex: 1;               /* input expands on wide screens */
  min-width: 100px;      /* prevents collapsing too much */
}

.grant-access-form button {
  flex: 1;               /* input expands on wide screens */
  min-width: 100px;      /* prevents collapsing too much */
}

.autocomplete-suggestions {
  position: absolute;
  background: #fff;
  border: none;
  border-radius: 4px;
  margin-top: 2px;
  max-height: 200px;
  overflow-y: auto;
  width: 250px;
  z-index: 1000;
}

.autocomplete-suggestions div {
  padding: 8px 10px;
  cursor: pointer;
}

.autocomplete-suggestions div:hover {
  background-color: #f0f0f0;
}

.access-item {
  display: flex;
  align-items: center;
  gap: 10px;       /* space between elements */
  margin-bottom: 8px;
}

.access-username {
  flex: 1;         /* takes remaining space so forms align right */
  font-weight: bold;
}

.access-usertag {
  flex: 1;         /* takes remaining space so forms align right */
  font-size: smaller;
  color: darkgreen;
}

.access-form {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}

select[name="role"] {
  min-width: 14ch; /* "Contributor" = 11 chars; add padding */
}

/* List of GPX tracks */
.track-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.track-item {
  display: flex;
  align-items: center;
  justify-content: space-between; /* pushes name left, checkbox right */
  padding: 6px 0;
  border-bottom: 1px solid #ddd;
}

.photo-track-item {
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #ddd;
  justify-content: flex-start; /* keep checkbox next to name */
}

.photo-track-item .photo-track-checkbox {
  margin-right: 8px;
  width: 16px;
  height: 16px;
}

/* Override for photo track checkbox to keep checkbox and label on same line */
.photo-track-item label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  width: 100%;
}

.track-item:hover {
  color: #8b0000; /* dark red on hover */
}

.track-name {
  flex: 1;
}


/* 7. Right column: map + media */
.map-and-media {
    flex: 6 1 auto;           /* take remaining space but allow shrinking */
    min-height: 0;          /* CRITICAL */
    min-width: 320px;      /* prevent map/media from collapsing too much */
    display: flex;
    flex-direction: column;
}


/* 8. Map grows, thumbnails keep intrinsic height */
#map-container {
    flex: 1 1 auto;
    min-height: 300px;
}

#map {
    height: 100%;
    width: 100%;
}

/* Loading overlay */
.map-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35); /* darken map */
    z-index: 500; /* above Leaflet tiles, below modals */
    display: flex;
    align-items: center;
    align-content: center;
    justify-content: center;
    pointer-events: none; /* allow map to exist underneath */
    transition: opacity 0.2s ease;
    flex-direction: column;
}

.map-loading.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

/* Spinner */
.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* Thumbnail strip container */
.thumb-strip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  min-width: 0;
}

/* Prev/Next buttons */
.thumb-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 20px;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
  z-index: 10;
  transition: background 0.2s ease;
}
.thumb-btn:hover { background: rgba(0, 0, 0, 0.8); }
.thumb-btn:disabled { opacity: 0.4; cursor: default; }

/* Thumbnails scroller */
.media-thumbnails {
  display: flex;
  flex-direction: row;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 10px;
  flex: 1 1 auto;   /* fill remaining space between buttons */
  min-width: 0;     /* CRITICAL: enable horizontal overflow */
  cursor: grab;
}
.media-thumbnails.dragging { cursor: grabbing; }

/* Individual thumbnails */
.media-thumbnails .thumbnail-image {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  scroll-snap-align: start;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.media-thumbnails .thumbnail-image:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(0,0,0,0.4);
}
/* small hover effect on thumbnail */
.thumbnail-image:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

/* Hide scrollbar */
.media-thumbnails::-webkit-scrollbar { height: 8px; }
.media-thumbnails::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
}

/* ---------- Fullscreen overlay ---------- */
.image-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);

  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;

  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity .2s ease-in-out;
}

.image-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay-image-container {
  position: relative;

  flex: 1 1 auto;           /* take remaining space */
  min-width: 0;             /* IMPORTANT for flex shrink */
  min-height: 0;
  height: 100%;             /* fill parent height */

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;         /* prevent overflow artifacts */
}

.overlay-image {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  border-radius: 8px;
  transition: opacity .2s ease-in-out;
}

.overlay-close {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 36px;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.overlay-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* Overlay navigation buttons (prev/next) */
.overlay-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 36px;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.overlay-nav:hover {
  background: rgba(0, 0, 0, 0.8);
}

.overlay-prev {
  left: 20px;
}

.overlay-next {
  right: 20px;
}

.mini-map {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #444;
  margin-bottom: 10px;
}

.hidden { display: none !important; }

.overlay-meta {
  width: 300px;
  flex-shrink: 0;
  align-self: stretch;      /* fill parent height */
  padding: 20px;
  overflow-y: auto;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-left: 1px solid #333;
}


/* Footer */
footer {
   text-align: center;
   margin-top: 0.2rem;
   font-size: 0.9rem;
   color: #777;
}

/* Uploading overlay */
.loading-overlay {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background: rgba(0, 0, 0, 0.6);
   z-index: 11001; /* above modals */
   display: flex;
   align-items: center;
   justify-content: center;
   align-content: center;
   justify-content: center;
   pointer-events: none; /* allow map to exist underneath */
   transition: opacity 0.2s ease;
   flex-direction: column;
}

.loading-content {
   text-align: center;
   color: white;
}

.loading-content .spinner {
   margin-bottom: 1rem;
}

/* Buttons */
button,
input[type="submit"] {
  background-color: #0a9396;
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

button:hover,
input[type="submit"]:hover {
  background-color: #007f86;
}

/* Forms */
input, textarea, select {
  width: 100%;
  padding: 0.6rem;
  margin: 0.5rem 0 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

label {
  display: block;
  margin-top: 1rem;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 600px) {
  nav {
    flex-direction: column;
    align-items: center;
  }

  main {
    padding: 0.8rem;
  }
}

/* Flash messages */
.flash {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.8rem 1.2rem;
  border-radius: 4px;
  text-align: center;
  font-weight: bold;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 250px;
  max-width: 90%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.flash-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flash-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.flash-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: inherit;
  cursor: pointer;
  padding: 0;
  margin-left: 1rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flash-close:hover {
  opacity: 0.7;
}

/* Media */
.media-thumbnails img,
.media-thumbnails video {
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.media-thumbnails img:hover,
.media-thumbnails video:hover {
  transform: scale(1.05);
}

/* Journey explore page */
.explore-header {
  margin: 20px 0 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.page-title {
  margin: 0;
  font-size: 2.2rem;
  text-align: center;
}

.filter-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8f9fa;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  width: fit-content;
  font-size: 0.95rem;
}

.clear-filter {
  color: #dc3545;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding-left: 8px;
  border-left: 1px solid #dee2e6;
}

.clear-filter:hover {
  text-decoration: underline;
}

.journey-grid {
  display: grid;
  grid-template-columns: 1fr; /* full width rows */
  gap: 18px;
  padding: 20px;
}

.journey-card {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.journey-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

.journey-card-content {
  display: flex;
  flex-direction: column;
}

.journey-card-main-link {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  color: inherit;
  text-decoration: none;
  padding: 12px;
  align-items: start;
}

.journey-card-main-link:hover {
  color: inherit;
}

.journey-card .tags-list {
  padding: 0 12px 12px 12px;
  z-index: 2;
  position: relative;
}

.cover {
  width: 100%;
  aspect-ratio: 256 / 160;
  overflow: hidden;
  background: #eee;
  border-radius: 8px;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.journey-text {
  min-width: 0; /* prevents overflow */
}

.title {
  margin: 0 0 6px 0;
  font-size: 1.3rem;
}

.desc {
  margin: 0;
  color: #444;
  font-size: .95rem;
}

.meta {
  margin-top: 8px;
  color: #777;
  font-size: .8rem;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: #555;
  color: greenyellow;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.tag:hover {
  background: #007bff !important;
  color: #fff !important;
}

.guest-nudge-banner {
  background: #fff3cd;
  color: #856404;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid #ffeeba;
  margin: 15px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
}

.guest-nudge-banner p {
  margin: 0;
}

.btn-link {
  background: none;
  border: none;
  color: #0056b3;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: bold;
}

.btn-link:hover {
  color: #003d80;
}

.readonly-input {
  background-color: #e9ecef;
  cursor: not-allowed;
}

/* For the feed page */
.feed {
  margin-left: 20px;
}

/* For the map popup on the journey edit page */
.map-popup-image {
  width: 200px;
  height: 200px;
  object-fit: contain;
  border-radius: 4px;
}

/* User account page */
.avatar {
  background-color: #005f73;
  padding: 1rem;
  border-radius: 4px;
  color: white;
}

.account-form {
  max-width: 600px;
  overflow-x: auto;
  overflow-y: auto;
}

/* Form field wrapper */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

/* Inputs inside form fields */
.form-field input {
  font: inherit;
  padding: 0.55rem 0.6rem;
  border: 1px solid #c9c9c9;
  border-radius: 4px;
  background: #fff;
}

.form-field input:focus {
  outline: none;
  border-color: #005fcc;
  box-shadow: 0 0 0 2px rgba(0, 95, 204, 0.15);
}

/* Error message */
.form-error {
  margin: 0 0 1rem 0;
  padding: 0.6rem 0.75rem;
  border-left: 4px solid #c62828;
  background: #fdecea;
  color: #8a1f1f;
  font-size: 0.95rem;
}

/* Primary action button */
button.primary {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.6rem 1.25rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background-color: #005fcc;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

button.primary:hover {
  background-color: #0047a3;
}

button.primary:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.3);
}

button.primary:disabled {
  background-color: #9bb7e0;
  cursor: not-allowed;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.btn-danger:hover {
  background-color: #c82333;
}

.form-hint {
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #666;
  background-color: #f5f7f9;
}

.form-note {
  margin-top: 1rem;
  padding-top: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #555;
  border-top: 1px solid #e0e0e0;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.account-form-buttons {
  display: flex;
  margin-top: 1rem;
  align-items: center;
}

/* Help */
.note {
  background: #f5f7f9;
  border-left: 4px solid #4a90e2;
  padding: 1rem;
  margin: 1.5rem 0;
}
.help-body {
  width: 100%;
  max-width: 800px;
}

.help-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.help-body h1, h2, h3 {
  line-height: 1.3;
}

.help-body h2 {
  margin-top: 3rem;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.25rem;
}

.help-body h3 {
  margin-top: 1.75rem;
}
.help-body ul, ol {
  margin-left: 1.5rem;
}
.help-body li {
  margin: 0.5rem 0;
}

/* User directory and profile pages */
.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
}

.user-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.user-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.user-card a {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.user-avatar {
  width: 100%;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #005f73;
  font-size: 2rem;
  font-weight: bold;
}

.avatar-placeholder-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #005f73;
  font-size: 3rem;
  font-weight: bold;
}

.user-info {
  padding: 1rem;
}

.user-name {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
  color: #333;
}

.user-tag {
  margin: 0 0 0.5rem 0;
  color: #666;
  font-size: 0.9rem;
}

.user-text {
  margin: 0;
  color: #555;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Profile page */
.profile-section {
  padding: 1rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

.profile-identity {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #ddd;
}

.profile-avatar {
  flex-shrink: 0;
}

.profile-avatar img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-details {
  flex: 1;
}

.profile-details h2 {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
}

.profile-tag {
  margin: 0 0 0.5rem 0;
  color: #666;
}

.profile-text {
  margin: 0;
  color: #555;
  line-height: 1.5;
}

.profile-journeys h3 {
  margin: 0 0 0 0;
  font-size: 1.25rem;
}

.profile-journeys {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}

.profile-journeys .empty-state {
  color: #666;
  font-style: italic;
}

.gdrive-section {
  border-top: 1px solid #eee;
  padding-top: 15px;
  margin-top: 15px;
}

.snap-section {
  border-top: 1px solid #eee;
  padding-top: 15px;
  margin-top: 15px;
}

.snap-section .hint {
  color: #666;
  font-size: 0.85rem;
  margin-top: 5px;
}

.snap-error {
  color: #dc3545;
  font-size: 0.85rem;
  margin-top: 5px;
  min-height: 1.2em;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.gdrive-section h3 {
  margin: 0 0 5px 0;
  font-size: 1rem;
}

.gdrive-description {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.gdrive-status {
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.gdrive-status.connected {
  color: #28a745;
}

.gdrive-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.gdrive-input-group input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.gdrive-error {
  color: #dc3545;
  font-size: 0.9rem;
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.gdrive-result {
  color: #28a745;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

/* Comments section */
.journey-comments-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.comments-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #005f73;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-icon {
  font-size: 0.8rem;
}

.comments-content {
  margin-top: 1rem;
}

.reactions-section {
  margin-bottom: 1rem;
}

.reaction-buttons {
  display: flex;
  gap: 0.5rem;
}

.reaction-btn {
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.reaction-btn:hover {
  background: #e0e0e0;
}

.reaction-btn.active {
  background: #e8f4e8;
  border-color: #28a745;
}

.reaction-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.comments-section h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.comment-form {
  margin-bottom: 1rem;
}

.comment-form textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
  resize: vertical;
}

.comment-form .btn {
  margin-top: 0.5rem;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comment-item {
  padding: 0.75rem;
  background: #f9f9f9;
  border-radius: 4px;
}

.comment-item.reply {
  margin-left: 1rem;
  background: #f5f5f5;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Location Labels Styles */
.location-labels-section {
  margin: 1rem 0;
}

.labels-display {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.location-label-pill {
  background-color: #e0f2f1;
  color: #00796b;
  border-radius: 12px;
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.location-label-pill.pill-sm {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
}

.card-location-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.more-labels {
  font-size: 0.7rem;
  color: #666;
}

.edit-labels-link {
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.labels-editor {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 4px;
  border: 1px solid #e9ecef;
}

.labels-editor .form-group label {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  display: block;
}

.label-editor-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.comment-author {
  font-weight: 600;
  color: #fff;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.85rem;
}

.avatar-gold { background-color: #FFD700; }
.avatar-pink { background-color: #FF69B4; }
.avatar-blue { background-color: #87CEFA; }
.avatar-green { background-color: #90EE90; }
.avatar-orange { background-color: #FFA07A; }
.avatar-purple { background-color: #9370DB; }
.avatar-default { background-color: #ccc; }

.comment-date {
  font-size: 0.8rem;
  color: #888;
}

.comment-text {
  margin-bottom: 0.5rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #333;
}

.comment-reactions {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.comment-reactions .reaction-btn.small {
  font-size: 0.8rem;
  padding: 0.15rem 0.3rem;
}

.comment-actions {
  display: flex;
  gap: 0.5rem;
}

.comment-actions button {
  background: none;
  border: none;
  color: #666;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}

.comment-actions button:hover {
  color: #005f73;
  text-decoration: underline;
}

.replies-container {
  margin-top: 0.5rem;
}

.show-replies-btn {
  background: none;
  border: none;
  color: #005f73;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}

.show-replies-btn:hover {
  text-decoration: underline;
}

.reply-form, .edit-form {
  margin-top: 0.5rem;
}

.reply-form textarea, .edit-form textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
  resize: vertical;
}

.reply-form-actions, .edit-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.reply-form-actions button, .edit-form-actions button {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

.no-comments {
  color: #888;
  font-style: italic;
}

/* Contributions page */
.contributions-section {
  width: 100%;
  max-width: 800px;
  margin: 2rem 0;
}

.contributions-section h2 {
  color: #005f73;
  border-bottom: 2px solid #005f73;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.contributions-list {
  list-style: none;
  padding: 0;
}

.contribution-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  background: #fafafa;
}

.contribution-item:hover {
  background: #f0f0f0;
}

.contribution-type {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  font-size: 0.85rem;
  color: #666;
}

.contribution-type .icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.contribution-details {
  flex: 1;
  min-width: 0;
}

.contribution-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.contribution-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
}

.contribution-meta {
  font-size: 0.9rem;
  color: #555;
}

.contribution-meta a {
  color: #005f73;
  text-decoration: none;
}

.contribution-meta a:hover {
  text-decoration: underline;
}

.contribution-meta span {
  color: #999;
  font-style: italic;
}

.delete-btn {
  padding: 0.5rem 1rem;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}

.delete-btn:hover {
  background: #c82333;
}

/* Highlighted cluster bubble — mirrors the red used for individual markers */
.marker-cluster.marker-cluster--highlighted div {
  background-color: rgba(220, 50, 50, 0.8);
}
.marker-cluster.marker-cluster--highlighted {
  background-color: rgba(220, 50, 50, 0.4);
}

/* Account page - Danger Zone */
.danger-zone {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 2px solid #dc3545;
  border-radius: 8px;
  background-color: #fff5f5;
  max-width: 600px;
  width: 100%;
}

.danger-zone h2 {
  color: #dc3545;
  margin-bottom: 0.5rem;
  font-size: 1.3rem;
}

.danger-description {
  color: #666;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.danger-button {
  background-color: #dc3545;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
}

.danger-button:hover {
  background-color: #c82333;
}

/* Delete confirmation modal */
#deleteModal .modal-content {
  max-width: 500px;
  width: 90%;
}

#deleteModal .warning-list {
  margin: 1rem 0;
  line-height: 1.6;
}

#deleteModal ul {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

#deleteModal li {
  margin-bottom: 0.5rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 1rem;
}

.secondary-button {
  background-color: #6c757d;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

