/* ===== NEWSLETTER PREFERENCES PAGE ===== */

.nl-prefs {
  max-width: 560px;
  margin: 0 auto;
  padding: 64px 32px 80px;
}

.nl-prefs-header {
  margin-bottom: 32px;
}

.nl-prefs-title {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--dark);
  margin: 12px 0 8px;
}

.nl-prefs-email {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* Loading state */
.nl-prefs-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 64px 0;
  text-align: center;
}

.nl-prefs-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--slate-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: nl-spin 0.8s linear infinite;
}

@keyframes nl-spin {
  to { transform: rotate(360deg); }
}

.nl-prefs-loading p {
  font-size: 0.88rem;
  color: var(--text-soft);
  margin: 0;
}

/* Error state */
.nl-prefs-error {
  text-align: center;
  padding: 48px 0;
}

.nl-prefs-error-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--slate-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-soft);
  font-size: 1.2rem;
}

.nl-prefs-error h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 8px;
}

.nl-prefs-error p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 24px;
  line-height: 1.6;
}

.nl-prefs-error-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent) !important;
}

.nl-prefs-error-link:hover {
  opacity: 0.7;
}

/* Form */
.nl-prefs-form {
  border: 1px solid var(--slate-border);
  border-radius: 6px;
  background: var(--white);
  overflow: hidden;
}

.nl-prefs-form-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--slate-border);
  background: var(--slate-bg);
}

.nl-prefs-form-header h2 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 4px;
}

.nl-prefs-form-header p {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin: 0;
}

.nl-prefs-segments {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nl-prefs-segment {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--slate-border);
}

.nl-prefs-segment:last-child {
  border-bottom: none;
}

/* Toggle switch */
.nl-prefs-toggle {
  flex-shrink: 0;
  margin-top: 2px;
}

.nl-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.nl-toggle-track {
  display: block;
  width: 44px;
  height: 24px;
  background: var(--slate-border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.25s ease;
}

.nl-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--white);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s ease;
}

.nl-toggle-input:checked + .nl-toggle-track {
  background: var(--accent);
}

.nl-toggle-input:checked + .nl-toggle-track .nl-toggle-thumb {
  transform: translateX(20px);
}

.nl-toggle-input:focus + .nl-toggle-track {
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.12);
}

.nl-prefs-segment-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nl-prefs-segment-info label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
  line-height: 1.3;
}

.nl-prefs-segment-desc {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin: 0;
  line-height: 1.4;
}

/* Actions */
.nl-prefs-actions {
  padding: 20px 24px;
  border-top: 1px solid var(--slate-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.nl-prefs-save-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: background var(--transition);
}

.nl-prefs-save-btn:hover {
  background: var(--accent-hover);
}

.nl-prefs-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.nl-prefs-unsubscribe-btn {
  padding: 10px 20px;
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--slate-border);
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: all var(--transition);
}

.nl-prefs-unsubscribe-btn:hover {
  border-color: #EF4444;
  color: #EF4444;
}

/* Success state */
.nl-prefs-success {
  text-align: center;
  padding: 48px 0;
}

.nl-prefs-success-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ECFDF5;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #059669;
  font-size: 1.2rem;
}

.nl-prefs-success h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 8px;
}

.nl-prefs-success p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 24px;
  line-height: 1.6;
}

.nl-prefs-success-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent) !important;
}

.nl-prefs-success-link:hover {
  opacity: 0.7;
}

/* Unsubscribed state */
.nl-prefs-unsubscribed-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--slate-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-soft);
  font-size: 1.2rem;
}

/* Name input */
.nl-prefs-name-group {
  padding: 20px 24px;
  border-bottom: 1px solid var(--slate-border);
}

.nl-prefs-name-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 8px;
}

.nl-prefs-name-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--slate-border);
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: var(--sans);
  color: var(--text-main);
  background: var(--white);
  transition: border-color var(--transition);
}

.nl-prefs-name-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.08);
}

/* Responsive */
@media (max-width: 600px) {
  .nl-prefs {
    padding: 40px 20px 60px;
  }

  .nl-prefs-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .nl-prefs-save-btn,
  .nl-prefs-unsubscribe-btn {
    text-align: center;
  }
}
