/* All Popup Related Styles */

/* Character popup styling */
.character-popup {
  max-width: 300px;
  font-size: 14px;
  line-height: 1.4;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.character-popup img {
  border: 2px solid #ddd;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}

.character-popup img:hover {
  transform: scale(1.05);
}

.character-popup div {
  margin-bottom: 6px;
  word-wrap: break-word;
}

.character-popup div:last-child {
  margin-bottom: 0;
}

/* Enhanced Character Focus Popup Styles */
.character-focus-popup .leaflet-popup-content-wrapper {
  background: var(--popup-bg);
  border: 2px solid var(--dropdown-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  min-width: 280px;
  max-width: 350px;
  padding: 0;
}

.character-focus-popup .leaflet-popup-content {
  margin: 16px;
  line-height: 1.4;
  color: var(--text-color);
  font-size: 14px;
}

.character-focus-popup .leaflet-popup-tip {
  background: var(--popup-bg);
  border: 2px solid var(--dropdown-border);
  width: 12px;
  height: 12px;
}

.character-focus-popup .leaflet-popup-close-button {
  color: var(--text-muted);
  font-size: 18px;
  font-weight: bold;
  padding: 8px;
  width: 32px;
  height: 32px;
  text-align: center;
  line-height: 16px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.character-focus-popup .leaflet-popup-close-button:hover {
  background: var(--dropdown-hover);
  color: var(--text-color);
  text-decoration: none;
}

/* Enhanced popup positioning */
.character-focus-popup.leaflet-popup {
  z-index: 1002 !important;
}

/* Enhanced Location Popup Styles - Match Character Popup Design */
.custom-popup .leaflet-popup-content-wrapper {
  background: var(--popup-bg);
  border: 2px solid var(--dropdown-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  min-width: 280px;
  max-width: 400px;
  padding: 0;
}

.custom-popup .leaflet-popup-content {
  margin: 16px;
  line-height: 1.4;
  color: var(--text-color);
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.custom-popup .leaflet-popup-tip {
  background: var(--popup-bg);
  border: 2px solid var(--dropdown-border);
  width: 12px;
  height: 12px;
}

.custom-popup .leaflet-popup-close-button {
  color: var(--text-muted);
  font-size: 18px;
  font-weight: bold;
  padding: 8px;
  width: 32px;
  height: 32px;
  text-align: center;
  line-height: 16px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.custom-popup .leaflet-popup-close-button:hover {
  background: var(--dropdown-hover);
  color: var(--text-color);
  text-decoration: none;
}

/* Enhanced positioning for location popups */
.custom-popup.leaflet-popup {
  z-index: 1002 !important;
}

/* Location popup specific styling */
.custom-popup .popup-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--dropdown-border);
}

.custom-popup .popup-title {
  font-size: 18px;
  font-weight: bold;
  color: #6366f1;
  margin: 0;
}

.custom-popup .popup-title-with-image {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-content: space-between;
}

.custom-popup .popup-title-with-image .popup-title {
  flex: 1;
  margin: 0;
}

.custom-popup .popup-title-with-image .popup-image-container {
  flex-shrink: 0;
  margin: 0;
}

.custom-popup .popup-desc {
  line-height: 1.5;
  color: var(--text-color);
  margin-bottom: 0;
}

[data-theme="dark"] .custom-popup .popup-title {
  color: #8b5cf6;
}

[data-theme="dark"] .custom-popup .popup-desc {
  color: var(--text-color);
}

/* Location meta information (type and region) */
.popup-meta {
  font-size: 12px;
  color: #666;
  margin: 5px 0 10px 0;
  line-height: 1.4;
}

.popup-type, .popup-region {
  font-weight: 500;
}

[data-theme="dark"] .popup-meta {
  color: #aaa;
}

/* Location image preview - updated for title placement */
.popup-image-container {
  text-align: center;
}

.popup-location-image {
  max-width: 80px;
  max-height: 60px;
  width: auto;
  height: auto;
  border-radius: 6px;
  border: 2px solid var(--dropdown-border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  object-fit: cover;
}

.popup-location-image:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  border-color: #6366f1;
}

[data-theme="dark"] .popup-location-image {
  border-color: var(--dropdown-border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .popup-location-image:hover {
  border-color: #8b5cf6;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* Character lists in popups */
.popup-characters {
  margin-top: 10px;
}

.character-list-section {
  margin-bottom: 8px;
}

.character-list-button {
  width: 100%;
  padding: 10px 12px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #495057;
  transition: all 0.2s ease;
}

.character-list-button:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  transform: translateY(-1px);
}

.character-list-icon {
  font-size: 16px;
}

.character-list-text {
  flex: 1;
  text-align: left;
}

.character-list-arrow {
  font-weight: bold;
  color: #6c757d;
}

/* Panel-Anchored Character Popup */
.panel-anchored-popup {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 300px;
  max-width: 400px;
  font-family: sans-serif;
  font-size: 14px;
  margin-left: 10px;
}

.panel-popup-header {
  padding: 15px 20px 10px 20px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.panel-popup-header h3 {
  margin: 0;
  color: #495057;
  font-size: 18px;
  font-weight: bold;
}

.panel-popup-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #6c757d;
  padding: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  position: relative;
}

.panel-popup-close:hover {
  background: #f8f9fa;
  color: #343a40;
  transform: scale(1.05);
}

.panel-popup-close:active {
  transform: scale(0.95);
}

.panel-popup-content {
  padding: 20px;
  line-height: 1.5;
}

.character-popup-header-info {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
}

.character-popup-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #dee2e6;
  flex-shrink: 0;
}

.character-popup-details {
  flex: 1;
}

.character-popup-title {
  font-style: italic;
  color: #6c757d;
  margin-bottom: 5px;
}

.character-popup-status,
.character-popup-relationship,
.character-popup-location {
  margin-bottom: 5px;
  font-size: 13px;
}

.location-unknown {
  color: #dc3545;
  font-style: italic;
}

.character-popup-faction,
.character-popup-met,
.character-popup-notes,
.character-popup-description,
.character-popup-origin,
.character-popup-movement,
.character-popup-dates {
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #007bff;
}

.character-popup-description {
  border-left-color: #28a745;
}

.character-popup-notes {
  border-left-color: #ffc107;
}

.character-popup-origin {
  border-left-color: #6f42c1;
}

.character-popup-movement {
  border-left-color: #fd7e14;
}

.character-popup-dates {
  border-left-color: #6c757d;
  font-size: 12px;
  opacity: 0.8;
}

.popup-details {
  margin-top: 0.75rem;
}

.popup-detail {
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

/* Dark theme popup support */
[data-theme="dark"] .character-popup {
  color: #f0f0f0;
}

[data-theme="dark"] .character-popup img {
  border-color: var(--dropdown-border);
}

[data-theme="dark"] .character-focus-popup .leaflet-popup-content-wrapper {
  background: var(--popup-bg);
  color: var(--text-color);
  border-color: var(--dropdown-border);
}

[data-theme="dark"] .character-focus-popup .leaflet-popup-tip {
  background: var(--popup-bg);
  border-color: var(--dropdown-border);
}

[data-theme="dark"] .character-focus-popup .leaflet-popup-close-button {
  color: var(--text-muted);
}

[data-theme="dark"] .character-focus-popup .leaflet-popup-close-button:hover {
  background: var(--dropdown-hover);
  color: var(--text-color);
}

[data-theme="dark"] .character-list-button {
  background: #495057;
  border-color: #6c757d;
  color: #f8f9fa;
}

[data-theme="dark"] .character-list-button:hover {
  background: #5a6268;
  border-color: #adb5bd;
}

[data-theme="dark"] .panel-anchored-popup {
  background: #343a40;
  border-color: #6c757d;
  color: #f8f9fa;
}

[data-theme="dark"] .panel-popup-header {
  background: #495057;
  border-color: #6c757d;
}

[data-theme="dark"] .panel-popup-header h3 {
  color: #f8f9fa;
}

[data-theme="dark"] .panel-popup-close {
  color: #adb5bd;
}

[data-theme="dark"] .panel-popup-close:hover {
  background: #495057;
  color: #f8f9fa;
}

[data-theme="dark"] .character-popup-faction,
[data-theme="dark"] .character-popup-met,
[data-theme="dark"] .character-popup-notes,
[data-theme="dark"] .character-popup-description,
[data-theme="dark"] .character-popup-origin,
[data-theme="dark"] .character-popup-movement,
[data-theme="dark"] .character-popup-dates {
  background: #495057;
  color: #f8f9fa;
}
