/* Reset and global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  /* Remove tap highlight on mobile */
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
}

body {
  font-weight: 400;
  background-color: #f5f5f5;
  color: #333;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  /* Improve font rendering on mobile */
}

html {
  direction: ltr !important;
}

h1,
h2,
tr,
td,
body,
button {
  font-family: "Funnel Display", sans-serif;
}

.no-break {
  white-space: nowrap;
}

/* Fixed blurred background - only shown during analysis */
.background-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(12px);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s ease;
  display: none;
  will-change: opacity;
  /* Optimize for mobile performance */
}

.background-overlay.active {
  opacity: 1;
  display: block;
}

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.app-header.visible {
  display: flex !important;
  flex-direction: row;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  height: 28px;
}

.app-title {
  font-family: "Funnel Display", sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #004b35;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right,
a {
  text-decoration: none;
}

.header-h3 {
  font-weight: 600;
  font-size: 14px;
  color: #004b35;
  font-family: "Funnel Display", sans-serif;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #004b35;
}

.icon-btn:hover {
  opacity: 0.7;
}

.icon-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.map-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.map-loader.hidden {
  display: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top-color: #027753;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loadingStatusText {
  color: #027753;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.5px;
}

.map {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  margin-top: 40px;
}

.map-modal {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: auto !important;
  display: none;
  background: rgba(0, 0, 0, 0.2);
  justify-content: center !important;
  align-items: flex-end !important;
  z-index: 9999;
  top: 0;
}

.map-modal.active {
  display: flex;
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 10px;
  padding: 20px;
  max-width: 400px;
  margin: auto;
  text-align: center;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.modal-content img {
  width: 50%;
  border-radius: 10px;
  margin-bottom: 12px;
  object-fit: cover;
  max-height: 120px;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.modal-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #000;
  margin-bottom: 8px;
}

.modal-content p {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 12px;
}

.modal-content button {
  width: 100%;
  background-color: #027753;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 0;
  font-weight: 500;
  cursor: pointer;
}

.close-modal {
  font-size: 28px;
  float: right;
  cursor: pointer;
  color: #027753;
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 50px);
  width: 100vw;
  position: relative;
  background: #eaf8f4;
  padding-top: 50px;
  direction: ltr;
}

.container.analysis-mode {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: stretch;
  background: transparent;
  width: 100vw;
  height: calc(100vh - 102px);
  direction: ltr;
  overflow: hidden;
  padding: 10px;
  padding-top: 62px !important; /* .analysis-top-bar height (52px) + 10px spacing */
  gap: 10px;
  top: 50px;
}

.main-content {
  position: relative;
  flex: 1 1 60%;
  max-width: 60%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

/* Upload view specific styles */
.upload-view .main-content,
.error-view .main-content {
  width: 100%;
  max-width: 100%;
  display: flex;
  background: #eaf8f4;
  justify-content: center;
}

/* Analysis state adjustments */
.container.analysis-mode .main-content {
  background: transparent !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 0 !important;
  order: 2 !important;
}

.sidebar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  flex: 1 1 40%;
  max-width: 40%;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: static;
  transform: none;
  transition: none;
  position: sticky;
  top: 50px;
  order: 1 !important;
  margin: 0 !important;
  flex-shrink: 0;
}

#sidebarContent {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.insightsContainer-style {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar.visible {
  transform: none;
}

/* Ensure Dig Deeper mode fills the sidebar height */
.sidebar.dig-deeper-mode {
  justify-content: flex-start !important;
  align-items: stretch !important;
  padding: 20px !important;
  margin: 0 !important;
  gap: 16px !important;
  display: flex;
  flex-direction: column;
}

/* Adjust the detailed insight card in Dig Deeper mode */
.detailed-insight-card {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  margin: 0 !important;
  width: 100%;
  box-sizing: border-box;
  overflow-y: scroll;
  height: auto;
  max-height: 100%;
}
.detailed-insight-card .dig-deeper-footer {
  margin-top: 26px;
  color: #6b7280;
  font-size: 12px;
  line-height: 18px;
}

.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

/* Image container for overlaying emojis */
.image-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

