/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Base font settings */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

/* Custom text shadow for banner headings */
.text-shadow-xl {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), 
               0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Custom banner header styles */
.banner-header {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 3.5rem; /* Reduced for better proportion */
  font-weight: 600; /* Medium weight for elegance */
  letter-spacing: 0.025em; /* Slightly reduced for elegance */
  color: white;
  text-align: center;
}

/* Farming Simulator 25 map image cropping */
.fs25-map {
  /* Using clip-path to crop the image and show only the center portion */
  /* For FS25 maps, we want to crop 25% from each side, leaving the center 50% visible */
  clip-path: inset(25% 25% 25% 25%) !important;
  
  /* Scale up to compensate for cropping (2.0 makes the center 50% fill the original space) */
  transform: scale(2.0) !important;
  
  /* Ensure the image is properly centered */
  transform-origin: center !important;
  
  /* Add smooth transition for better user experience */
  transition: all 0.3s ease-out;
  
  /* Ensure no jagged edges and maintain aspect ratio */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  
  /* Object positioning to help ensure center focus */
  object-position: center !important;
  object-fit: cover !important;
}

/* Custom toggle switch styles */
input[type="checkbox"]:checked + .toggle-dot {
  transform: translateX(1rem);
  background-color: #10B981; /* green-500 */
}

input[type="checkbox"] + .toggle-dot {
  transition: transform 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

.toggle-dot {
  transform: translateX(0);
}

/* Map Container Styles */
.map-container {
  position: relative;
  width: 100%;
  background-color: transparent; /* Transparent background */
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.map-square-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 100%; /* Creates square aspect ratio */
  overflow: hidden;
  background-color: #f3f4f6; /* Gray background only in the visible area */
}

/* Map image styling */
.server-map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background-color: transparent; /* Match the container background */
}

/* Field Marker Styles */
.field-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5; /* Very low z-index so vehicles/players appear on top */
  pointer-events: none; /* Prevent interaction */
  width: auto; /* Allow natural width */
  height: auto; /* Allow natural height */
  /* Fixed positioning will be set via JavaScript */
}

.field-number {
  color: white !important; /* Force white text color */
  font-size: 12px; /* Similar size to vehicle labels */
  font-weight: 600; /* Semi-bold for readability */
  text-shadow: 0 0 4px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,1); /* Strong text shadow for readability */
  letter-spacing: 0.5px; /* Improve legibility */
  font-family: 'Montserrat', -apple-system, sans-serif; /* Consistent font */
  background: none !important; /* No background as requested */
  border: none !important; /* No border */
}

/* Farm Legend - Made more responsive */
#farm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* Responsive design for farm legend */
@media (max-width: 640px) {
  #farm-legend {
    justify-content: center;
    margin-top: 8px;
    margin-bottom: 8px;
  }
  
  #farm-legend h3 {
    width: 100%;
    text-align: center;
    margin-bottom: 8px;
  }
}

/* Map Controls */
.map-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(22, 101, 52, 0.9); /* Green background matching the header */
  color: white;
  padding: 10px 15px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 180px; /* Fixed width to ensure proper display */
  max-width: 90%; /* Ensure it doesn't overflow on small screens */
}

/* Popup styling */
#map-marker-popup {
  position: absolute;
  background-color: white;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2), 0 2px 4px rgba(0,0,0,0.1);
  min-width: 240px;
  max-width: 320px;
  z-index: 9999; /* Ensure it's above all other elements */
  transition: opacity 0.2s, visibility 0.2s;
}

#map-marker-popup.hidden {
  opacity: 0;
  visibility: hidden;
}

#map-marker-popup:not(.hidden) {
  opacity: 1;
  visibility: visible;
  display: block;
}

/* Add indicator class to body when popup is shown */
body.popup-displayed #map-marker-popup {
  outline: 4px solid red; /* Debug outline */
}

/* Anchor styling for navigation targets */
.map-anchor {
  display: block;
  position: relative;
  top: -20px;
  visibility: hidden;
  height: 0;
}

/* Hash navigation highlight effects */
.map-header-highlight {
  outline: 2px solid rgba(74, 222, 128, 0.8) !important;
  outline-offset: 2px;
  transition: all 0.5s ease-out;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
  position: relative;
  z-index: 5;
}

/* Live map header special styling when active */
#live-map-header.map-header-highlight {
  background-color: rgb(6, 95, 70) !important; /* A deeper green */
  transition: background-color 0.5s ease-out, outline-color 0.5s ease-out, box-shadow 0.5s ease-out;
}

/* Active hash navigation target */
.active-hash-target {
  animation: pulse-highlight 2.5s ease-out;
}

@keyframes pulse-highlight {
  0% { 
    outline-color: rgba(74, 222, 128, 0.2); 
    box-shadow: 0 0 4px rgba(74, 222, 128, 0.2);
    transform: translateY(0);
  }
  5% { 
    transform: translateY(-2px);
  }
  10% { 
    transform: translateY(0);
  }
  50% { 
    outline-color: rgba(74, 222, 128, 0.8); 
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.6);
  }
  100% { 
    outline-color: rgba(74, 222, 128, 0.2); 
    box-shadow: 0 0 4px rgba(74, 222, 128, 0.2);
  }
}