/* File: assets/css/grape-maps.css */

/* Hide the meta box header and handle icon */
#grape_map_pins .postbox-header,
#grape_map_pins .handlediv {
  display: none !important;
}
#grape_map_pins .hndle {
  cursor: default !important;
}

/* Default View Settings title */
.grape-default-view-title strong {
  font-size: 1.25rem !important;
  margin-bottom: 0.5em;
}

/* Default View Settings flex row */
.grape-default-view-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.grape-default-view-settings label {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  margin: 0;
}

/* Fluid inputs for lat/lng/zoom */
.grape-default-view-settings input[type="text"],
.grape-default-view-settings input[type="number"] {
  flex: 1 1 5em;
  min-width: 4em;
  max-width: 9em;
  padding: 0 0.5em;
  height: 2em;
  line-height: 2em;
  box-sizing: border-box;
}

/* Button stays inline */
.grape-default-view-settings button#grape-set-view {
  flex: 0 0 auto;
  padding: 0 0.75em;
  height: 2em;
  line-height: 2em;
}

/* Embed Shortcode Section */
.grape-embed-shortcode {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.grape-embed-shortcode input[type="text"] {
  width: 250px;
  max-width: 100%;
  height: 2em;
  line-height: 2em;
  padding: 0 0.75em;
  box-sizing: border-box;
}
.grape-embed-shortcode button {
  height: 2em;
  line-height: 2em;
  padding: 0 0.75em;
}

/* Stack on small screens */
@media (max-width: 480px) {
  .grape-default-view-settings,
  .grape-embed-shortcode {
    flex-direction: column;
    align-items: stretch;
  }
  .grape-default-view-settings label,
  .grape-default-view-settings button,
  .grape-embed-shortcode input,
  .grape-embed-shortcode button {
    width: 100%;
  }
}

/* Basic map container */
.grape-map-container {
  position: relative;
  width: 100%;
}
.grape-map {
  width: 100%;
  height: 100%;
}

/* Leaflet popup styling */

.leaflet-popup-content-wrapper {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.leaflet-popup-content {
  margin: 0;
  padding: 6px 12px;
}

.leaflet-popup-tip-container {
  width: 20px;
  height: 10px;
}

.leaflet-popup-tip {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* gm-popup inner content */
.leaflet-popup-content .gm-popup-content {
  padding: 4px 0;             /* malo vertikalnog “zračnog razmaka” */
  font-family: sans-serif;
}

.leaflet-popup-content .gm-popup-title {
  font-size: 1.1em;
  font-weight: bold;
  margin-bottom: 4px;
  color: #222;
}

.leaflet-popup-content .gm-popup-image img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 4px 0;
  border-radius: 3px;
}

.leaflet-popup-content .gm-popup-description {
  font-size: 0.9em;
  color: #444;
  margin-bottom: 4px;
}

.leaflet-popup-content .gm-popup-link a {
  font-size: 0.9em;
  color: #0073aa;
  text-decoration: none;
  border-bottom: 1px dashed #0073aa;
}
.leaflet-popup-content .gm-popup-link a:hover {
  color: #005177;
  border-color: #005177;
}

/* Instruction highlight */
.grape-pin-instructions {
  background: #fffbe6;
  border-left: 4px solid #ffc107;
  padding: 8px 12px;
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.4;
  color: #333;
}

/* Edit Default View overlay */
#grape-map-picker .view-edit-overlay {
  pointer-events: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 3px dashed #FF6600;
  box-sizing: border-box;
  z-index: 500;
}
#grape-map-picker.editing::before {
  content: "DEFAULT VIEW EDIT MODE";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: #FF6600;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  z-index: 1001;
}

/* Admin Pin List Styling */
#grape-pins-list {
  margin-top: 1em;
}
.grape-pin-item {
  position: relative;
  padding: 10px;
  border: 1px solid #e1e1e1;
  border-radius: 4px;
  margin-bottom: 10px;
  background: #fafafa;
}
.grape-pin-item .pin-header {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: 8px;
  gap: 8px;
}
.grape-pin-item .pin-header .toggle-icon {
  font-size: 1.2rem;
}
.grape-pin-item .pin-header strong {
  font-size: 1.25rem;
  flex: 1;
}
.grape-pin-item .pin-header .remove-pin {
  background: transparent;
  border: none;
  color: #a00;
  font-size: 0.9rem;
  cursor: pointer;
}
.grape-pin-item.collapsed .pin-body {
  display: none;
}

/* Latitude & Longitude row inside each pin */
.grape-pin-item .latlng-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.grape-pin-item .latlng-row label {
  flex: 1;
}
.grape-pin-item .latlng-row input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
}

/* Color picker & code row */
.pin-color-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.pin-color-row label {
  margin: 0;
}
.pin-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}
.pin-color-code {
  width: 6em;
  padding: 0.25em;
  box-sizing: border-box;
}
.pin-color-picker {
  width: 4em;
  height: 2em;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

/* Other fields full-width stacked below */
.grape-pin-item label:not(.latlng-row label):not(.pin-color-row) {
  display: block;
  width: 100%;
  margin-top: 10px;
}
.grape-pin-item label:not(.latlng-row label):not(.pin-color-row) input,
.grape-pin-item label:not(.latlng-row label):not(.pin-color-row) textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 3px;
  margin-top: 4px;
}
.grape-pin-item label:not(.latlng-row label):not(.pin-color-row) textarea {
  resize: vertical;
  min-height: 80px;
}

/* Force bold popup titles with highest specificity */
.leaflet-container .leaflet-popup-content-wrapper .leaflet-popup-content .gm-popup-content .gm-popup-title {
  font-weight: bold !important;
  font-size: 1.2em !important;
  color: #333 !important;
}

/* Zoom hint control */
.leaflet-control-zoom-hint {
  background: rgba(255,255,255,0.8);
  padding: 4px 8px;
  font-size: 12px;
  color: #333;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* Highlight any collapsed pin missing its title */
.grape-pin-item.error-highlight {
  border-color: #d00 !important;
  background: #fee !important;
}
.grape-pin-item.error-highlight .pin-header strong {
  color: #d00 !important;
}
