/* ═══════════════════════════════════════════════════════════════════
   admin.css  –  GrEst Admin Panel  |  Tema Oro & Bianco
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --gold:        #B8892A;
  --gold-light:  #D4A94A;
  --gold-pale:   #FDF6E3;
  --gold-border: #E2C97E;
  --gold-deep:   #8B6820;

  --white:       #FFFFFF;
  --off-white:   #FAFAF8;
  --surface:     #F5F2ED;
  --surface2:    #EDEAE3;

  --text:        #1A1208;
  --text-mid:    #5C4A2A;
  --text-light:  #9A8060;
  --text-xlight: #BBA880;

  --border:      #DDD0B0;
  --border-light:#EDE5CC;

  --green:       #1E7A3C;
  --green-bg:    #EBF7F0;
  --red:         #B0261A;
  --red-bg:      #FDECEA;

  --radius:      8px;
  --radius-sm:   4px;
  --shadow-sm:   0 1px 4px rgba(120,90,20,0.08);
  --shadow:      0 4px 16px rgba(120,90,20,0.10);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ══════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════ */
.admin-body {
  background: var(--off-white);
  min-height: 100vh;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(ellipse at 25% 25%, rgba(184,137,42,0.08) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 75%, rgba(184,137,42,0.06) 0%, transparent 55%),
    var(--off-white);
}

.login-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  padding: 48px 40px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), #D4A94A);
}

.login-header { text-align: center; margin-bottom: 36px; }

.login-cross {
  font-size: 2rem;
  color: var(--gold);
  display: block;
  margin-bottom: 12px;
}

.login-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.login-header p {
  font-size: 0.78rem;
  color: var(--text-light);
  letter-spacing: 0.04em;
}

.login-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-form .field label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mid);
}

.login-form .field input {
  background: var(--off-white);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
  width: 100%;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form .field input:focus {
  border-color: var(--gold);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(184,137,42,0.12);
}

.btn-login {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--gold-deep), var(--gold));
  color: white;
  border: none;
  border-radius: 50px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 18px rgba(139,104,32,0.3);
}

.btn-login:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 26px rgba(139,104,32,0.4);
}

.btn-login:disabled { opacity: 0.6; cursor: wait; transform: none; }

.login-error {
  background: var(--red-bg);
  border: 1px solid rgba(176,38,26,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--red);
  margin-bottom: 20px;
}

/* ══════════════════════════════════════════
   ADMIN LAYOUT
   ══════════════════════════════════════════ */
.admin-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(120,90,20,0.06);
}

.admin-topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-logo { display: flex; align-items: center; gap: 12px; }

.admin-logo-cross { font-size: 1.4rem; color: var(--gold); }

.admin-logo-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.admin-logo-sub { font-size: 0.7rem; color: var(--text-light); }

.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-badge {
  background: var(--gold-pale);
  border: 1px solid var(--gold-border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.75rem;
  color: var(--gold-deep);
  font-weight: 600;
}

.admin-link-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-mid);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  transition: all 0.2s;
}

.admin-link-btn:hover { border-color: var(--gold-border); color: var(--gold-deep); }

.admin-logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

.admin-logout-btn:hover { border-color: rgba(176,38,26,0.4); color: var(--red); }

/* ── LAYOUT ── */
.admin-layout {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: calc(100vh - 57px);
}

@media(max-width: 768px) { .admin-layout { grid-template-columns: 1fr; } }

/* ── SIDEBAR ── */
.admin-sidebar {
  background: var(--white);
  border-right: 1px solid var(--border-light);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.admin-nav { list-style: none; padding: 0 14px; }

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-mid);
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.admin-nav-item:hover { background: var(--surface); color: var(--text); }

.admin-nav-item.active {
  background: var(--gold-pale);
  color: var(--gold-deep);
  font-weight: 600;
  border: 1px solid rgba(184,137,42,0.2);
}