/* Emoji overlay styles */
.icon-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  pointer-events: none;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

/* Emoji styles with tooltip */
.emoji {
  position: absolute;
  font-size: 24px;
  transform: translate(-50%, -50%);
  cursor: pointer;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
  pointer-events: auto;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji svg,
.emoji img {
  width: 100%;
  height: 100%;
  display: block;
}

.emoji.highlighted {
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5)) drop-shadow(4px 6px 8px rgba(0, 0, 0, 0.3));
  transform: translate(-50%, -50%) scale(1.3);
}

/* Tooltip on emoji hover */
.emoji:hover::after {
  content: attr(data-title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Analysis questions */
.survey-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  overflow: hidden;
  z-index: 1000;
}

/* Background map layer */
.map-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ddd;
  /* fallback */
  background-size: cover;
  background-position: center;
  filter: grayscale(40%) brightness(0.8);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

.map-background.active {
  opacity: 1;
}

.header-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.header-close-btn:hover {
  background: #e8e8e8;
}

/* Preview section styles */
.preview-content {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.street-photo {
  width: 100%;
  max-width: 600px;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  background: white;
  padding: 12px;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 1;
  display: block !important;
  margin: auto;
  will-change: opacity;
  /* Optimize for mobile performance */
}

.street-photo.visible {
  opacity: 1;
}

.analysis-view {
  display: none;
  width: 100%;
  min-height: 100%;
}

.analysis-view.active {
  display: flex;
  justify-content: center;
  align-items: center;
  visibility: hidden;
}

.analysis-view.revealed {
  visibility: visible;
}

.analysis-top-bar {
  display: flex;
  position: fixed;
  top: 55px;
  left: 0;
  right: 0;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1001;
  pointer-events: none;
  height: 52px;
}

.analysis-top-bar.hidden {
  display: none;
}

.analysis-share-btn {
  pointer-events: all;
  background: #fff;
  color: #016143;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-family: "Funnel Display", sans-serif;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.analysis-share-btn:hover {
  background: #e8e8e8;
}

.analysis-close-btn {
  pointer-events: all;
  background: #fff;
  color: #016143;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.analysis-close-btn:hover {
  background: #e8e8e8;
}

.overview-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
}

.title {
  font-weight: 600;
  font-size: 16px;
  color: #1a1a1a;
  margin-bottom: 12px;
}

.subtitle {
  font-weight: 400;
  color: #666;
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.location-block {
  margin-bottom: 14px;
}

.location-line {
  font-family: "Funnel Display", sans-serif;
  font-weight: 700;
  font-size: 24px;
  line-height: 32px;
  color: #333333;
}

.street-description {
  font-weight: 400;
  color: #666;
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.insight-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
}

.header-text {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-weight: 500;
}

.insight-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.insight-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  font-weight: bold;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
}

.insight-icon img {
  width: 100%;
  height: 100%;
  display: block;
}

/* Tooltip on insight-icon hover */
.insight-icon:hover::after {
  content: attr(data-title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.insight-title {
  font-weight: 700;
  font-size: 22px;
  color: #1a1a1a;
  overflow-wrap: break-word;
}

.insight-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  display: none;
}

.tag {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tag.positive,
.modal-tag.positive {
  color: #059669;
  border-color: #d1fae5;
  background-color: #d1fae5;
}

.tag.negative,
.modal-tag.negative {
  color: #dc2626;
  border-color: #fee2e2;
  background-color: #fee2e2;
}

.tag.neutral,
.modal-tag.neutral {
  color: #f59e0b;
  border-color: #fef3c7;
  background-color: #fef3c7;
}

/* Style the tag symbols (arrows) */
.tag-symbol.positive {
  color: #059669;
}

.tag-symbol.negative {
  color: #dc2626;
}

.tag-symbol.neutral {
  color: #f59e0b;
}

.insight-description {
  font-weight: 400;
  color: #666;
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 16px;
  overflow-wrap: break-word;
}

.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.modal-insight-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-insight-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  font-weight: bold;
  flex-shrink: 0;
}

.modal-insight-title {
  font-weight: 600;
  font-size: 24px;
  color: #1a1a1a;
  overflow-wrap: break-word;
  margin-bottom: 12px;
}

.modal-insight-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  display: none;
}

.modal-tag {
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid;
}

.detailed-description {
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

/* Custom bullets for detailed description */
.detailed-description li {
  padding-left: 20px;
  list-style-type: none;
}

.detailed-description li::before {
  content: "• ";
  color: #666;
  font-weight: bold;
  display: inline-block;
  width: 1em;
  margin-left: -1em;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 120px;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Filled mint green — primary action (Dig Deeper, Submit, Share) */
.btn-primary {
  background-color: #d0ede4;
  color: #065f46;
  transition: background-color 0.2s ease;
}

.btn-primary:not(:disabled):hover,
.btn-primary:not(:disabled):active {
  background-color: #a7f3d0;
}

.btn-primary:focus {
  outline: 2px solid #a7f3d0;
  outline-offset: 2px;
}

/* Ghost green — secondary action (Give Input, Skip, Go Back) */
.btn-secondary {
  background-color: transparent;
  color: #016143;
}

.btn-secondary:hover,
.btn-secondary:active {
  background-color: #e5e7eb;
}

/* White + border — tertiary action (Give Feedback, Cancel in modals) */
.btn-outline {
  background-color: #fff;
  color: #414651;
  border: 1px solid #d5d7da;
}

.btn-outline:hover,
.btn-outline:active {
  background-color: #f5f5f5;
}

/* Text-only dismiss — cancel in modals */
.btn-cancel {
  background: transparent;
  color: #6b7280;
  border: none;
}

.btn-cancel:hover {
  color: #374151;
}

.btn-back-arrow {
  background: none;
  border: none;
  cursor: pointer;
  color: #1a1a1a;
  padding: 0;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  line-height: 1;
}

.btn-back-arrow:hover {
  color: #004b35;
}
.feedback-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.feedback-input-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.feedback-privacy-note {
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
}

.textarea-wrapper {
  position: relative;
}

.feedback-textarea {
  width: 100%;
  height: 68px;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 16px;
  color: #374151;
  font-family: inherit;
  resize: vertical;
}

.feedback-textarea.voice-memo-textarea {
  padding-bottom: 110px;
}

.feedback-textarea::placeholder {
  color: #9ca3af;
}

.feedback-textarea:focus {
  outline: none;
  border-color: #9ca3af;
}

.mic-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #c8e6e0;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.mic-btn:hover {
  background-color: #a8d5cc;
}

.recording-indicator {
  color: #c00;
  font-size: 14px;
  font-weight: 500;
}

.voice-stop-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8eaed;
  border: none;
  border-radius: 20px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s;
}

.voice-stop-btn:hover {
  background-color: #d1d5db;
}

.delete-memo-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #fee2e2;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #dc2626;
  font-weight: 600;
  transition: background-color 0.2s;
}

