:root {
  --green: #2d6a4f;
  --green-light: #40916c;
  --green-pale: #d8f3dc;
  --green-dark: #1b4332;
  --accent: #f77f00;
  --accent-light: #ffd166;
  --bg: #f8f9f4;
  --white: #ffffff;
  --text: #1a1a2e;
  --text-light: #555;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(0,0,0,0.10);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── HEADER ── */
header {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
  color: white;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  position: sticky;
  top: 0;
  z-index: 100;
}

header .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: white;
}

header .brand .logo-icon { font-size: 2rem; }

header .brand .logo-img {
  height: 52px;
  width: auto;
  filter: brightness(0) invert(1);
  display: block;
}

header .brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

header .brand p {
  font-size: 0.75rem;
  opacity: 0.8;
}

header nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  transition: background 0.2s;
}
header nav a:hover { background: rgba(255,255,255,0.15); color: white; }

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-light) 100%);
  color: white;
  text-align: center;
  padding: 3.5rem 1.5rem 4rem;
}
.hero h2 { font-size: 2.2rem; font-weight: 800; margin-bottom: 0.75rem; }
.hero p { font-size: 1.1rem; opacity: 0.88; max-width: 500px; margin: 0 auto; }

/* ── CONTAINER ── */
.container { max-width: 960px; margin: 0 auto; padding: 2rem 1.25rem; }

/* ── SECTION TITLE ── */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── EVENTS GRID ── */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.25rem;
}

.event-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.event-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.event-card .card-image {
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  position: relative;
}
.event-card .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.event-card .no-img {
  width: 100%;
  aspect-ratio: 9 / 16;
  background: linear-gradient(135deg, var(--green-pale), var(--green-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
}
.event-card .card-body { padding: 1rem 1.1rem 1.25rem; flex: 1; display: flex; flex-direction: column; }
.event-card .card-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}
.event-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.4rem; line-height: 1.3; }
.event-card p { font-size: 0.85rem; color: var(--text-light); flex: 1; }
.event-card .card-footer {
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.event-card .price-badge {
  background: var(--accent-light);
  color: var(--green-dark);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}
.event-card .spots-badge {
  font-size: 0.78rem;
  color: var(--text-light);
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}
.empty-state .icon { font-size: 3.5rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 1rem; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: filter 0.2s, transform 0.15s;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--green); color: white; }
.btn-accent  { background: var(--accent); color: white; }
.btn-outline { background: transparent; border: 2px solid var(--green); color: var(--green); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1.05rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-danger { background: #e63946; color: white; }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-size: 1.2rem; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: var(--text-light); line-height: 1;
  padding: 0.2rem 0.4rem; border-radius: 6px;
}
.modal-close:hover { background: #f0f0f0; }

.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #eee;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ── FORMS ── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.form-group label span { color: #e63946; }

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #ddd;
  border-radius: 9px;
  font-size: 0.95rem;
  font-family: inherit;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--text);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.12);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ── EVENT DETAIL PAGE ── */
.event-detail-hero-wrap {
  width: 100%;
  max-width: 420px;
  margin: 0 auto 1.75rem;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 9 / 16;
  box-shadow: var(--shadow);
}
.event-detail-hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.event-detail-hero-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--green-pale), var(--green-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.meta-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--green-pale);
  color: var(--green-dark);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.event-description {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-light);
  margin-bottom: 1.5rem;
  white-space: pre-wrap;
}

/* ── REGISTRATION CARD ── */
.registration-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-top: 2rem;
}
.registration-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--green-pale);
}

/* ── PAYMENT SECTION ── */
.payment-section {
  background: var(--green-pale);
  border-radius: 10px;
  padding: 1.25rem;
  margin: 1.25rem 0;
}
.payment-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 0.75rem;
}
.payment-methods { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.payment-btn {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}
.payment-btn.paypal  { background: #ffc439; border-color: #f0b830; color: #111; }
.payment-btn.satispay { background: #e8003d; color: white; }
.payment-btn.bonifico { background: #4361ee; color: white; }
.payment-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* ── ADMIN ── */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

.admin-sidebar {
  background: var(--green-dark);
  border-radius: var(--radius);
  padding: 1.25rem;
  height: fit-content;
  color: white;
}
.admin-sidebar h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.6;
  margin-bottom: 0.75rem;
}
.admin-sidebar nav a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 9px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.2s;
  margin-bottom: 0.2rem;
}
.admin-sidebar nav a:hover, .admin-sidebar nav a.active {
  background: rgba(255,255,255,0.15);
  color: white;
}

.admin-main { min-width: 0; }

.admin-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}
.admin-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--green-dark);
}

/* ── REGISTRATIONS TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  background: var(--green-pale);
  color: var(--green-dark);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
td { padding: 0.65rem 0.75rem; border-bottom: 1px solid #f0f0f0; }
tr:hover td { background: #fafafa; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-paid    { background: #d8f3dc; color: var(--green-dark); }
.badge-pending { background: #fff3cd; color: #8a6200; }
.badge-free    { background: #e0f0ff; color: #004a8f; }

/* ── LOGIN ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-dark), var(--green-light));
  padding: 1rem;
}
.login-box {
  background: white;
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  text-align: center;
}
.login-box .icon { font-size: 3rem; margin-bottom: 0.75rem; }
.login-box h1 { font-size: 1.4rem; font-weight: 800; color: var(--green-dark); margin-bottom: 0.3rem; }
.login-box p { color: var(--text-light); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* ── ALERT ── */
.alert {
  padding: 0.85rem 1rem;
  border-radius: 9px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.alert-success { background: #d8f3dc; color: var(--green-dark); border-left: 4px solid var(--green); }
.alert-error   { background: #fde8e8; color: #c00; border-left: 4px solid #e63946; }
.alert-info    { background: #e0f0ff; color: #004a8f; border-left: 4px solid #4361ee; }

/* ── UPLOAD AREA ── */
.upload-area {
  border: 2px dashed #ccc;
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--green);
  background: var(--green-pale);
}
.upload-area input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-preview { max-width: 100%; max-height: 180px; border-radius: 8px; margin-top: 0.75rem; }

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: var(--green-dark);
  color: white;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease;
  display: flex; align-items: center; gap: 0.5rem;
  min-width: 240px;
}
.toast.error { background: #e63946; }
@keyframes slideIn {
  from { transform: translateX(80px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .hero h2 { font-size: 1.6rem; }
  .admin-layout { grid-template-columns: 1fr; margin-bottom: 80px; }
  .admin-sidebar { display: none; }
  .form-row { grid-template-columns: 1fr; }
  header .brand h1 { font-size: 1rem; }
  header .logo-img { height: 40px; }
  header nav { gap: 0; }
  header nav a { padding: 0.35rem 0.5rem; font-size: 1.15rem; line-height: 1; }
  header nav a .nav-txt { display: none; }
}

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--green-dark);
  z-index: 150;
  padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(0,0,0,0.2);
}

.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  flex: 1;
  padding: 0.3rem 0;
  border-radius: 8px;
  transition: color 0.2s;
}
.mobile-nav a .nav-icon { font-size: 1.4rem; }
.mobile-nav a.active, .mobile-nav a:hover { color: white; }
.mobile-nav-inner { display: flex; }

@media (max-width: 640px) {
  .mobile-nav { display: block; }
}
