/* =============================================================================
   CSS Custom Properties (Variables)
   ============================================================================= */
:root {
  /* Colors */
  --color-background: #ffffff;
  --color-text: #2b2118;
  --color-primary: #ffaa00;
  
  /* Spacing */
  --space-extra-small: 0.5rem;
  --space-small: 1rem;
  --space-medium: 2rem;
  --space-large: 3rem;
  
  /* Typography */
  --font-size-small: 0.75rem;
  --font-size-medium: 1.0rem;
  --font-size-large: 1.5rem;
  --font-size-extra-large: 2.5rem;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 600;
  
  /* Layout */
  --radius: 30px;
  --container-max-width: 800px;
  --transition: 1.2s ease;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 5px 15px var(--color-text);
  
  /* Filters */
  --filter-map: contrast(1.1) brightness(0.95) saturate(0.6) hue-rotate(320deg);
  
  /* Fog */
  --fog-height: 30px;
}

/* =============================================================================
   Reset & Base Styles
   ============================================================================= */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: 'Spectral', serif;
}

/* =============================================================================
   Atmospheric Effects
   ============================================================================= */
body::before, body::after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  height: var(--fog-height);
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
  pointer-events: none;
  z-index: 1000;
}

body::before {
  top: 0;
}

body::after {
  bottom: 0;
  transform: rotate(180deg);
}

/* =============================================================================
   Success Overlay
   ============================================================================= */
.success-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-message {
  text-align: center;
  padding: var(--space-large);
  background: var(--color-background);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  animation: fadeInDown 0.5s ease-out;
}

.success-message h2 {
  color: var(--color-primary);
  font-size: var(--font-size-large);
  margin-bottom: var(--space-small);
}

.success-message p {
  color: var(--color-text);
  font-size: var(--font-size-medium);
  margin: 0;
}

/* =============================================================================
   Layout Components
   ============================================================================= */
.page-padding {
  padding: var(--space-large) var(--space-small);
}

.container-single {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0;
  background: var(--color-background);
  border: 1px solid var(--color-background);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.container-single:hover {
  box-shadow: var(--shadow-hover);
}

/* =============================================================================
   Media Components
   ============================================================================= */
.media-full {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  animation: fadeInDown 1s ease-out;
}

.media-img {
  display: block;
  width: 100%;
  height: 400px;
  object-fit: cover;
  transition: transform var(--transition);
}

.media-full:hover .media-img {
  transform: scale(1.125);
}

.media-full::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255, 170, 0, 0.1) 100%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
  border-radius: var(--radius);
}

.media-full:hover::after {
  opacity: 1;
}

/* =============================================================================
   Content Structure
   ============================================================================= */
.event-body {
  position: relative;
  padding: var(--space-medium) var(--space-medium) 0 var(--space-medium);
  animation: fadeInDown 1s ease-out;
}

/* =============================================================================
   Map Component
   ============================================================================= */
.event-map {
  border-radius: var(--radius);
  overflow: hidden;
}

#map {
  width: 100%;
  height: 400px;
  display: block;
  filter: var(--filter-map);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
  border-radius: var(--radius);
}

/* =============================================================================
   Form Styles
   ============================================================================= */
.form-section {
  margin-bottom: var(--space-medium);
}

.form-group {
  margin-bottom: var(--space-medium);
}

.form-row {
  display: flex;
  gap: var(--space-medium);
}

.form-row .form-group {
  flex: 1;
}

/* Section Labels */
.location-label,
.contacts-label {
  display: block;
  margin-bottom: var(--space-small);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  font-size: var(--font-size-medium);
}

/* Input Fields */
input[type="text"],
input[type="date"],
textarea {
  width: 100%;
  padding: var(--space-small);
  border: 1px solid var(--color-text);
  border-radius: var(--radius);
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: 'Spectral', serif;
  font-size: var(--font-size-medium);
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(255, 170, 0, 0.2);
}

/* Error states */
input.error,
textarea.error {
  border-color: #ff4444;
  box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.2);
}

/* Error messages */
.error-message {
  color: #ff4444;
  font-size: var(--font-size-small);
  margin-top: var(--space-extra-small);
  display: none;
}

.error-message.show {
  display: block;
}

/* Placeholder styling */
input::placeholder,
textarea::placeholder {
  color: rgba(43, 33, 24, 0.5);
  font-style: italic;
}

/* Textarea specific */
textarea {
  resize: vertical;
  min-height: 60px;
}