.delete-memo-btn:hover {
  background-color: #fecaca;
}

.feedback-action-row {
  flex-direction: row-reverse;
}

.final-card .action-buttons {
  flex-direction: column;
}

.final-card .btn {
  width: 100%;
  margin-bottom: 10px;
}

.insight-subtitle {
  margin-top: 13px;
  margin-bottom: 13px;
}

.btn-danger {
  background: transparent;
  border: none;
  color: #6b7280;
}

.btn-danger:hover {
  background: transparent;
  color: #dc2626;
}

#deleteConfirmModal .modal-subtitle {
  margin: 20px 0 28px;
  line-height: 1.6;
}

#deleteConfirmModal .btn-outline {
  border: none;
}

.btn-delete {
  background-color: #fee2e2;
  color: #dc2626;
}

.btn-delete:hover {
  background-color: #fca5a5;
}

/* Consent checkbox */
.consent-container {
    margin-bottom: 16px;
    text-align: center;
}

.consent-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 12px;
    color: #444;
    line-height: 1.5;
}

.consent-label input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #027753;
    cursor: pointer;
}

.consent-label a {
    color: #027753;
    text-decoration: underline;
}

.consent-label a:hover {
    color: #015a3f;
}

.btn-upload-photo.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-upload-photo.disabled .file-input {
    pointer-events: none;
}