.nav-icon { font-style: normal; font-size: 1rem; }

.admin-sidebar-footer {
  padding: 20px 16px;
  border-top: 1px solid var(--border-light);
}

.admin-save-status {
  font-size: 0.72rem;
  color: var(--text-xlight);
  text-align: center;
  margin-bottom: 10px;
  min-height: 16px;
}

.btn-save-all {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--gold-deep), var(--gold));
  color: white;
  border: none;
  border-radius: 50px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 3px 12px rgba(139,104,32,0.25);
}

.btn-save-all:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139,104,32,0.35);
}

/* ── MAIN ── */
.admin-main {
  background: var(--off-white);
  padding: 36px 40px;
  overflow-y: auto;
}

@media(max-width: 700px) { .admin-main { padding: 20px 16px; } }

/* ── TABS ── */
.admin-tab { display: none; }
.admin-tab.active { display: block; animation: fadeUp 0.3s ease; }

.admin-tab-header { margin-bottom: 28px; }

.admin-tab-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.admin-tab-header p { font-size: 0.88rem; color: var(--text-light); }

/* ── ADMIN CARDS ── */
.admin-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 26px 30px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.admin-field label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mid);
}

.admin-field input,
.admin-field textarea,
.admin-field select {
  background: var(--off-white);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.admin-field input:focus,
.admin-field textarea:focus {
  border-color: var(--gold);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(184,137,42,0.12);
}

.admin-field input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.admin-field input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.admin-field textarea { resize: vertical; min-height: 90px; }

.admin-field-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media(max-width: 500px) { .admin-field-group { grid-template-columns: 1fr; } }

/* ── WEEK ADMIN CARDS ── */
.week-admin-card { margin-bottom: 14px; }

.week-admin-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.week-admin-num {
  background: linear-gradient(135deg, var(--gold-deep), var(--gold));
  color: white;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.week-admin-label {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.btn-remove-week {
  background: var(--red-bg);
  border: 1px solid rgba(176,38,26,0.2);
  color: var(--red);
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove-week:hover { background: rgba(176,38,26,0.15); }

.btn-add-week {
  background: none;
  border: 1.5px dashed var(--gold-border);
  color: var(--gold-deep);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  transition: background 0.2s;
  margin-top: 6px;
}

.btn-add-week:hover { background: var(--gold-pale); }

/* ── PREZZI ── */
.prezzo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.prezzo-row:last-child { border-bottom: none; }

.prezzo-label { font-size: 0.92rem; color: var(--text); font-weight: 500; }

.prezzo-input-wrap { display: flex; align-items: center; gap: 8px; }

.prezzo-input {
  background: var(--off-white);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
  width: 80px;
  text-align: right;
  outline: none;
  transition: border-color 0.2s;
  -moz-appearance: textfield; appearance: textfield;
}

.prezzo-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.prezzo-input:focus { border-color: var(--gold); }

.prezzo-euro { font-size: 1rem; color: var(--text-light); }

.prezzo-gratis-badge {
  background: var(--green-bg);
  border: 1px solid rgba(30,122,60,0.25);
  color: var(--green);
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ── TAGLIE ── */
.taglie-chips-edit { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }

.taglia-chip-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
  transition: border-color 0.2s;
}

.taglia-chip-edit:hover { border-color: var(--gold-border); }

.chip-remove {
  cursor: pointer;
  color: var(--text-xlight);
  font-size: 0.7rem;
  transition: color 0.2s;
}

.chip-remove:hover { color: var(--red); }

.admin-inline-input {
  background: var(--off-white);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.admin-inline-input:focus { border-color: var(--gold); }

.btn-add-small {
  background: none;
  border: 1.5px solid var(--gold-border);
  color: var(--gold-deep);
  padding: 8px 18px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-add-small:hover { background: var(--gold-pale); }

/* ── INFO NOTE ── */
.admin-info-note {
  font-size: 0.8rem;
  color: var(--text-mid);
  background: var(--gold-pale);
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.5;
}

/* ── PREVIEW ── */
.admin-preview-box {
  margin-top: 24px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
}

.preview-label {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  padding: 9px 18px;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-light);
  font-weight: 600;
}

.preview-landing {
  background: var(--off-white);
  padding: 32px 24px;
  text-align: center;
}

.prev-cross { font-size: 1.4rem; color: var(--gold); margin-bottom: 8px; }

.prev-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold-deep);
}

.prev-year {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.1;
}

.prev-theme {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--text-mid);
  margin: 8px 0 10px;
}

.prev-desc {
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.7;
  white-space: pre-line;
  max-width: 360px;
  margin: 0 auto;
}

/* ── ISCRIZIONI TABLE ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.iscrizioni-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 700px;
}

.iscrizioni-table thead tr {
  background: var(--surface);
}

.iscrizioni-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mid);
  border-bottom: 1px solid var(--border);
}

.iscrizioni-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}

.iscrizioni-table tbody tr:hover { background: var(--gold-pale); }
.iscrizioni-table tbody tr:last-child { border-bottom: none; }

.iscrizioni-table tbody td {
  padding: 13px 16px;
  color: var(--text);
  vertical-align: middle;
}

.iscrizioni-table tbody td.dim { color: var(--text-light); font-size: 0.82rem; }

.badge-pagato {
  display: inline-block;
  background: var(--green-bg);
  border: 1px solid rgba(30,122,60,0.25);
  color: var(--green);
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-attesa {
  display: inline-block;
  background: var(--gold-pale);
  border: 1px solid var(--gold-border);
  color: var(--gold-deep);
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-pdf-dl {
  background: var(--gold-pale);
  border: 1px solid var(--gold-border);
  color: var(--gold-deep);
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn-pdf-dl:hover { background: var(--gold); color: white; border-color: var(--gold); }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-xlight);
  font-size: 0.9rem;
}

.empty-state span { display: block; font-size: 2.5rem; margin-bottom: 12px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-num {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 500;
}

/* ── TOAST ── */
.admin-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 0.9rem;
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 999;
  max-width: 340px;
}

.admin-toast.show { transform: translateY(0); opacity: 1; }
.admin-toast.success { border-color: rgba(30,122,60,0.4); color: var(--green); }
.admin-toast.error   { border-color: rgba(176,38,26,0.4); color: var(--red); }

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── TOGGLE PAGATO BUTTON ── */
.btn-toggle-pagato {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1.5px solid;
  min-width: 100px;
  text-align: center;
}

.btn-toggle-pagato.attesa {
  background: var(--red-bg);
  border-color: rgba(176,38,26,0.3);
  color: var(--red);
}

.btn-toggle-pagato.attesa:hover {
  background: rgba(176,38,26,0.15);
  border-color: var(--red);
}

.btn-toggle-pagato.pagato {
  background: var(--green-bg);
  border-color: rgba(30,122,60,0.3);
  color: var(--green);
}

.btn-toggle-pagato.pagato:hover {
  background: rgba(30,122,60,0.15);
  border-color: var(--green);
}

.btn-toggle-pagato:disabled {
  cursor: wait;
}

/* ── DELETE ROW BUTTON ── */
.btn-delete-row {
  background: var(--red-bg);
  border: 1px solid rgba(176,38,26,0.2);
  color: var(--red);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-delete-row:hover {
  background: rgba(176,38,26,0.18);
  border-color: var(--red);
}

/* ── SORTABLE TABLE HEADERS ── */
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.sortable-th:hover {
  color: var(--gold-deep);
}

.sortable-th span {
  font-size: 0.65rem;
  color: var(--gold);
}

/* ── ADMIN SELECT (filtro) ── */
.admin-inline-input[id="search-pagato"],
select.admin-inline-input {
  appearance: auto;
  -webkit-appearance: auto;
  cursor: pointer;
}
