* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, sans-serif; height: 100vh; display: flex; flex-direction: column; }

header {
  background: #2c3e50; color: white; padding: 12px 20px;
  display: flex; justify-content: space-between; align-items: center;
}
header a { color: #ecf0f1; text-decoration: none; margin-left: 10px; }
header a:hover { color: #3498db; }

main { flex: 1; display: flex; overflow: hidden; }
#sidebar {
  width: 320px; background: #f5f5f5; padding: 15px;
  overflow-y: auto; border-right: 1px solid #ddd;
}
#map-container { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }

#search-box {
  position: absolute; top: 15px; left: 15px; z-index: 500;
  width: 350px; max-width: calc(100% - 30px);
}
#search-input {
  width: 100%; padding: 10px 14px; font-size: 14px;
  border: none; border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
#search-results {
  list-style: none; background: white; margin-top: 4px;
  border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  max-height: 300px; overflow-y: auto;
}
#search-results.hidden { display: none; }
#search-results li {
  padding: 10px 14px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}
#search-results li:hover { background: #f5f5f5; }
#search-results li:last-child { border-bottom: none; }

.marker-item {
  background: white; padding: 10px; margin-bottom: 8px;
  border-radius: 6px; border: 1px solid #ddd;
}
.marker-title { font-weight: 500; margin-bottom: 4px; }
.marker-actions { margin-top: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.marker-actions button { padding: 5px 10px; font-size: 12px; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal.hidden { display: none; }
.modal-content {
  background: white; padding: 24px; border-radius: 10px;
  min-width: 420px; max-width: 90%; max-height: 90vh; overflow-y: auto;
}
.modal-content h3 { margin-bottom: 12px; }
.modal-content input, .modal-content textarea {
  width: 100%; padding: 8px; margin: 8px 0;
  border: 1px solid #ddd; border-radius: 4px; font-family: inherit;
}
.modal-content textarea { resize: vertical; }
.modal-actions { display: flex; gap: 10px; margin-top: 15px; }
.checkbox-label { display: block; margin: 10px 0; cursor: pointer; }
.checkbox-label input { width: auto; margin-right: 6px; }

.photos-section { margin: 12px 0; }
.drop-zone {
  border: 2px dashed #bdc3c7; border-radius: 8px;
  padding: 20px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: #fafafa;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: #3498db; background: #ebf5fb;
}
.drop-zone-text { color: #7f8c8d; }
.drop-zone-text small { color: #95a5a6; }

.photos-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preview-item {
  position: relative; width: 90px; height: 90px;
  border-radius: 6px; overflow: hidden; border: 1px solid #ddd;
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.remove-photo {
  position: absolute; top: 2px; right: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(231, 76, 60, 0.9); color: white;
  border: none; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}

.photos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.photo-thumb {
  width: 110px; height: 110px; object-fit: cover;
  border-radius: 6px; cursor: pointer;
}

#share-main { flex: 1; display: flex; }
#share-content { display: flex; flex: 1; }
#share-sidebar {
  width: 380px; padding: 24px; overflow-y: auto;
  background: #f5f5f5; border-right: 1px solid #ddd;
}
#share-map { flex: 1; }
#share-comment { margin-bottom: 10px; }
.meta { color: #7f8c8d; font-size: 13px; margin: 6px 0; }
.photos-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 15px 0; }
.photo-large {
  width: 100%; max-width: 320px; border-radius: 8px;
  object-fit: cover; aspect-ratio: 1;
}
.share-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.share-link { margin: 10px 0; word-break: break-all; }

.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.auth-card {
  background: white; padding: 32px; border-radius: 12px;
  width: 380px; max-width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.auth-card h1 { text-align: center; margin-bottom: 8px; }
.auth-card h2 { text-align: center; margin-bottom: 20px; color: #555; }
.auth-card label { display: block; margin-top: 12px; font-size: 13px; color: #555; }
.auth-card input {
  width: 100%; padding: 10px; margin-top: 4px;
  border: 1px solid #ddd; border-radius: 6px; font-size: 14px;
}
.auth-card button {
  width: 100%; margin-top: 20px; padding: 12px;
  background: #3498db; color: white; border: none;
  border-radius: 6px; font-size: 15px; cursor: pointer;
}
.auth-card button:hover { background: #2980b9; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; }
.error { color: #e74c3c; font-size: 13px; margin-top: 10px; min-height: 18px; }

.admin-main { flex: 1; padding: 20px; overflow-y: auto; background: #f5f5f5; }
.admin-tabs {
  display: flex; gap: 8px; margin-bottom: 20px;
  border-bottom: 2px solid #ddd; padding-bottom: 8px;
}
.admin-tabs .tab {
  background: transparent; color: #555; padding: 8px 16px;
  border-radius: 6px 6px 0 0;
}
.admin-tabs .tab.active { background: white; color: #2c3e50; font-weight: 600; }
.tab-content { display: none; background: white; padding: 20px; border-radius: 8px; }
.tab-content.active { display: block; }

.admin-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
.admin-table th, .admin-table td {
  padding: 10px; text-align: left; border-bottom: 1px solid #eee;
}
.admin-table th { background: #f9f9f9; font-weight: 600; }
.admin-table .actions button { padding: 4px 8px; font-size: 12px; margin-right: 4px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 500;
}
.badge.admin { background: #fdebd0; color: #b9770e; }
.badge.user { background: #d6eaf8; color: #1b4f72; }

.words-list { list-style: none; margin-top: 15px; }
.words-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: #fff5f5; border-left: 3px solid #e74c3c;
  margin-bottom: 6px; border-radius: 4px;
}
.words-list li button {
  background: transparent; color: #e74c3c; padding: 2px 8px;
}

.msg { margin-top: 10px; font-size: 13px; min-height: 18px; }
.msg.ok { color: #27ae60; }
.msg.err { color: #e74c3c; }

.modal-content select {
  width: 100%; padding: 8px; margin: 8px 0;
  border: 1px solid #ddd; border-radius: 4px;
}

a { color: #3498db; }
button {
  background: #3498db; color: white; border: none;
  padding: 8px 14px; border-radius: 4px; cursor: pointer;
  font-size: 14px;
}
button:hover { background: #2980b9; }
.btn-secondary {
  display: inline-block; padding: 10px 16px;
  background: #ecf0f1; color: #2c3e50; text-decoration: none;
  border-radius: 6px; text-align: center;
}
.btn-secondary:hover { background: #d5dbdb; }

@media (max-width: 768px) {
  main { flex-direction: column; }
  #sidebar { width: 100%; max-height: 35vh; }
  #share-content { flex-direction: column; }
  #share-sidebar { width: 100%; }
  #share-map { height: 50vh; }
  .modal-content { min-width: unset; width: 95%; }
  #search-box { width: calc(100% - 30px); }
}
