* {
  box-sizing: border-box;
}

html {
  font-size: 18px; /* Define 1rem as 18px */
  width: 100%;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  width: 100%;
  -webkit-overflow-scrolling: touch; /* For smooth scrolling on iOS */
}

.app-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column; /* Arrange children vertically */
}

.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  position: relative;
  padding: 10px 0;
}

.sticky-wrapper {
  position: sticky;
  top: 5px;
  z-index: 1000;
  background-color: white; /* Ensure content doesn't show through the sticky area */
}

.logo {
  height: 40px;
  width: auto;
  font-size: 2em;
}

.main-header {
  margin: 0;
  color: darkred;
  font-size: 1.5rem;
}

.about-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: #6c757d;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.about-btn:hover {
  color: #333;
}

.ready-message {
  text-align: center;
}

.content {
  flex-grow: 1; /* Take remaining space */
  padding: 0.5em 0;
}

.main-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

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

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

#map-container {
  height: 32vh;
  height: 32svh; /* More stable on mobile browsers */
  flex-shrink: 0; /* Prevent shrinking in flex layouts */
  width: 100%;
  margin: 0;
  margin-bottom: 0.5rem; /* Add some space below the map */
  border-radius: 4px;
  overflow: hidden;
}

#map-form {
  height: 200px;
  width: 100%;
  margin: 0 auto;
  margin-bottom: 1rem; /* Add some space below the map */
}

.coordinate-input {
  flex-grow: 1;
  margin-right: 10px;
}
.add-mark-btn {
  background-color: #4CAF50;
  border: none;
  color: white;
  padding: 12px 24px;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 4px;
}

.add-mark-btn:hover {
  background-color: #45a049;
}

.upload-all-btn {
  background-color: #6c757d;
  border: none;
  color: white;
  padding: 12px 15px;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 4px;
}

.upload-all-btn:hover {
  background-color: #5a6268;
}

.form-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.form-container {
  background: white;
  border-radius: 8px;
  box-sizing: border-box;
  min-width: 400px;
  max-width: 500px;
  width: 100%;
  display: flex;
  flex-direction: column;
  height: 95vh;
  max-height: 95vh;
  padding-bottom: 2rem;
}

.form-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5em;
  padding-top: 2em;
  margin-bottom: 0.25rem;
  flex-shrink: 0;
}

.form-header-actions h3 {
  margin: 0;
}

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

.form-header-buttons .button {
  padding: 8px 48px;
}

.button {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
}

.button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

.button:disabled:hover {
  background-color: #ccc;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.button.primary {
  background-color: #4CAF50;
  color: white;
}

.button.primary:hover {
  background-color: #45a049;
}

.button {
  background-color: #f44336;
  color: white;
}

.button:hover {
  background-color: #cc0000;
}

.form-group {
  padding: 0.25em;
}

.tag-section-wrapper {
  border: 1px solid #ccc;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border-radius: 8px;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.form-group.checkbox label {
  display: inline-block;
  margin-bottom: 0;
  margin-right: 0.5rem;
}

.form-group.checkbox input {
  display: inline-block;
  vertical-align: middle;
  width: auto;
}

.form-group input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.875rem;
  box-sizing: border-box;
}

.form-group input.checkbox {
  width: auto;
}

.form-group textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.875rem;
  box-sizing: border-box;
  resize: vertical; /* Allow vertical resizing */
}

.form-content-wrapper {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.5em;
  padding-bottom: 50vh;
}

.mark-item {
  position: relative;
  border: 1px solid #ddd;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  background-color: #f9f9f9;
  display: flex;
  justify-content: space-between;
  scroll-margin-top: 32vh;
}

.mark-notification-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  border-radius: 20px;
  z-index: 10;
  pointer-events: none;
  text-align: center;
  padding: 8px 16px;
  box-sizing: border-box;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  font-size: 0.9rem;
  white-space: nowrap;
}

.mark-notification-toast.success {
  background-color: rgba(40, 167, 69, 0.9);
}

.mark-notification-toast.error {
  background-color: rgba(220, 53, 69, 0.9);
}

.mark-item h4 {
  margin: 0 0 0.5rem 0;
  color: darkred;
}

.mark-item p {
  margin: 0;
  color: #666;
}

.tags-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  min-height: 24px;
}

