/**
 * Comment Widget Styles
 * Clean, minimal design that works with any site
 */

.comment-widget {
  max-width: 70ch;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.comment-form-container,
.comments-list-container {
  margin-bottom: 2rem;
}

.comment-widget h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #333;
  font-weight: 600;
}

/* Comment Form */
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Honeypot field - hidden from humans */
.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Contact fields wrapper - side by side on desktop/tablet */
.contact-fields-wrapper {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.name-field-container {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
  min-width: 250px;
}

.comment-name-input {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, opacity 0.2s, background-color 0.2s;
}

.comment-name-input:focus {
  outline: none;
  border-color: #4a90e2;
}

.comment-name-input.disabled,
.comment-name-input:disabled {
  opacity: 0.5;
  background-color: #f5f5f5;
  cursor: not-allowed;
}

.anonymous-checkbox-label {
  display: none; /* Hidden per user request */
}

.anonymous-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Email field */
.email-field-container {
  flex: 1;
  min-width: 250px;
}

.comment-email-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.comment-email-input:focus {
  outline: none;
  border-color: #4a90e2;
}

.email-privacy-note {
  margin: 0.5rem 0 0 0;
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
}

/* Mobile: Stack fields vertically */
@media (max-width: 640px) {
  .contact-fields-wrapper {
    flex-direction: column;
  }

  .name-field-container,
  .email-field-container {
    min-width: 100%;
  }
}

.comment-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}

.comment-form textarea:focus {
  outline: none;
  border-color: #4a90e2;
}

.comment-submit {
  align-self: flex-start;
  padding: 0.75rem 1.5rem;
  background: #6b7c8e;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.comment-submit:hover {
  background: #5a6a7a;
}

.comment-submit:active {
  transform: translateY(1px);
}

.comment-submit:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Status Messages */
.comment-status {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

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

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

.comment-status.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Map Section */
.map-popup-container .leaflet-popup-close-button { display: none; }
.map-popup-container .leaflet-popup-content-wrapper { padding: 6px 8px; }
.map-popup-container .leaflet-popup-content { margin: 0; }

/* Enlarge main map zoom controls */
.memory-map .leaflet-control-zoom a {
  width: 52px;
  height: 52px;
  line-height: 52px;
  font-size: 24px;
}

.memory-map .leaflet-control-zoom {
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.map-marker-label {
  background: rgba(255, 255, 255, 0.85);
  color: #333;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}


/* Map toggle checkbox */
.map-toggle-container {
  margin: 0.5rem 0;
}

.map-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: #555;
  user-select: none;
}

.map-toggle-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.map-toggle-label:hover {
  color: #333;
}

.map-section {
  margin: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s ease-in-out, opacity 0.4s ease-in-out, margin 0.4s ease-in-out;
}

.map-section-visible {
  max-height: 800px;
  opacity: 1;
  margin: 0.5rem 0;
}

.map-label {
  display: block;
  font-weight: 500;
  color: #2c3e50;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.map-explanation {
  margin: 0 0 0.5rem;
  color: #555;
  font-size: 0.95rem;
  line-height: 1.5;
}

.memory-map {
  width: 100%;
  height: 300px;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.map-status {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
  text-align: center;
  min-height: 1.2rem;
}

/* Private contact note - hidden in form, will be moved to footer area */
.comment-form-container .private-contact-note {
  display: none;
}

/* Private contact note when moved outside form container */
.private-contact-note {
  text-align: center;
  margin: 1.5rem 0;
  padding-top: 5.5rem;
  border-top: 1px solid #e0e0e0;
}

.private-contact-note p {
  color: #666;
  font-size: 0.95rem;
  font-style: italic;
}

.private-contact-note a {
  color: #6b7c8e;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
}

.private-contact-note a:hover {
  color: #2c3e50;
  border-bottom-color: #6b7c8e;
}

/* Rutgers link note - similar to private contact but with less spacing */
.rutgers-link-note {
  text-align: center;
  margin: 1.5rem 0 0 0;
  padding-top: 1.5rem;
}

.rutgers-link-note p {
  color: #666;
  font-size: 0.95rem;
  font-style: italic;
}

.rutgers-link-note a {
  color: #6b7c8e;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
}

.rutgers-link-note a:hover {
  color: #2c3e50;
  border-bottom-color: #6b7c8e;
}

/* Comments List */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #666;
  font-style: italic;
}

.no-comments {
  text-align: center;
  padding: 2rem;
  color: #999;
  font-style: italic;
}

.error {
  text-align: center;
  padding: 2rem;
  color: #d32f2f;
  background: #ffebee;
  border-radius: 8px;
  border: 1px solid #ef9a9a;
}

/* Individual Comment */
.comment {
  position: relative;
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
  transition: box-shadow 0.2s, border-color 0.3s;
  overflow: hidden;
}

.comment:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* New comment highlight animation */
.comment-new {
  border-color: #4caf50;
  box-shadow: 0 0 12px rgba(76, 175, 80, 0.4);
  animation: fadeGlow 3s ease-out forwards;
}

@keyframes fadeGlow {
  0% {
    border-color: #4caf50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.4);
  }
  100% {
    border-color: #e0e0e0;
    box-shadow: none;
  }
}

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

.comment-author {
  font-weight: 600;
  color: #333;
}

.comment-date {
  font-size: 0.85rem;
  color: #666;
}

.comment-edit-btn {
  padding: 0.35rem 0.75rem;
  background: #6b7c8e;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-left: 0.5rem;
}

.comment-edit-btn:hover {
  background: #5a6a7a;
}

.comment-edit-btn:active {
  transform: translateY(1px);
}

/* Edit form styles */
.comment-edit-form {
  margin-top: 1rem;
}

.edit-form-wrapper {
  background: #f9f9f9;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
}

.edit-form-field {
  margin-bottom: 1rem;
}

.edit-form-field:last-of-type {
  margin-bottom: 0.5rem;
}

.edit-form-field label {
  display: block;
  font-weight: 500;
  color: #2c3e50;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.edit-name-input,
.edit-email-input,
.edit-text-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.edit-name-input:focus,
.edit-email-input:focus,
.edit-text-input:focus {
  outline: none;
  border-color: #4a90e2;
}

.edit-text-input {
  resize: vertical;
  min-height: 80px;
}

.edit-map-section {
  margin-top: 0.5rem;
}

.edit-memory-map {
  border-radius: 8px;
  border: 2px solid #e0e0e0;
  overflow: hidden;
}

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

.btn-save-edit,
.btn-cancel-edit {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.btn-save-edit {
  background: #6b7c8e;
  color: white;
}

.btn-save-edit:hover {
  background: #5a6a7a;
}

.btn-save-edit:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-cancel-edit {
  background: #e0e0e0;
  color: #333;
}

.btn-cancel-edit:hover {
  background: #d0d0d0;
}

.btn-save-edit:active,
.btn-cancel-edit:active {
  transform: translateY(1px);
}

.comment-text {
  color: #444;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-bottom: 0.75rem;
}

/* Mini map in comments - now full width below header */
.comment-map-thumbnail {
  width: 100%;
  height: 300px;
  margin: 0 0 1rem 0;
}

.mini-map {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
  .comment-widget {
    margin: 1rem auto;
  }

  .comment-widget h3 {
    font-size: 1.25rem;
  }

  .name-field-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .comment-name-input {
    max-width: 100%;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .comment-form textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .comment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}


.map-quick-zooms {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.zoom-label {
  font-weight: 500;
}

.zoom-select {
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.zoom-world-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #f0f0f0;
  cursor: pointer;
}

.comment-text {
  color: #444;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-bottom: 0.75rem;
}