/* Upload styles */
.upload-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #eaf8f4;
  padding: 40px 20px;
  border: none;
  border-radius: 0;
  max-width: none;
  text-align: center;
  box-shadow: none;
  min-height: 100vh;
  width: 100%;
}

.error-view {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #eaf8f4;
  padding: 40px 20px;
  border: none;
  border-radius: 0;
  max-width: none;
  text-align: center;
  box-shadow: none;
  min-height: 100vh;
  width: 100%;
}

.error-view {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  padding: 40px 20px;
  border: none;
  border-radius: 0;
  max-width: none;
  text-align: center;
  box-shadow: none;
  min-height: 100vh;
  width: 100%;
}

.upload-view.hidden,
.error-view.hidden {
  display: none;
}

.photo-upload-area,
.photo-error-area {
  text-align: center;
  padding: 60px 40px;
  background: #ffffff;
  /* border: 2px dashed #d1d5db; */
  border-radius: 12px;
  width: 500px;
  max-width: 100%;
  margin-bottom: 24px;
}

.camera-icon,
.error-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 20px;
  background: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #9ca3af;
}

.icon-circle {
  background: #d4f5e9;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  margin: 0 auto 1rem auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.icon-circle i {
  color: #2ecc71;
  font-size: 28px;
}

.upload-title,
.error-title {
  font-weight: 500;
  font-size: 20px;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.upload-subtitle,
.error-subtitle {
  font-weight: 400;
  color: #191919;
  font-size: 18px;
  margin-bottom: 24px;
  line-height: 1.5;
  text-align: center;
}

.subtitle-info {
  font-size: 16px;
}

.subtitle-info a {
  display: inline-block;
  color: #059669;
  text-decoration: none;
  text-align: center;
}

.subtitle-info a::before {
  display: block;
  content: attr(title);
  font-weight: bold;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}

.subtitle-info a:hover {
  font-weight: bold;
}

.home-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.upload {
  background: #d0ede4;
  border-radius: 12px;
}

.explore {
  background: #ffffff;
  border: 1px solid #d5d7da;
  border-radius: 12px;
}

.btn-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  min-height: 44px;
  background: #d0ede4;
}

.btn-explore {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  min-height: 44px;
  background: #ffffff;
}

.btn-take-photo {
  background-color: #059669;
  color: white;
}

.btn-take-photo:hover,
.btn-take-photo:active {
  background-color: #047857;
}

.btn-upload-photo {
  background-color: #d0ede4;
  color: #374151;
  /* border: 1px solid #d1d5db; */
  position: relative;
}

.btn-upload-photo:hover,
.btn-upload-photo:active {
  background-color: #d0ede4;
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
}

.image-preview {
  margin: 20px 0;
  text-align: center;
}

.image-preview:has(img) {
  margin: 20px auto 0;
  width: 100%;
  max-width: 400px;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-upload-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  color: #065f46;
  font-size: 14px;
}

.photo-upload-loader.hidden {
  display: none;
}

.photo-upload-loader p {
  margin: 0;
}

.photo-upload-spinner {
  width: 32px;
  height: 32px;
  border: 4px solid #e5e7eb;
  border-top-color: #059669;
  border-radius: 50%;
  animation: loading-spinner-rotate 1s linear infinite;
}