.tag-tag {
  display: inline-flex;
  align-items: center;
  background-color: #e7f3ff;
  color: #0066cc;
  padding: 4px 8px;
  border-radius: 16px;
  font-size: 0.875rem;
  border: 1px solid #b3d9ff;
}

.tag-list .tag-tag:hover {
  cursor: pointer; /* Indicate clickable */
}

.remove-tag {
  background: none;
  border: none;
  color: #0066cc;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  margin-left: 4px;
  padding: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.remove-tag:hover {
  background-color: #ff4444;
  color: white;
}

.mark-tags strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #333;
}

.expiration-date {
  margin: 0.25rem 0 0 0;
}

.mark-extra-info {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #eee;
  font-size: 0.85rem;
  color: #888;
  display: flex;
  align-items: flex-start;
}

.mark-extra-fields {
  flex-grow: 1;
}

.mark-extra-info p {
  margin: 0.25rem 0 0 0;
  color: #888;
}

.mark-extra-info strong {
  color: #666;
}

.mark-content {
}

.mark-header {
  margin-bottom: 0.5rem;
}

.mark-header h4 {
  margin: 0;
}

.mark-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.delete-mark-btn, .edit-mark-btn, .go-mark-btn {
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.845rem;
  cursor: pointer;
}

.delete-mark-btn {
  background-color: #ff4444;
}

.delete-mark-btn:hover {
  background-color: #cc0000;
}

.edit-mark-btn {
  background-color: #007bff;
}

.edit-mark-btn:hover {
  background-color: #0056b3;
}

.go-mark-btn {
  display: inline-block;
  background-color: #4CAF50;
  text-decoration: none;
}

.go-mark-btn:hover {
  background-color: #0056b3;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1001;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 2s linear infinite;
}

.mini-spinner {
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3498db;
  border-radius: 50%;
  width: 12px;
  height: 12px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-indicator {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 1001; /* Above map and potentially map-controls */
  background: white;
  padding: 4px 10px;
  border-radius: 15px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: bold;
  color: #3498db;
  border: 1px solid #3498db;
}

.location-btn, .reset-location-btn {
  background-color: #6c757d;
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 4px;
  margin-left: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 2.5rem;
  vertical-align: middle;
}

.location-btn {
  font-size: 2rem;
}

.reset-location-btn {
  font-size: 1.25rem;
}

.location-btn:hover, .reset-location-btn:hover {
  background-color: #5a6268;
}

.reverse-lookup-btn {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  width: 100%;
  background-color: #007bff;
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  padding: 8px 12px;
}

.reverse-lookup-btn:hover {
  background-color: #0056b3;
}

.coordinate-input-group {
  display: flex;
  align-items: center;
}

.error-message {
  color: red;
  margin-bottom: 10px;
  font-size: 0.9em;
}

.error-message ul {
  margin: 0;
  padding-left: 20px;
}

.tag-list {
  padding: 0;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.tag-list-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #eee;
  padding-top: 0.25rem;
}

.show-expired-toggle {
  background-color: #f8f9fa;
  color: #6c757d;
  border-color: #dee2e6;
}

.show-expired-toggle.tag-tag-active {
  background-color: #6c757d;
  color: white;
  border-color: #6c757d;
}

.tag-tag-active {
  background-color: #0066cc;
  color: white;
  border-color: #0066cc;
}

.clear-filter-btn {
  background: none;
  color: #dc3545;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: none;
}

.clear-filter-btn:hover {
  color: #c82333;
  text-decoration: underline;
}

.mark-item.expired-mark {
  opacity: 0.7;
  border-style: dashed;
}

.mark-item.incomplete-mark {
  background-color: #fff9e6;
  border-color: #ffeeba;
}

.mark-item.selected-mark {
  background-color: #e0e0e0;
  border: 2px solid #007bff;
  opacity: 1; /* Ensure full opacity when selected even if expired */
}

.expired-label {
  color: #dc3545;
  font-size: 0.75rem;
  font-weight: bold;
}

.crosshairs {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid #999;
  border-radius: 50%;
  z-index: 1000;
  pointer-events: none; /* Allow map interaction through the crosshairs */
}

.crosshairs::before,
.crosshairs::after {
  content: '';
  position: absolute;
  background-color: #999;
}

.crosshairs::before {
  width: 2px;
  height: 100%;
  left: 50%;
  transform: translateX(-50%);
}

.crosshairs::after {
  width: 100%;
  height: 2px;
  top: 50%;
  transform: translateY(-50%);
}

.tag-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* Add some space between the input and button */
}

