:root {
  --color-bg: #FDFBF9;
  --color-surface: #FFFFFF;
  --color-primary: #C0552B;
  --color-primary-dark: #9C4321;
  --color-accent: #D9A441;
  --color-emphasis: #6E2C3D;
  --color-text: #3A2E28;
  --color-text-muted: #8A7A70;
  --color-border: #EDE2D8;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(60, 40, 20, 0.08);
  --font-heading: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--color-emphasis);
  margin: 0 0 0.5em;
}

a { color: var(--color-primary-dark); }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}
.logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: bold;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}
.main-nav a {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 600;
}
.lang-switch { display: flex; gap: 4px; }
.lang-switch a {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  color: var(--color-text-muted);
}
.lang-switch a.is-active { background: var(--color-accent); color: #fff; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.95rem;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline { background: transparent; border-color: var(--color-primary); color: var(--color-primary-dark); }
.btn-outline:hover { background: #fbeee6; }
.btn-toggle { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text-muted); }
.btn-toggle.is-active { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-primary-dark);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.link-btn-danger { color: #a83232; }

/* Search panel */
.search-panel { padding: 24px 0; }
.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.field[hidden] { display: none; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-grow { flex: 1 1 220px; }
.field-actions { flex-direction: row; gap: 10px; }
.field label { font-size: 0.8rem; color: var(--color-text-muted); font-weight: 600; }
.field input, .field select, .field textarea {
  padding: 9px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--color-text);
}
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 160px; }
.field-hint { font-size: 0.8rem; color: var(--color-text-muted); margin: 4px 0 0; }

.geo-status { margin-top: 10px; font-size: 0.9rem; color: var(--color-text-muted); }

/* Results */
.results-panel { padding: 10px 0 40px; }
.view-toggle { display: flex; gap: 8px; margin-bottom: 16px; }

.event-grid[hidden], .event-map[hidden] {
  display: none;
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.event-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.event-card:hover { transform: translateY(-2px); }
.event-card-link { text-decoration: none; color: inherit; display: block; }
.event-card-img { width: 100%; height: 160px; object-fit: cover; display: block; background: var(--color-border); }
.event-card-body { padding: 14px; }
.event-card-title { margin: 0 0 6px; font-size: 1.1rem; color: var(--color-emphasis); }
.event-card-meta { margin: 0 0 4px; color: var(--color-primary-dark); font-weight: 600; font-size: 0.9rem; }
.event-card-location { margin: 0; color: var(--color-text-muted); font-size: 0.85rem; }

.event-map, .event-map-single { height: 480px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--color-border); }
.event-map-single { height: 220px; margin: 10px 0 20px; }

/* Event-card popups on the map: the Leaflet chrome already supplies the
   rounded wrapper/shadow, so the card inside drops its own to avoid doubling up. */
.map-popup .leaflet-popup-content-wrapper { padding: 0; border-radius: var(--radius); overflow: hidden; }
.map-popup .leaflet-popup-content { margin: 0; }
.map-popup .leaflet-popup-tip-container { margin-top: -1px; }
.map-popup-card { border: none; box-shadow: none; border-radius: 0; }
.map-popup-card .event-card-img { height: 120px; }
.map-popup-card .event-card-body { padding: 10px 12px; }
.map-popup-card .event-card-title { font-size: 1rem; }
.map-popup .leaflet-popup-close-button {
  top: 6px; right: 6px; width: 22px; height: 22px; line-height: 20px;
  background: rgba(255,255,255,0.9); border-radius: 50%; text-align: center;
}

.empty-state { color: var(--color-text-muted); padding: 30px 0; }

/* Event detail */
.back-link { display: inline-block; margin-bottom: 16px; text-decoration: none; }
.event-detail-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; }
.event-detail-img { width: 100%; border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.event-detail-meta { color: var(--color-primary-dark); font-weight: 600; }
.event-detail-description { white-space: pre-line; margin: 16px 0; }
.event-detail-sidebar { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 18px; align-self: start; }
@media (max-width: 800px) {
  .event-detail-layout { grid-template-columns: 1fr; }
}

/* Admin */
.admin-bar { display: flex; align-items: center; justify-content: space-between; padding: 24px 0 10px; }
.admin-bar-actions { display: flex; align-items: center; gap: 12px; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.status-filter a { margin-right: 10px; text-decoration: none; color: var(--color-text-muted); font-weight: 600; padding: 6px 10px; border-radius: 6px; }
.status-filter a.is-active { background: var(--color-accent); color: #fff; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--color-border); text-align: left; font-size: 0.92rem; }
.admin-table th { background: #FBF3EC; color: var(--color-emphasis); }
.admin-row-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.badge-published { background: #E4F3E4; color: #2C6E31; }
.badge-draft { background: #F3ECD9; color: #8A6D1D; }
.badge-unpublished { background: #F3E1E1; color: #A83232; }

.admin-form { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); max-width: 720px; display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }
.current-locandina { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.current-locandina img { border-radius: 6px; border: 1px solid var(--color-border); }

.dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  background: #FBF3EC;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.is-dragover {
  border-color: var(--color-primary);
  background: #FBEEE6;
}
.dropzone-text {
  margin: 0 0 10px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.dropzone input[type="file"] {
  display: block;
  margin: 0 auto;
}
.dropzone-preview {
  max-width: 200px;
  border-radius: 6px;
  margin-top: 12px;
  border: 1px solid var(--color-border);
}

.autocomplete { position: relative; }
.autocomplete-list {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
}
.autocomplete-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.autocomplete-item:hover, .autocomplete-item.is-active {
  background: #FBEEE6;
}
.autocomplete-item-name { font-weight: 600; color: var(--color-emphasis); }
.autocomplete-item-meta { font-size: 0.8rem; color: var(--color-text-muted); }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-success { background: #E4F3E4; color: #2C6E31; }
.alert-error { background: #F8E3E3; color: #A83232; }
.alert ul { margin: 0; padding-left: 18px; }

/* Closing visual band — full-bleed, static (no parallax), bottom-anchored so
   the illustration's floor lines up with the edge just above the footer.
   Uses the dedicated full-resolution asset, not the compressed og-image. */
.site-tango-band {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-top: 48px;
  height: 340px;
  background-image: url('/assets/img/site-bg-valencia.jpg');
  background-position: bottom center;
  background-repeat: no-repeat;
  background-size: contain;
  background-attachment: scroll;
  min-height: 566px;
}
@media (max-width: 700px) {
  .site-tango-band { height: 180px; }
}

/* Footer */
.site-footer { padding: 30px 0; color: var(--color-text-muted); font-size: 0.85rem; border-top: 1px solid var(--color-border); margin-top: 40px; }
