* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --green: #2d6a4f;
  --green-light: #40916c;
  --green-pale: #d8f3dc;
  --bg: #f0f0f0;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-dim: #666666;
  --danger: #d32f2f;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.15);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Header */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--green);
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#header h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 1.2rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.35);
}

/* Map */
#map {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 28px;
  right: 20px;
  z-index: 999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  border: none;
  font-size: 2rem;
  font-weight: 300;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab:hover {
  background: var(--green-light);
  transform: scale(1.08);
}

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

/* List Panel */
#list-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(340px, 85vw);
  z-index: 1100;
  background: var(--card);
  box-shadow: var(--shadow);
  transform: translateX(-105%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#list-panel.open {
  transform: translateX(0);
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--green);
  color: white;
}

.list-header h2 {
  font-size: 1.1rem;
}

/* Tag Filters */
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid #eee;
}

.tag-filter {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1.5px solid #ccc;
  background: white;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tag-filter.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.search-input {
  margin: 8px 16px;
  padding: 10px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--green);
}

/* Entries List */
#entries-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.entry-card {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.15s;
}

.entry-card:hover {
  background: var(--green-pale);
}

.entry-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.entry-card-tag {
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--green-pale);
  color: var(--green);
  font-weight: 600;
}

.entry-card-date {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.entry-card-note {
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry-card.has-photo::before {
  content: "📷";
  margin-right: 6px;
  font-size: 0.85rem;
}

.no-entries {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--card);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}

.modal-header h2 {
  font-size: 1.15rem;
}

.modal-body {
  padding: 20px;
}

/* Form */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.form-group textarea,
.form-group select,
.form-group input[type="month"] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: white;
}

.form-group textarea:focus,
.form-group select:focus,
.form-group input[type="month"]:focus {
  border-color: var(--green);
}

/* Photo Input */
.photo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.photo-file-input {
  display: none;
}

.photo-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border: 2px dashed #ccc;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
}

.photo-btn:hover {
  border-color: var(--green);
  background: var(--green-pale);
}

.photo-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
}

.remove-photo {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 8px;
}

/* Location Status */
.location-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f8f8f8;
  border-radius: 8px;
  font-size: 0.9rem;
}

.location-status.found {
  background: var(--green-pale);
  color: var(--green);
}

.location-status.error {
  background: #ffebee;
  color: var(--danger);
}

.link-btn {
  background: none;
  border: none;
  color: var(--green);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  margin-left: auto;
}

/* Submit */
.submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.submit-btn:hover {
  background: var(--green-light);
}

.submit-btn:disabled {
  background: #aaa;
  cursor: not-allowed;
}

/* Detail Modal */
.detail-modal {
  border-radius: var(--radius) var(--radius) 0 0;
}

.detail-photo {
  width: 100%;
  max-height: 250px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 16px;
}

.detail-note {
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.detail-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  padding: 0 20px 20px;
}

.detail-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: #eee;
  color: var(--text);
  transition: background 0.2s;
}

.detail-btn.danger {
  background: #ffebee;
  color: var(--danger);
}

.detail-btn:hover {
  background: #ddd;
}

.detail-btn.danger:hover {
  background: #ffcdd2;
}

/* Footer */
#footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 998;
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 8px;
  pointer-events: none;
}

.footer-btn {
  padding: 6px 16px;
  background: rgba(255,255,255,0.9);
  border: 1px solid #ccc;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.2s;
}

.footer-btn:hover {
  background: white;
}

/* Map popup */
.leaflet-popup-content-wrapper {
  border-radius: 10px;
}

.leaflet-popup-content {
  margin: 12px;
  font-family: inherit;
}

.popup-note {
  font-size: 0.95rem;
  margin-bottom: 4px;
  max-width: 220px;
}

.popup-tag {
  font-size: 0.8rem;
  color: var(--green);
  font-weight: 600;
}

.popup-photo {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 8px;
}

/* Custom markers */
.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  border: 2px solid white;
}

.custom-marker span {
  transform: rotate(45deg);
  font-size: 1rem;
}

/* Desktop tweaks */
@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
  }

  .modal {
    border-radius: var(--radius);
    margin: auto;
    max-height: 80vh;
  }

  .modal-overlay.open .modal {
    transform: translateY(0);
  }
}
