/* Intermap Styles */

.intermap-container {
  padding: 24px;
  max-width: 100%;
  margin: 0 auto;
}

.intermap-container h2 {
  margin-bottom: 20px;
  color: #1f2937;
}

.intermap-toolbar {
  background: white;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Map selector row */
.map-selector-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.map-selector-row label {
  font-weight: 600;
  color: #4b5563;
  font-size: 14px;
}

.map-select {
  flex: 1;
  max-width: 300px;
  padding: 8px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
}

.map-select:hover {
  border-color: #3b82f6;
}

.map-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Compact buttons */
.compact-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: #f3f4f6;
  color: #374151;
  transition: all 0.2s;
  white-space: nowrap;
}

.compact-btn:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}

.compact-btn.primary {
  background: #3b82f6;
  color: white;
}

.compact-btn.primary:hover {
  background: #2563eb;
}

.compact-btn.delete-btn {
  background: #ef4444;
  color: white;
  padding: 8px 12px;
}

.compact-btn.delete-btn:hover {
  background: #dc2626;
}

.compact-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Marker controls row */
.marker-controls-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-group label {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
}

.compact-select {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
}

.compact-select:hover {
  border-color: #3b82f6;
}

.compact-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.compact-select:disabled {
  background: #f9fafb;
  cursor: not-allowed;
  opacity: 0.6;
}

.marker-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.click-instruction {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
}

/* Content area */
.intermap-content {
  display: block;
}

.map-view {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-placeholder {
  color: #9ca3af;
  font-style: italic;
  text-align: center;
}

.map-container {
  position: relative;
  width: 100%;
  height: 700px;
  overflow: hidden;
  border-radius: 8px;
  background: #f9fafb;
}

.map-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: center center;
  transition: transform 0.1s ease-out;
}

.map-image {
  width: 100%;
  height: auto;
  display: block;
  cursor: crosshair;
  border-radius: 8px;
  user-select: none;
}

.map-markers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  padding-bottom: 100%; /* Will be overridden by JS */
  pointer-events: none;
}

.map-marker {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: all;
  cursor: grab;
  transition: transform 0.2s;
  user-select: none;
}

.map-marker:active {
  cursor: grabbing;
}

.map-marker:hover {
  transform: translate(-50%, -100%) scale(1.2);
  z-index: 10;
}

.marker-icon {
  font-size: 32px;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
  animation: markerPulse 2s infinite;
}

@keyframes markerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.map-marker.project-marker .marker-icon {
  filter: drop-shadow(2px 2px 4px rgba(59, 130, 246, 0.5));
}

.map-marker.task-marker .marker-icon {
  filter: drop-shadow(2px 2px 4px rgba(239, 68, 68, 0.5));
}

.marker-tooltip {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.map-marker:hover .marker-tooltip {
  opacity: 1;
}

.marker-hover-info {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(31, 41, 55, 0.95);
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.map-marker:hover .marker-hover-info {
  opacity: 1;
}

.marker-delete-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  border: 2px solid white;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.map-marker:hover .marker-delete-btn {
  display: flex;
}

.marker-delete-btn:hover {
  background: #dc2626;
}

.marker-panel {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 24px;
  height: fit-content;
  position: sticky;
  top: 20px;
}

.marker-panel h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #1f2937;
}

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #4b5563;
  font-size: 14px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-help {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.marker-instructions {
  background: #f0f9ff;
  border-left: 4px solid #3b82f6;
  padding: 12px;
  border-radius: 6px;
  margin: 16px 0;
}

.marker-instructions p {
  margin: 4px 0;
  font-size: 13px;
  color: #1e40af;
}

#selectedPosition {
  font-weight: 600;
  color: #059669;
}

.primary-btn,
.secondary-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-bottom: 8px;
}

.primary-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-btn {
  background: #f3f4f6;
  color: #4b5563;
}

.secondary-btn:hover {
  background: #e5e7eb;
}

/* Marker Context Menu */
.marker-context-menu {
  position: absolute;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  padding: 16px;
  z-index: 10000;
  min-width: 280px;
  border: 1px solid #e5e7eb;
}

.context-menu-header {
  font-weight: 600;
  font-size: 15px;
  color: #1f2937;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}

.context-menu-section {
  margin-bottom: 16px;
}

.context-menu-section label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 8px;
}

.context-menu-colors {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.color-option {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-option:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.color-option.selected {
  border-color: #3b82f6;
  transform: scale(1.15);
  box-shadow: 0 0 0 2px white, 0 0 0 4px #3b82f6;
}

.context-menu-icons {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.icon-option {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  background: #f9fafb;
}

.icon-option:hover {
  background: #e5e7eb;
  transform: scale(1.1);
}

.icon-option.selected {
  border-color: #3b82f6;
  background: #dbeafe;
  transform: scale(1.15);
}

.context-menu-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.context-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: #f3f4f6;
  color: #4b5563;
}

.context-btn:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}

.context-btn.primary {
  background: #3b82f6;
  color: white;
}

.context-btn.primary:hover {
  background: #2563eb;
}

/* Rotation Controls */
.rotation-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: 16px;
  padding-left: 16px;
  border-left: 2px solid #e5e7eb;
}

.rotation-controls button {
  width: 36px;
  height: 36px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.rotation-controls button:hover {
  background: #f3f4f6;
  border-color: #3b82f6;
  transform: scale(1.05);
}

.rotation-controls button:active {
  transform: scale(0.95);
}

/* Smooth rotation transition for map */
#mapWrapper {
  transition: transform 0.3s ease;
}

/* Responsive */
@media (max-width: 1024px) {
  .intermap-content {
    grid-template-columns: 1fr;
  }
  
  .marker-panel {
    position: static;
  }
}

@media (max-width: 768px) {
  .intermap-container {
    padding: 16px;
  }
  
  .map-selector {
    flex-direction: column;
    align-items: stretch;
  }
  
  .map-select {
    width: 100%;
  }
}
