/* Survey page styles — extracted from layouts/survey.html.erb */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
/* Full-screen, no-scroll — scoped to the survey page so it can't leak onto
   other :app-bundled pages (e.g. Leaf & Shell). */
html:has(body.survey-page),
body.survey-page {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

/* Push Leaflet controls down below header */
.leaflet-top.leaflet-right {
  top: 70px !important;
  right: 10px !important;
}

.leaflet-bottom.leaflet-left {
  bottom: 20px !important;
}

/* Header bar */
.survey-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #1f2937;
  color: white;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.survey-header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  text-decoration: none;
}

.survey-header__back:hover {
  background: rgba(255, 255, 255, 0.2);
}

.survey-header__title {
  font-size: 18px;
  font-weight: 600;
}

.survey-header__subtitle {
  font-size: 12px;
  color: #9ca3af;
  margin-left: auto;
}

/* Legend */
.survey-legend {
  position: fixed;
  bottom: 20px;
  right: 10px;
  background: white;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  font-size: 12px;
}

.survey-legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.survey-legend__item:last-child {
  margin-bottom: 0;
}

.survey-legend__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.survey-legend__dot--red {
  background: #dc2626;
}
.survey-legend__dot--yellow {
  background: #f59e0b;
}
.survey-legend__dot--blue {
  background: #3b82f6;
}
.survey-legend__dot--purple {
  background: #8b5cf6;
}
.survey-legend__dot--green {
  background: #22c55e;
}

/* Survey popup - match main map styling */
.leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
  margin: 0;
  width: auto !important;
}

.leaflet-popup-close-button {
  display: none;
}

.leaflet-popup-tip {
  border-top-color: white;
}

.survey-popup {
  min-width: 220px;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
}

.survey-popup__header {
  padding: 16px 18px;
  background: #fef2f2;
  border-bottom: 3px solid #dc2626;
}

.survey-popup--yellow .survey-popup__header {
  background: #fffbeb;
  border-bottom-color: #f59e0b;
}

.survey-popup--blue .survey-popup__header {
  background: #eff6ff;
  border-bottom-color: #3b82f6;
}

.survey-popup__name {
  font-size: 17px;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.survey-popup__body {
  padding: 14px 18px;
  background: white;
}

.survey-popup__label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px 0;
}

.survey-popup__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.survey-popup__list li {
  font-size: 13px;
  color: #374151;
  padding: 5px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.survey-popup__list li::before {
  content: "";
  width: 6px;
  height: 6px;
  background: #dc2626;
  border-radius: 50%;
  flex-shrink: 0;
}

.survey-popup--yellow .survey-popup__list li::before {
  background: #f59e0b;
}

.survey-popup--blue .survey-popup__list li::before {
  background: #3b82f6;
}

.survey-popup__actions {
  padding: 12px 18px;
  background: white;
  border-top: 1px solid #e5e7eb;
}

.survey-popup__save {
  display: block;
  width: 100%;
  padding: 12px 18px;
  background: #d97706;
  color: white;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.survey-popup__save:hover:not(:disabled) {
  background: #b45309;
}

.survey-popup__save:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.survey-popup__save--success {
  background: #10b981;
}

.survey-popup__btn {
  display: block;
  width: 100%;
  padding: 14px 18px;
  background: #d97706;
  color: white;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.survey-popup__btn:hover {
  background: #b45309;
}

/* Override Leaflet's .leaflet-container a color */
.leaflet-popup-content .survey-popup__btn {
  color: white;
}

a.app-control__update.has-update {
  color: #fff;
}

/* Mode control */
.mode-control {
  position: relative;
}

.mode-control__btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px !important;
  height: 30px !important;
  background: white;
  text-decoration: none;
  font-size: 16px;
  line-height: 30px !important;
  padding: 0 !important;
}

.mode-control__btn:hover {
  background: #f4f4f4;
}

.mode-control__icon {
  font-size: 18px;
}

.mode-control__panel {
  display: none;
  position: absolute;
  top: 0;
  right: 36px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  min-width: 200px;
  overflow: hidden;
  z-index: 1000;
}

.mode-control.expanded .mode-control__panel {
  display: block;
}

.mode-control__header {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}

.mode-control__list {
  padding: 6px;
}

.mode-control__option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: white;
  text-align: left;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.mode-control__option:hover {
  background: #f5f5f5;
}

.mode-control__option.active {
  background: #f3e8ff;
}

.mode-control__option-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.mode-control__option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mode-control__option-label {
  font-weight: 600;
  color: #1f2937;
}

.mode-control__option-desc {
  font-size: 12px;
  color: #6b7280;
}

/* Diet/Camping mode popup styles */
.survey-popup__header--diet {
  background: #ecfdf5;
  border-bottom-color: #10b981;
}

.survey-popup__header--camping {
  background: #fef3c7;
  border-bottom-color: #f59e0b;
}

.survey-popup--diet .survey-popup__header {
  background: #ecfdf5;
  border-bottom-color: #10b981;
}

.survey-popup--camping .survey-popup__header {
  background: #fef3c7;
  border-bottom-color: #f59e0b;
}

.survey-popup__feature {
  margin-bottom: 14px;
}

.survey-popup__feature:last-child {
  margin-bottom: 0;
}

.survey-popup__feature-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.survey-popup__feature-done {
  font-size: 13px;
  color: #6b7280;
  padding: 8px 0;
}

.survey-popup__toggles {
  display: flex;
  gap: 6px;
}

.survey-toggle {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.survey-toggle:hover:not(:disabled) {
  border-color: #d1d5db;
  background: #f9fafb;
}

.survey-toggle--yes {
  color: #059669;
}

.survey-toggle--yes:hover:not(:disabled) {
  background: #ecfdf5;
  border-color: #10b981;
}

.survey-toggle--yes.selected {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.survey-toggle--no {
  color: #dc2626;
}

.survey-toggle--no:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #f87171;
}

.survey-toggle--no.selected {
  background: #dc2626;
  border-color: #dc2626;
  color: white;
}

.survey-toggle--unknown {
  color: #6b7280;
}

.survey-toggle--unknown:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.survey-toggle--unknown.selected {
  background: #6b7280;
  border-color: #6b7280;
  color: white;
}

.survey-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.survey-toggle.loading {
  position: relative;
  color: transparent;
}

.survey-toggle.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #d1d5db;
  border-top-color: #6b7280;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.survey-popup__message {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 6px;
  font-size: 13px;
  color: #166534;
  text-align: center;
}

/* Override button colors in popup */
.leaflet-popup-content .survey-toggle--yes {
  color: #059669;
}
.leaflet-popup-content .survey-toggle--no {
  color: #dc2626;
}
.leaflet-popup-content .survey-toggle--unknown {
  color: #6b7280;
}
.leaflet-popup-content .survey-toggle--yes.selected,
.leaflet-popup-content .survey-toggle--no.selected,
.leaflet-popup-content .survey-toggle--unknown.selected {
  color: white;
}
