/* ============================================================
   AGESCI ZONA CONCORDIA - Design System
   ============================================================ */

/* 1. DESIGN TOKENS
   ============================================================ */
:root {
  --c-primary:       #5B2D8E;
  --c-primary-light: #7C3FB5;
  --c-primary-dark:  #3D1E61;
  --c-primary-bg:    #EDE9F6;
  --c-accent:        #F5A623;
  --c-accent-bg:     #FEF3C7;
  --c-surface:       #F8F6FC;
  --c-text:          #1A1A2E;
  --c-muted:         #6B7280;
  --c-border:        rgba(91,45,142,.12);
  --c-success:       #16A34A;
  --c-danger:        #DC2626;
  --r-sm:   8px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-pill: 99px;
  --shadow-sm: 0 2px 8px rgba(91,45,142,.08);
  --shadow-md: 0 4px 16px rgba(91,45,142,.12);
  --shadow-lg: 0 8px 32px rgba(91,45,142,.18);
}

/* 2. BASE
   ============================================================ */
body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--c-text);
  background: var(--c-surface);
}

:focus-visible {
  outline: 3px solid var(--c-primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.opacity-65 { opacity: .65; }

/* 3. SKIP LINK
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--c-primary);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  font-weight: 700;
  font-size: 14px;
  z-index: 9999;
  text-decoration: none;
  transition: top .15s;
}
.skip-link:focus { top: 0; }

/* 4. NAVBAR PUBBLICA
   ============================================================ */
.navbar-public {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  padding: .75rem 0;
}
.navbar-public .navbar-brand {
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.1;
  text-decoration: none;
}
.navbar-public .brand-subtitle {
  color: rgba(255,255,255,.6);
  font-size: 11px;
  font-weight: 400;
  display: block;
}
.navbar-public .admin-link {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s;
}
.navbar-public .admin-link:hover {
  background: rgba(255,255,255,.25);
  color: #fff;
}

/* 5. NAVBAR ADMIN
   ============================================================ */
.navbar-admin {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
}
.navbar-admin .navbar-brand,
.navbar-admin .nav-link { color: rgba(255,255,255,.9); }
.navbar-admin .nav-link:hover { color: #fff; }
.navbar-admin .nav-link-active {
  color: #fff !important;
  font-weight: 700;
  background: rgba(255,255,255,.15);
  border-radius: var(--r-sm);
}
.navbar-admin .navbar-toggler { border: none; }
.admin-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-accent);
  color: var(--c-text);
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 6. CARD
   ============================================================ */
.card {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  background: #fff;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--c-border);
  font-weight: 700;
  font-size: 14px;
}
.card-header-primary {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: #fff;
  border-radius: calc(var(--r-md) - 1px) calc(var(--r-md) - 1px) 0 0;
}

/* 7. BOTTONI
   ============================================================ */
.btn-primary {
  background: var(--c-primary);
  border-color: var(--c-primary);
  font-weight: 700;
  border-radius: var(--r-sm);
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn-primary:hover {
  background: var(--c-primary-light);
  border-color: var(--c-primary-light);
  box-shadow: 0 4px 14px rgba(91,45,142,.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: none; }

.btn-cta {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-light));
  color: #fff !important;
  font-weight: 800;
  border-radius: var(--r-md);
  padding: .75rem 1.5rem;
  box-shadow: 0 4px 16px rgba(91,45,142,.4);
  border: none;
  transition: transform .2s, box-shadow .2s;
  text-decoration: none;
  display: inline-block;
}
.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(91,45,142,.45);
}
.btn-cta:active { transform: none; }

.btn-export {
  background: var(--c-accent);
  color: var(--c-text);
  font-weight: 700;
  border-radius: var(--r-sm);
  border: none;
}
.btn-export:hover { background: #e8981a; color: var(--c-text); }

.btn-action-edit {
  background: var(--c-primary-bg);
  border: none;
  border-radius: var(--r-sm);
  padding: .35rem .6rem;
  transition: background .15s;
  color: var(--c-primary);
}
.btn-action-edit:hover { background: #D4C6EE; }

.btn-action-delete {
  background: #FEE2E2;
  border: none;
  border-radius: var(--r-sm);
  padding: .35rem .6rem;
  transition: background .15s;
  color: var(--c-danger);
}
.btn-action-delete:hover { background: #FECACA; }

/* 8. FORM
   ============================================================ */
.form-label {
  font-size: 11px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .35rem;
}
.form-control, .form-select {
  border-radius: var(--r-sm);
  border: 1.5px solid #D1D5DB;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(91,45,142,.12);
}

/* 9. BADGE
   ============================================================ */
.badge-lc       { background: var(--c-accent-bg); color: #92400E; }
.badge-eg       { background: #DCFCE7; color: #14532D; }
.badge-rs       { background: #FEE2E2; color: #991B1B; }
.badge-open     { background: #DCFCE7; color: var(--c-success); font-weight: 700; }
.badge-closed   { background: #F3F4F6; color: var(--c-muted); font-weight: 700; }
.badge-superadmin { background: var(--c-primary-bg); color: var(--c-primary); font-weight: 700; }
.badge-referente  { background: #F3F4F6; color: var(--c-muted); font-weight: 700; }

/* 10. STAT CARD (admin)
   ============================================================ */
.stat-card {
  border-radius: var(--r-md);
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--c-text);
}
.stat-card .stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 2px;
}

/* 11. TABELLA
   ============================================================ */
.table thead th {
  background: var(--c-surface);
  font-size: 11px;
  font-weight: 700;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid var(--c-border);
}

/* 12. HOMEPAGE — HERO
   ============================================================ */
.hero-public {
  background: linear-gradient(140deg, var(--c-primary-dark) 0%, var(--c-primary) 55%, #7C3FB5 100%);
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
  color: #fff;
}
.hero-public::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  right: -180px; top: -280px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  pointer-events: none;
}
.hero-public::after {
  content: '';
  position: absolute;
  width: 350px; height: 350px;
  right: 8%; bottom: -150px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  pointer-events: none;
}
.hero-public .hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.65);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-public .hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 28px; height: 2px;
  background: var(--c-accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.hero-public h1 {
  font-size: clamp(34px, 6vw, 58px);
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  letter-spacing: -.02em;
}
.hero-public h1 .hero-highlight {
  color: var(--c-accent);
  font-style: italic;
}
.hero-public .hero-sub {
  font-size: 17px;
  color: rgba(255,255,255,.8);
  max-width: 500px;
  line-height: 1.65;
  margin-bottom: 0;
  font-weight: 400;
}
.hero-public .container { position: relative; z-index: 1; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--r-pill);
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  margin-bottom: 1.5rem;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* 13. HOMEPAGE — SEZIONE EVENTI
   ============================================================ */
.events-section { padding: 3rem 0 4rem; }
.events-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.events-section-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--c-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.events-section-header h2::before {
  content: '';
  display: inline-block;
  width: 4px; height: 22px;
  background: var(--c-primary);
  border-radius: 2px;
  flex-shrink: 0;
}
.events-count-pill {
  background: var(--c-primary-bg);
  color: var(--c-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(91,45,142,.15);
}

/* 14. EVENT CARD — magazine style
   ============================================================ */
.event-card {
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease;
  display: flex;
  flex-direction: column;
}
.event-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}
.event-card .event-img {
  height: 200px;
  object-fit: cover;
  width: 100%;
  display: block;
}
.event-card .event-img-placeholder {
  height: 200px;
  background: linear-gradient(135deg, var(--c-primary-light) 0%, var(--c-primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.event-placeholder-icon {
  font-size: 52px;
  color: rgba(255,255,255,.18);
}
.event-card .event-status {
  position: absolute;
  top: 12px;
  right: 12px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 11px;
  letter-spacing: .02em;
}
.event-date-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(10, 0, 30, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 6px 10px;
  text-align: center;
  line-height: 1;
  min-width: 46px;
}
.event-date-badge .date-day {
  font-size: 22px;
  font-weight: 800;
  display: block;
}
.event-date-badge .date-month {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .85;
  display: block;
  margin-top: 3px;
}
.event-card .card-body {
  padding: 1.1rem 1.25rem .6rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.event-card .card-body h2 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: .7rem;
  color: var(--c-text);
}
.event-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: .6rem;
}
.event-info-item {
  font-size: 12px;
  color: var(--c-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.event-info-item i { font-size: 13px; }
.event-price-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--c-accent-bg);
  color: #92400E;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  margin-top: auto;
  margin-bottom: .5rem;
  align-self: flex-start;
}
.event-price-tag.free {
  background: #DCFCE7;
  color: #14532D;
}
.event-deadline-chip {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-accent);
  background: var(--c-accent-bg);
  border-radius: var(--r-pill);
  padding: 3px 9px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: .25rem;
}
.event-deadline-chip.urgent {
  color: var(--c-danger);
  background: #FEE2E2;
}
.event-zero-state {
  font-size: 11px;
  color: var(--c-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.event-card .card-footer {
  padding: .75rem 1.25rem 1.1rem;
  background: transparent;
  border-top: 1px solid var(--c-border);
}

/* Single event centered layout */
.events-single-wrap { max-width: 560px; margin: 0 auto; }

/* Empty state */
.events-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--c-muted);
}
.events-empty-icon {
  font-size: 52px;
  opacity: .18;
  display: block;
  margin-bottom: 1rem;
}

/* 13. EVENTO - HERO + CHIPS
   ============================================================ */
.event-hero {
  min-height: 200px;
  background: linear-gradient(160deg, var(--c-primary-light), var(--c-primary-dark));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
}
.event-hero h1 {
  color: #fff;
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 800;
  margin: 0;
}
.event-chips-bar {
  background: var(--c-primary-bg);
  padding: .75rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
}
.event-chip {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  font-size: 12px;
  padding: 4px 12px;
  color: #374151;
}
.event-chip-accent {
  background: var(--c-accent-bg);
  border: 1px solid var(--c-accent);
  border-radius: var(--r-pill);
  font-size: 12px;
  padding: 4px 12px;
  color: #92400E;
  font-weight: 600;
}

.event-hero-img {
  position: relative;
  height: 260px;
  overflow: hidden;
}
.event-hero-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.event-hero-img .event-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(30,10,60,.7) 40%, transparent);
}
.event-hero-img .event-hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.5rem;
}
.event-status { width: fit-content; }
.event-form-wrap { max-width: 700px; margin: 0 auto; }

/* 14. LOGIN PAGE
   ============================================================ */
.login-page {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #fff;
  border-radius: var(--r-lg);
  max-width: 420px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card-header {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: #fff;
  padding: 2rem;
  text-align: center;
}
.login-card-header img {
  width: 72px;
  border-radius: var(--r-sm);
  margin-bottom: .75rem;
}
.login-card-body { padding: 2rem; }

/* 15. 404
   ============================================================ */
.page-404 {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}
.page-404 .error-number {
  font-size: clamp(80px, 18vw, 140px);
  font-weight: 800;
  line-height: 1;
  color: var(--c-primary);
  opacity: .15;
}
.page-404 .error-msg {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-text);
  margin-top: -1rem;
}
.page-404 .error-sub {
  font-size: 14px;
  color: var(--c-muted);
  margin: .5rem 0 1.5rem;
}

/* 16. FOOTER PUBBLICO
   ============================================================ */
.footer-public {
  background: #fff;
  border-top: 1px solid var(--c-border);
  padding: 1.5rem 0;
}
.footer-public .footer-brand {
  font-weight: 700;
  color: var(--c-primary);
  font-size: 14px;
}
.footer-public .footer-meta { font-size: 12px; color: var(--c-muted); }

/* 17. SMOOTH SCROLL & MISC
   ============================================================ */
html { scroll-behavior: smooth; }

::placeholder { color: #9CA3AF; font-size: 13px; }

.alert {
  border-radius: var(--r-md) !important;
  font-size: 14px;
}

/* Custom checkbox to match design system */
.form-check-input:checked {
  background-color: var(--c-primary);
  border-color: var(--c-primary);
}
.form-check-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(91,45,142,.12);
}

/* 18. DESCRIPTION SNIPPET
   ============================================================ */
.event-desc-snippet {
  font-size: 13px;
  color: var(--c-muted);
  line-height: 1.5;
  margin-bottom: .6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 19. EVENT PAGE — SUCCESS STATE
   ============================================================ */
.success-state {
  text-align: center;
  padding: 3rem 2rem;
}
.success-icon {
  width: 72px;
  height: 72px;
  background: #DCFCE7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 32px;
  color: var(--c-success);
}
.success-state h2 { font-size: 22px; font-weight: 800; margin-bottom: .5rem; }
.success-state p { color: var(--c-muted); font-size: 14px; }

/* 20. FORM — inline heading icon color */
.form-section-icon { color: var(--c-primary); }

/* 21. EVENT CHIPS BAR — mobile improvement */
@media (max-width: 576px) {
  .event-chips-bar { padding: .5rem 1rem; gap: 6px; }
  .event-chip, .event-chip-accent { font-size: 11px; padding: 3px 9px; }
}

/* 22. FORM — was-validated styles */
.form-control.is-invalid, .form-select.is-invalid {
  border-color: var(--c-danger);
  box-shadow: none;
}
.form-control.is-invalid:focus, .form-select.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}