.tag-input-group input {
  flex-grow: 1; /* Allow the input to take up available space */
  width: auto; /* Override the 100% width from .form-group input */
}

.add-tag-btn {
  padding: 8px 12px; /* Slightly increased padding */
  font-size: 0.875rem;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.add-tag-btn:hover {
  background-color: #0056b3;
}

.toggle-address-btn {
  background: none;
  border: 1px solid #007bff;
  color: #007bff;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  width: 100%;
  text-align: left;
  margin-bottom: 0.5rem;
}

.toggle-address-btn:hover {
  background-color: #f0f7ff;
}

.lookup-btn {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  width: 100%;
  background-color: #007bff;
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  padding: 8px 12px;
}

.lookup-btn:hover {
  background-color: #0056b3;
}

.address-fields-wrapper {
  border-left: 2px solid #007bff;
  padding-left: 1rem;
  margin-bottom: 1rem;
  background-color: #fcfcfc;
}

.coordinate-text {
  font-size: 0.8rem;
}

.settings-btn, .export-btn {
  background-color: #6c757d;
  border: none;
  color: white;
  padding: 12px 15px;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 4px;
}

.settings-btn:hover, .export-btn:hover {
  background-color: #5a6268;
}

.bottom-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  border-top: 1px solid #eee;
}

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

.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.settings-dialog {
  background: white;
  border-radius: 8px;
  box-sizing: border-box;
  min-width: 300px;
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #eee;
}

.settings-header h3 {
  margin: 0;
}

.settings-content {
  padding: 1rem;
  flex-grow: 1;
  overflow-y: auto;
  padding-bottom: 50vh;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0;
  border-top: 1px solid #eee;
}

.about-dialog {
  background: white;
  border-radius: 8px;
  box-sizing: border-box;
  min-width: 300px;
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.about-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #eee;
}

.about-header h3 {
  margin: 0;
}

.about-content {
  padding: 1rem;
  color: darkred;
  flex-grow: 1;
  overflow-y: auto;
  padding-bottom: 50vh;
}

.register-toggle {
  margin: 1rem 0;
  text-align: center;
  font-size: 0.875rem;
}

.register-toggle a {
  color: #007bff;
  text-decoration: none;
}

.register-toggle a:hover {
  text-decoration: underline;
}

/* Notification Toast */
.notification-toast {
  position: fixed;
  top: 80px; /* Below header */
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 4px;
  color: white;
  font-weight: bold;
  z-index: 3000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  animation: slideInDown 0.3s ease-out;
}

.notification-toast.success {
  background-color: #28a745;
}

.notification-toast.info {
  background-color: #17a2b8;
}

.notification-toast.error {
  background-color: #dc3545;
}

@keyframes slideInDown {
  from {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.map-wrapper {
  position: relative;
}

.build-date {
  padding: 1rem;
  font-size: 0.75rem;
  color: #888;
  text-align: center;
  border-top: 1px solid #eee;
}

.export-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 2px solid #eee;
}

.export-section h4 {
  margin: 0 0 1rem 0;
  color: #333;
}

.export-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.export-link-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.export-link-item label {
  font-size: 0.875rem;
  font-weight: bold;
  color: #666;
}

.export-url-container {
  display: flex;
  gap: 0.5rem;
}

.export-url-input {
  flex-grow: 1;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.8rem;
  background-color: #f8f9fa;
  font-family: monospace;
}

.copy-btn {
  padding: 6px 12px;
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.copy-btn:hover {
  background-color: #5a6268;
}

.download-link {
  display: inline-block;
  padding: 8px 16px;
  background-color: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.875rem;
  text-align: center;
}

.download-link:hover {
  background-color: #0056b3;
}


/* Voting Styles */
.mark-voting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-right: 12px;
  min-width: 32px;
}

.vote-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #ccc;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.vote-btn:hover {
  color: #999;
}

.vote-btn.active.upvote {
  color: #28a745;
}

.vote-btn.active.downvote {
  color: #dc3545;
}

.vote-score {
  font-weight: bold;
  font-size: 0.9rem;
  color: #666;
}

.vote-score.positive {
  color: #28a745;
}

.vote-score.negative {
  color: #dc3545;
}

.search-radius-circle {
  transition: opacity 0.5s ease-out, fill-opacity 0.5s ease-out;
  pointer-events: none;
}
