/* ═══════════════════════════════════════════════════════════
   settings.css — Pannello Impostazioni Utente
   Estetica manoscritto illuminato (oro/ambra su pergamena scura)
   ═══════════════════════════════════════════════════════════ */

/* ── Dropdown utente (sotto bottone 👤) ─────────────────── */
.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 180px;
  background: rgba(20, 14, 8, 0.97);
  border: 1px solid rgba(201, 164, 90, 0.45);
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55), 0 0 12px rgba(255, 150, 15, 0.18);
  padding: 6px 0;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.user-dropdown[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.user-dropdown button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: #d4b87a;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.user-dropdown button:hover {
  background: rgba(201, 164, 90, 0.12);
  color: #f4d490;
}

.user-dropdown .dropdown-divider {
  height: 1px;
  background: rgba(201, 164, 90, 0.22);
  margin: 4px 0;
}

/* Wrapper per posizionare il dropdown rispetto al bottone */
.user-wrapper {
  position: relative;
  display: inline-block;
}

/* ── Modale Impostazioni ─────────────────────────────────── */
.settings-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 5, 2, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.settings-modal[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.settings-box {
  background: linear-gradient(180deg, #1a120a 0%, #120a04 100%);
  border: 1px solid rgba(201, 164, 90, 0.55);
  border-radius: 8px;
  box-shadow: 0 0 36px rgba(255, 150, 15, 0.18), 0 12px 40px rgba(0, 0, 0, 0.6);
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.settings-header {
  padding: 22px 30px 16px;
  border-bottom: 1px solid rgba(201, 164, 90, 0.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-title {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 500;
  color: #f4d490;
  margin: 0;
  letter-spacing: 0.04em;
}

.settings-close {
  background: transparent;
  border: none;
  color: #c9a45a;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}
.settings-close:hover { color: #f4d490; }

.settings-body {
  padding: 18px 30px 24px;
  overflow-y: auto;
  flex: 1;
}

/* Sezioni del pannello */
.settings-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(201, 164, 90, 0.14);
}
.settings-section:last-child { border-bottom: none; margin-bottom: 0; }

.settings-section h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  color: #f4d490;
  margin: 0 0 12px;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-section h3 .section-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(201, 164, 90, 0.5);
  border-radius: 50%;
  font-size: 0.75rem;
  color: #c9a45a;
}

.settings-section.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.section-soon {
  font-size: 0.8rem;
  color: #806542;
  font-style: italic;
  margin-left: auto;
  font-family: 'Cormorant Garamond', serif;
  letter-spacing: 0;
}

/* Campi form */
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.settings-field label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  color: #b39466;
}

.settings-field input[type="text"],
.settings-field input[type="password"],
.settings-field select {
  background: rgba(8, 5, 2, 0.7);
  border: 1px solid rgba(201, 164, 90, 0.35);
  border-radius: 4px;
  padding: 8px 12px;
  color: #e8d4a4;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.settings-field input:focus,
.settings-field select:focus {
  outline: none;
  border-color: rgba(255, 170, 30, 0.7);
  box-shadow: 0 0 0 2px rgba(255, 150, 15, 0.15);
}

.settings-field input[type="color"] {
  width: 60px;
  height: 36px;
  border: 1px solid rgba(201, 164, 90, 0.35);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  padding: 2px;
}

.settings-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.settings-row .settings-field { flex: 1; min-width: 180px; }

/* Toggle (switch) */
.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}

.settings-toggle .toggle-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  color: #d4b87a;
  flex: 1;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  background: rgba(201, 164, 90, 0.2);
  border: 1px solid rgba(201, 164, 90, 0.35);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.switch .slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #c9a45a;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.switch input:checked + .slider {
  background: rgba(255, 150, 15, 0.35);
  border-color: rgba(255, 170, 30, 0.7);
}
.switch input:checked + .slider::before {
  transform: translateX(20px);
  background: #f4d490;
}

/* Pulsanti */
.settings-btn {
  background: linear-gradient(180deg, #6e4a1a 0%, #4a3010 100%);
  border: 1px solid rgba(201, 164, 90, 0.6);
  color: #f4d490;
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  padding: 9px 18px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}

.settings-btn:hover {
  background: linear-gradient(180deg, #8a5d22 0%, #5e3d14 100%);
  box-shadow: 0 0 10px rgba(255, 150, 15, 0.3);
}

.settings-btn:active { transform: translateY(1px); }

.settings-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.settings-btn.danger {
  background: linear-gradient(180deg, #6e1a1a 0%, #4a1010 100%);
  border-color: rgba(220, 75, 5, 0.6);
}
.settings-btn.danger:hover {
  background: linear-gradient(180deg, #8a2222 0%, #5e1414 100%);
  box-shadow: 0 0 10px rgba(220, 75, 5, 0.4);
}

.settings-btn.secondary {
  background: transparent;
  border-color: rgba(201, 164, 90, 0.4);
  color: #c9a45a;
}

/* Messaggi */
.settings-msg {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.9rem;
  margin-top: 8px;
  min-height: 1.2em;
}
.settings-msg.ok    { color: #8ab36a; }
.settings-msg.error { color: #d96a5a; }

/* Lista link legali */
.settings-legal-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.settings-legal-list li { margin: 6px 0; }
.settings-legal-list a {
  color: #c9a45a;
  text-decoration: none;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  border-bottom: 1px dotted rgba(201, 164, 90, 0.4);
  transition: color 0.15s;
}
.settings-legal-list a:hover { color: #f4d490; }

/* Piano info */
.settings-plan-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-family: 'Cormorant Garamond', serif;
  margin-bottom: 12px;
}
.settings-plan-info .label { color: #b39466; }
.settings-plan-info .value { color: #e8d4a4; }

/* Responsive */
@media (max-width: 600px) {
  .settings-box       { max-height: 95vh; }
  .settings-header    { padding: 16px 18px 12px; }
  .settings-body      { padding: 14px 18px 18px; }
  .settings-row       { flex-direction: column; align-items: stretch; }
}