/* Custom File Input */
.file-input-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-input-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-small);
  border: 1px solid var(--color-text);
  border-radius: var(--radius);
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: 'Spectral', serif;
  font-size: var(--font-size-medium);
  box-shadow: var(--shadow);
  transition: all var(--transition);
  cursor: pointer;
}

.file-input-label:hover {
  border-color: var(--color-primary);
}

.file-input-text {
  color: rgba(43, 33, 24, 0.5);
  font-style: italic;
}

.file-input-button {
  padding: var(--space-extra-small) var(--space-small);
  background-color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: calc(var(--radius) / 2);
  color: var(--color-background);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-medium);
}

/* When file is selected */
.file-input-wrapper input[type="file"]:valid + .file-input-label .file-input-text {
  color: var(--color-text);
  font-style: normal;
}

/* Contact Rows */
.contact-row {
  display: flex;
  gap: var(--space-medium);
  align-items: center;
}

.contact-row input:first-child {
  flex: 0 0 200px;
}

.contact-row input:nth-child(2) {
  flex: 1;
}

.contact-group {
  margin-bottom: var(--space-medium);
}

.contact-hidden {
  display: none;
}

/* Image Rows */
.image-row {
  display: flex;
  gap: var(--space-medium);
  align-items: center;
  margin-bottom: var(--space-medium);
}

.image-row .file-input-wrapper {
  flex: 1;
}

.image-hidden {
  display: none;
}

.image-preview {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: var(--space-medium);
}

.preview-img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
}

/* Button Centering */
.button-center {
  display: flex;
  justify-content: center;
}

/* Buttons */
.add-contact-btn,
.remove-contact-btn,
.add-image-btn,
.remove-image-btn {
  width: 40px;
  height: 40px;
  background-color: var(--color-background);
  border: 1px solid var(--color-text);
  border-radius: 50%;
  color: var(--color-text);
  font-family: 'Spectral', serif;
  font-size: var(--font-size-large);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.add-contact-btn:hover,
.add-image-btn:hover {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-background);
}

.remove-contact-btn,
.remove-image-btn {
  flex: 0 0 auto;
  background-color: var(--color-background);
  border-color: var(--color-text);
  color: var(--color-text);
}

.remove-contact-btn:hover,
.remove-image-btn:hover {
  background-color: var(--color-text);
  border-color: var(--color-text);
  color: var(--color-background);
}

.submit-btn {
  padding: var(--space-small) var(--space-medium);
  background-color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  color: var(--color-background);
  font-family: 'Spectral', serif;
  font-size: var(--font-size-medium);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.submit-btn:hover {
  background-color: var(--color-text);
  border-color: var(--color-text);
}

/* Thumbnail Preview */
#thumbnail-preview {
  margin-bottom: 0;
}

#thumbnail-preview.show {
  display: block !important;
}

/* =============================================================================
   Animations
   ============================================================================= */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-section {
  animation: fadeInDown 0.6s ease-out;
}

/* =============================================================================
   Third-party Overrides
   ============================================================================= */
.leaflet-control-attribution, 
.leaflet-popup-close-button,
.leaflet-control-zoom {
  display: none !important;
}

.leaflet-tile {
  border-radius: 0 !important;
  image-rendering: pixelated;
  object-fit: contain !important;
}

/* Custom popup that looks exactly like event-badge */
.custom-popup .leaflet-popup-content-wrapper {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.custom-popup .leaflet-popup-tip {
  display: none !important;
}

.map-popup-badge {
  padding: var(--space-extra-small) var(--space-small);
  background-color: var(--color-background);
  border: 1px solid var(--color-text);	
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-normal);
  box-shadow: var(--shadow);
  transition: all var(--transition);
  white-space: nowrap;
}

/* =============================================================================
   Responsive Design
   ============================================================================= */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: var(--space-small);
  }
  
  .contact-row,
  .image-row {
    flex-direction: column;
    gap: var(--space-extra-small);
  }
  
  .contact-row input:first-child,
  .contact-row input:nth-child(2) {
    flex: none;
    width: 100%;
  }
  
  .image-row .file-input-wrapper {
    flex: none;
    width: 100%;
  }
  
  .remove-contact-btn,
  .remove-image-btn {
    width: 100%;
    border-radius: var(--radius);
    height: auto;
    padding: var(--space-extra-small);
  }
}

@media print {
  body::before, body::after {
    display: none;
  }
  
  .container-single {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
