/* Notes Module Styles */

/* Container */
#notes-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #f5f5f5;
}

/* Top controls */
.notes-controls {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.notes-controls select {
  flex: 1;
  min-width: 150px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}

/* List view */
#notes-list-view {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.notes-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.notes-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* Thread cards */
.note-thread-card {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition:
    transform 0.1s,
    box-shadow 0.1s;
}

.note-thread-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.note-thread-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.note-author-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.note-author-badge.advisor {
  background: #e3f2fd;
  color: #1565c0;
}

.note-author-badge.grower {
  background: #e8f5e9;
  color: #2e7d32;
}

.note-author-badge.you {
  background: #f3e5f5;
  color: #6a1b9a;
}

.note-timestamp {
  font-size: 12px;
  color: #999;
}

.note-badges {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.note-badge {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

.note-badge.location {
  background: #fff3e0;
  color: #e65100;
}

.note-badge.photo {
  background: #e0f2f1;
  color: #00695c;
}

.note-badge.shared {
  background: #e8f5e9;
  color: #2e7d32;
}

.note-badge.private {
  background: #fce4ec;
  color: #c2185b;
}

.note-badge.replies {
  background: #e3f2fd;
  color: #1565c0;
}

.note-badge.unread {
  background: #ff5252;
  color: #fff;
}

.note-content-preview {
  font-size: 14px;
  color: #333;
  line-height: 1.5;
  margin: 8px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-photo-thumbnail {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  margin-top: 8px;
}

/* Thread detail view */
#notes-thread-view {
  display: none;
  flex-direction: column;
  height: 100%;
  background: #fff;
}

#notes-thread-view.active {
  display: flex;
}

#notes-thread-view.active ~ .notes-fab {
  display: none;
}

.thread-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e0e0e0;
  background: #fff;
}

.thread-back-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.thread-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  flex: 1;
}

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.note-message {
  margin-bottom: 16px;
}

.note-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.note-message-author {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.note-message-time {
  font-size: 12px;
  color: #999;
}

.note-message-content {
  background: #f5f5f5;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.note-message.own .note-message-content {
  background: #e8f5e9;
}

.note-message-photo {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 8px;
  cursor: pointer;
}

.note-message-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #666;
  margin-top: 6px;
}

.thread-reply-box {
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
  background: #fff;
}

.thread-reply-input {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.thread-reply-input textarea {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  resize: none;
  min-height: 40px;
  max-height: 120px;
}

.thread-reply-input button {
  padding: 10px 16px;
  background: #2d6a35;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.thread-reply-input button:hover {
  background: #235227;
}

.thread-reply-input button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Floating action button */
.notes-fab {
  position: fixed;
  bottom: 140px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2d6a35;
  color: #fff;
  border: none;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  z-index: 100;
}

.notes-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.notes-fab:active {
  transform: scale(0.95);
}

/* Modal */
.notes-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.notes-modal-content {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.notes-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notes-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
}

.notes-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.notes-modal-close:hover {
  background: #f0f0f0;
}

.notes-modal-body {
  padding: 20px;
}

.notes-form-group {
  margin-bottom: 16px;
}

.notes-form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.notes-form-group select,
.notes-form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.notes-form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.notes-photo-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notes-photo-input {
  padding: 10px;
  border: 2px dashed #ddd;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}

.notes-photo-input:hover {
  border-color: #2d6a35;
}

.notes-photo-preview {
  max-width: 100%;
  border-radius: 6px;
}

.notes-location-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notes-location-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notes-location-option {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notes-location-option input[type="radio"] {
  width: 16px;
  height: 16px;
}

.notes-location-coords {
  font-size: 12px;
  color: #666;
  padding: 8px;
  background: #f5f5f5;
  border-radius: 4px;
}

.notes-checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notes-checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.notes-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.notes-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}

.notes-btn-primary {
  background: #2d6a35;
  color: #fff;
}

.notes-btn-primary:hover {
  background: #235227;
}

.notes-btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.notes-btn-secondary:hover {
  background: #e0e0e0;
}

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

/* Photo modal */
.notes-photo-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.notes-photo-modal.active {
  display: flex;
}

.notes-photo-modal img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.notes-photo-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
}

/* Loading spinner */
.notes-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.notes-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #f0f0f0;
  border-top-color: #2d6a35;
  border-radius: 50%;
  animation: notes-spin 0.8s linear infinite;
}

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

/* Mobile adjustments */
@media (max-width: 700px) {
  .notes-fab {
    bottom: 80px; /* Above mobile nav */
  }

  .notes-modal-content {
    max-height: 85vh;
  }
}