.image-preview img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-continue {
  width: 100%;
  max-width: 500px;
  padding: 12px;
  background-color: #a7f3d0;
  color: #065f46;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}

.btn-continue:hover,
.btn-continue:active {
  background-color: #86efac;
}

.btn-continue:disabled {
  background-color: #d1d5db;
  cursor: not-allowed;
  color: #9ca3af;
  display: none;
}

/* Feedback Modal */
.modal {
  background: white;
  border-radius: 12px;
  padding: 20px;
  width: 90%;
  max-width: 480px;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(8px) saturate(180%);
  -webkit-backdrop-filter: blur(8px) saturate(180%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  /* Prevent double-tap zoom on mobile */
}

.modal-close:active {
  transform: scale(0.95);
  /* Visual feedback on tap */
}

.modal-title {
  font-weight: 600;
  font-size: 20px;
  color: #1a1a1a;
  text-align: center;
  margin-bottom: 8px;
}

.modal-subtitle {
  font-weight: 400;
  color: #6b7280;
  text-align: center;
  margin-bottom: 14px;
  font-size: 16px;
}

.star-rating {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.star {
  font-size: 32px;
  color: #e5e7eb;
  cursor: pointer;
  transition: color 0.2s;
  touch-action: manipulation;
}

.star:hover,
.star.active {
  color: #fbbf24;
}

.star:active {
  transform: scale(0.95);
}

.modal-buttons {
  display: flex;
  gap: 12px;
}

/* App Rating Modal */
.app-rating-modal {
  text-align: center;
}

.app-rating-modal-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 10px;
}

.app-rating-modal .modal-subtitle {
  font-size: 15px;
  margin-bottom: 24px;
}

.app-rating-modal .star-rating {
  gap: 12px;
  margin-bottom: 24px;
}

.app-rating-modal .star {
  line-height: 1;
  display: inline-flex;
}

.app-rating-modal .star-svg {
  width: 28px;
  height: 28px;
  display: block;
}

.app-rating-modal .star-path {
  fill: none;
  stroke: #1a1a1a;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: fill 0.15s;
}

.app-rating-modal .star.active .star-path {
  fill: #1a1a1a;
}

#submitAppRatingBtn {
  display: block;
  width: 100%;
  border-radius: 14px;
  font-size: 17px;
  margin-top: 16px;
  flex: none;
}

#cancelAppRatingBtn {
  display: block;
  width: 100%;
  padding: 14px;
  flex: none;
}

/* Share Input */
#insightFeedbackModal .modal {
    padding: 28px 24px 24px;
}

#insightFeedbackModal h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.25;
    margin-bottom: 20px;
    text-align: left;
}

.insight-feedback-buttons {
  display: flex;
  border: 1.5px solid #d5d7da;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.insight-feedback-btn {
  color: #414651;
  flex: 1;
  padding: 14px 10px;
  border: none;
  background: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 500;
}

.insight-feedback-btn.yes {
  border-right: 1.5px solid #d5d7da;
}

.insight-feedback-btn.no {
  border-left: none;
}

.insight-feedback-btn.active {
  background-color: #d1fae5;
}

.insight-feedback-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.share-input-section {
  margin-bottom: 16px;
}

.share-input-section textarea {
  width: 100%;
  height: 100px;
  border: 1.5px solid #d1d5db;
  border-radius: 12px;
  padding: 14px;
  resize: none;
  outline: none;
  font-size: 16px;
  color: #1a1a1a;
  font-family: "Funnel Display", sans-serif;
}

.share-input-section textarea::placeholder {
  color: #9ca3af;
}

.hidden {
  display: none;
}

#insightFeedbackSubmitBtn {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  font-size: 17px;
  flex: none;
}

#cancelInsightFeedback {
  margin-top: 12px;
  width: 100%;
  padding: 8px;
  font-size: 15px;
  flex: none;
}

@keyframes fadeIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* === TOAST === */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #016143;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-family: 'Funnel Display', sans-serif;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
  white-space: nowrap;
}

.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.toast--error {
  background: #dc2626;
  bottom: 48px;
}

/* Loading Screen Styles */
.loading-screen-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #f5f5f5;
  /* Match body background */
  z-index: 3000;
  /* Above all other elements */
}

.loading-spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #059669;
  /* Match theme color (positive green) */
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: loading-spinner-rotate 1s linear infinite;
}

@keyframes loading-spinner-rotate {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.loading-status-text {
  margin-top: 20px;
  font-size: 20px;
  color: #333;
  background-color: rgba(255, 255, 255, 0.2);
  padding: 20px;
  border-radius: 12px;
  font-family: "Funnel Display", sans-serif;
  text-align: center;
}

/* Media Query for Large Screens (e.g., >1200px) */
@media (min-width: 1201px) {
  .container.analysis-mode {
    padding: 20px;
    gap: 20px;
  }

  .main-content {
    flex: 1 1 65%;
    max-width: 65%;
  }

  .sidebar {
    flex: 1 1 35%;
    max-width: 35%;
    padding: 25px;
  }

  .image-container {
    max-width: 700px;
  }

  .street-photo {
    max-width: 700px;
    max-height: 85vh;
    padding: 15px;
  }

  .icon-overlay {
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
  }

  .emoji {
    font-size: 28px;
    width: 36px;
    height: 36px;
  }

  .emoji:hover::after {
    display: block;
    /* Ensure tooltip is visible on hover */
  }

  .detailed-insight-card {
    padding: 24px;
  }

  .modal-insight-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .modal-insight-title {
    font-size: 24px;
    font-weight: 700;
  }

  .modal-insight-tags {
    margin-bottom: 20px;
  }

  .modal-tag {
    padding: 8px 14px;
    font-size: 16px;
  }

  .detailed-description {
    font-size: 16px;
    line-height: 1.7;
  }

  .loading-spinner {
    width: 70px;
    height: 70px;
    border-width: 10px;
  }

  .loading-status-text {
    font-size: 24px;
    padding: 25px;
  }
}

/* Media Query for Medium Screens (e.g., 769px to 1200px) */
@media (max-width: 1200px) {
  .main-content {
    flex: 1 1 60%;
    max-width: 60%;
  }

  .sidebar {
    flex: 1 1 40%;
    max-width: 40%;
    padding: 15px;
  }

  .image-container {
    max-width: 500px;
  }

  .street-photo {
    max-width: 500px;
    max-height: 75vh;
    padding: 10px;
  }

  .icon-overlay {
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .emoji {
    font-size: 22px;
    width: 30px;
    height: 30px;
  }

  .modal-insight-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .modal-tag {
    padding: 6px 12px;
    font-size: 14px;
  }

  .detailed-description {
    font-size: 16px;
    line-height: 1.6;
  }

  .loading-spinner {
    width: 60px;
    height: 60px;
    border-width: 8px;
  }

  .loading-status-text {
    font-size: 20px;
    padding: 20px;
  }
}

/* Media Query for Small Screens (e.g., 481px to 768px) */
/* this is our mobile view - do the pointer thing to isolate mobile devices. */
@media ((max-width: 768px) and (pointer: coarse)) {
  .container.analysis-mode {
    flex-direction: column;
    justify-content: flex-start;
    padding: 10px;
    padding-top: 62px !important; /* topbar(52px) + 10px */
    padding-bottom: 60px;
    gap: 20px;
    min-height: 100vh;
    overflow-y: auto;
    position: relative;
  }

  .main-content {
    flex: 0 0 auto;
    max-width: 100%;
    order: 1 !important;
    max-height: 50vh;
  }

  .sidebar {
    flex: 1;
    max-width: 100%;
    padding: 15px;
    order: 2 !important;
    height: auto;
    overflow-y: visible;
    position: relative;
    background-color: transparent;
    backdrop-filter: blur(0px);
    border-radius: 0px;
    box-shadow: none;
    position: fixed;    /* ← pins to bottom of viewport */
    max-width: 100%;
    padding: 15px;
    z-index: 10;
    
    /* grows upward, overlaps image when tall */
    max-height: 120vh;
    overflow-y: auto;
    top: 112px;
    bottom: 10px;
    width: 95%;
    left: 50%;
  }

  .sidebar.visible {
    transform: translateX(-50%);
  }

  /* Make sidebar content a horizontal swipeable area */
  #sidebarContent {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    overflow-x: auto;
    gap: 12px;
    padding: 0 5% 10px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    width: 100%;
    box-sizing: border-box;
    position: fixed;
    bottom: 0;
    left: 0;
  }

  #sidebarContent::-webkit-scrollbar {
    display: none;
  }

  .insightsContainer-style {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
  }

  .sidebar.dig-deeper-mode #sidebarContent,
  .sidebar.dig-deeper-mode .insightsContainer-style {
    flex-direction: column;
    align-items: stretch;
    overflow-x: hidden;
    width: 100%;
  }

  .dem-container {
    max-height: 450px;
    overflow-y: scroll;
  }

  .image-container {
    max-width: 100%;
  }

  .street-photo {
    max-width: 100%;
    max-height: 45vh;
    /* Reduced to fit short screens */
    padding: 8px;
  }

  .icon-overlay {
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: 9;
  }

  .emoji {
    font-size: 20px;
    width: 28px;
    height: 28px;
    touch-action: manipulation;
  }

  /* Disable emoji tooltips on mobile to avoid hover issues */
  .emoji:hover::after {
    display: none;
  }

  /* Add tap effect for emojis */
  .emoji:active {
    transform: translate(-50%, -50%) scale(0.95);
  }

  .overview-card,
  .insight-card {
    flex: 0 0 auto;
    max-width: none;
    width: 100%;
    min-width: 0;
    /* Allow shrinking */
    padding: 15px;
    margin-bottom: 0;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: #ffffff;
    transition:
      transform 0.2s ease,
      box-shadow 0.2s ease;
    scroll-snap-align: center;
    /*touch-action: pan-x;*/
    /* Restrict to horizontal touch */
    border: none;
  }

  .insight-tags {
    gap: 4px;
  }

  .insight-title,
  .insight-description {
    overflow-wrap: break-word;
  }

  /* Navigation Arrows for Swiping */
  .nav-arrows {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px 0;
    z-index: 2000;
    /* Above all other elements */
    pointer-events: none;
    width: 100%;
    max-width: 300px;
    /* Prevent arrows from stretching too wide */
  }

  /* Hide nav arrows in Dig Deeper mode */
  .sidebar.dig-deeper-mode + .nav-arrows {
    display: none;
  }

  .arrow {
    background: rgba(0, 0, 0, 0.6);
    /* Slightly darker for better visibility */
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
      background-color 0.2s ease,
      transform 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    /* Stronger shadow for depth */
    pointer-events: auto;
    z-index: 2001;
    touch-action: manipulation;
    /* Prevent double-tap zoom on mobile */
  }

  .arrow:active {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(0.95);
    /* Visual feedback on tap */
  }

  .arrow:disabled {
    background: rgba(0, 0, 0, 0.3);
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
  }

  .arrow-left::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
  }

  .arrow-right::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
  }

  .btn {
    padding: 8px 12px;
    min-height: 44px;
    /* Ensure accessibility for tap targets */
    min-width: 100px;
  }

  .action-buttons {
    gap: 8px;
    flex-direction: row;
  }

  .detailed-insight-card {
    padding: 15px;
    flex: 0 0 auto;
    max-width: 100%;
    /* Full width in Dig Deeper mode */
    width: 100%;
    min-width: 0;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    scroll-snap-align: none;
    bottom: 0;
    position: absolute;
    width: 90%;
    overflow-y: scroll;
  }

  .modal-insight-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .modal-tag {
    padding: 5px 10px;
    font-size: 13px;
  }

  .image-preview:has(img) {
    max-width: 300px;
    height: 220px;
  }

  .image-preview img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
  }

  .photo-upload-area {
    padding: 40px 20px;
  }

  .loading-spinner {
    width: 50px;
    height: 50px;
    border-width: 6px;
  }

  .loading-status-text {
    font-size: 18px;
    padding: 15px;
    max-width: 80%;
  }
}

/* Hide navigation arrows on desktop and disable touch-specific styles */
@media (min-width: 769px) {
  .nav-arrows {
    display: none;
  }

  /* Disable touch-specific styles on desktop */
  .overview-card:active,
  .insight-card:active {
    transform: none;
    background-color: white;
  }

  .btn:active {
    transform: none;
  }

  .arrow:active {
    transform: none;
  }

  .emoji:active {
    transform: translate(-50%, -50%);
  }

  .modal-close:active,
  .star:active {
    transform: none;
  }
}

/* Ensure smooth scrolling on iOS */
@supports (-webkit-overflow-scrolling: touch) {
  html,
  body {
    /*overscroll-behavior: none;*/
    /* Prevent bounce effect */
  }
}
