/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-1);
}

.modal-body {
  padding: 8px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-body .input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-body label {
  font-size: 0.82rem;
  color: var(--text-2);
  font-weight: 500;
}

/* ── Multi-select checkboxes ─────────────────────────── */
.ms-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 140px;
  overflow-y: auto;
}

.ms-option {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--bg-3);
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.ms-option:hover {
  background: var(--primary-bg);
}

.ms-option input[type="checkbox"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.ms-option input[type="checkbox"]:checked+span {
  color: var(--primary);
  font-weight: 600;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--border);
}


/* ═══════════════════════════════════════════════════════════
   PROJECT EDIT MODAL  (scoped with .pe- prefix)
   ═══════════════════════════════════════════════════════════ */

/* Box — wider + custom entrance */
.pe-modal-box {
  max-width: 640px;
  animation: peSlideIn 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes peSlideIn {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* Header — accent underline + subtle tinted top */
.pe-modal-header {
  padding: 18px 22px 16px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 5%, var(--bg-2)) 0%,
    var(--bg-2) 100%
  );
  border-bottom: 2px solid var(--accent);
}

.pe-header-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.pe-header-icon {
  width: 17px;
  height: 17px;
  color: var(--accent);
  flex-shrink: 0;
  opacity: 0.85;
}

.pe-close-btn {
  border-radius: 50% !important;
  width: 30px !important;
  height: 30px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
}

/* Body — custom scrollbar + spacing */
.pe-modal-body {
  padding: 20px 22px 18px !important;
  gap: 14px !important;
  max-height: 68vh;
  overflow-y: auto;
}

.pe-modal-body::-webkit-scrollbar { width: 3px; }
.pe-modal-body::-webkit-scrollbar-track { background: transparent; }
.pe-modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* Two-column hero row */
.pe-hero-row {
  display: grid;
  grid-template-columns: 136px 1fr;
  gap: 18px;
  align-items: start;
}

/* Cover column */
.pe-cover-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.pe-cover-area {
  width: 136px;
  height: 196px;
  border-radius: 10px;
  border: 1.5px dashed var(--border);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pe-cover-area:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.pe-cover-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: var(--text-3);
  font-size: 0.74rem;
  pointer-events: none;
}

.pe-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pe-cover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.pe-cover-area:hover .pe-cover-overlay {
  opacity: 1;
}

.pe-remove-cover {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  transition: color 0.15s;
}

.pe-remove-cover:hover {
  color: var(--danger, #ef4444);
}

/* Right meta column */
.pe-meta-col {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.pe-textarea {
  resize: vertical;
  min-height: 70px;
}

/* Field labels */
.pe-field-label {
  font-size: 0.77rem !important;
  font-weight: 500 !important;
  color: var(--text-2) !important;
  display: block !important;
  margin-bottom: 5px !important;
}

.pe-label-note {
  font-weight: 400;
  color: var(--text-3);
  font-size: 0.72rem;
}

/* Divider between hero and rest */
.pe-section-divider {
  height: 1px;
  background: var(--border);
  opacity: 0.6;
  margin: 2px 0;
}

/* Tags */
.pe-tags-count {
  font-size: 0.71rem;
  color: var(--text-3);
  font-weight: 400;
}

.pe-tags-ac {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  margin-top: 4px;
}

.pe-tags-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* Hint text */
.pe-hint {
  display: block;
  color: var(--text-3);
  font-size: 0.71rem;
  margin-top: 3px;
}

/* Footer */
.pe-modal-footer {
  padding: 13px 22px 17px !important;
  justify-content: space-between !important;
}

.pe-footer-actions {
  display: flex;
  gap: 8px;
}

/* Trash — icon-only ghost danger button */
.pe-trash-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--danger, #ef4444) 40%, var(--border));
  background: transparent;
  color: var(--danger, #ef4444);
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s, background 0.15s;
}

.pe-trash-btn:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--danger, #ef4444) 12%, transparent);
}


/* ═══════════════════════════════════════════════════════════
   AUTH PAGES
   ═══════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 40px 20px;
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5), 0 0 120px var(--accent-dim);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 700;
}

.auth-logo svg {
  width: 28px;
  height: 28px;
}

.auth-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 6px;
}

.auth-card>.text-muted {
  font-size: 0.9rem;
  margin-bottom: 24px;
  display: block;
}

.auth-error {
  background: var(--red-dim);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--red);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form .input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrapper > svg,
.input-icon-wrapper > i {
  position: absolute;
  left: 14px;
  color: var(--text-3);
  pointer-events: none;
  z-index: 1;
}

.input-icon-wrapper .input {
  padding-left: 42px;
  width: 100%;
}

.auth-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.password-strength {
  height: 3px;
  border-radius: 2px;
  background: var(--bg-4);
  margin-top: 4px;
  overflow: hidden;
}

.password-strength::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--strength, 0%);
  border-radius: 2px;
  background: var(--strength-color, var(--text-3));
  transition: width 0.3s, background 0.3s;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 0.88rem;
}

.auth-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-3);
  font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}


/* ── User Menu / Dropdown ──────────────────────────────── */
.nav-auth-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-menu-wrapper {
  position: relative;
}

.avatar {
  cursor: pointer;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  padding: 8px 0;
  animation: dropdownFade 0.15s ease;
}

@keyframes dropdownFade {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-dropdown-header {
  padding: 12px 16px;
}

.user-dropdown-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-1);
}

.user-dropdown-email {
  font-size: 0.8rem;
  margin-top: 2px;
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: var(--font);
}

.user-dropdown-item:hover {
  background: var(--bg-3);
  color: var(--text-1);
}

.user-dropdown-danger:hover {
  color: var(--red);
  background: var(--red-dim);
}

@media (max-width: 768px) {
  .auth-card {
    padding: 28px 22px;
  }

  .auth-form-row {
    grid-template-columns: 1fr;
  }

  .nav-auth-buttons {
    gap: 4px;
  }
}

/* ── Password Toggle ── */
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  z-index: 2;
  transition: color var(--transition);
}

.password-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}

.password-toggle:hover {
  color: var(--text-1);
}

/* ── Forgot Password Link ── */
.auth-forgot {
  text-align: right;
  margin-top: -4px;
  margin-bottom: 8px;
}

.auth-forgot .auth-link {
  font-size: 0.8rem;
}

/* ── TOS Checkbox ── */
.tos-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0 16px;
  font-size: 0.8125rem;
  color: var(--text-2);
  cursor: pointer;
  line-height: 1.4;
}

.tos-checkbox input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.tos-checkbox a {
  color: var(--accent);
  text-decoration: none;
}

.tos-checkbox a:hover {
  text-decoration: underline;
}

/* ── Auth Success ── */
.auth-success {
  background: var(--green-dim, rgba(34, 197, 94, 0.1));
  color: var(--green, #22c55e);
  border: 1px solid var(--green, #22c55e);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.8125rem;
  margin-bottom: 16px;
}

/* ── Verify Email Icon ── */
.verify-icon {
  margin: 24px 0 16px;
}

/* ── Legal Pages ── */
.legal-card {
  max-width: 640px;
  text-align: left;
}

.legal-content {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}

.legal-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 20px 0 8px;
  color: var(--text-1);
}

.legal-content p {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════════════════
   CONFIRM DIALOG
   ═══════════════════════════════════════════════════════════ */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10010;
  backdrop-filter: blur(6px);
  animation: modalFadeIn 0.2s ease;
}

.confirm-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px 24px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: confirmPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes confirmPop {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.confirm-icon-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.confirm-icon-warn {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.confirm-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 8px;
}

.confirm-msg {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 24px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-actions .btn {
  min-width: 110px;
  padding: 10px 20px;
  font-size: 0.875rem;
  border-radius: 12px;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #dc2626;
}

/* ═══════════════════════════════════════════════════════════
   DETAIL / CAROUSEL VIEW
   ═══════════════════════════════════════════════════════════ */
.world-detail-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  gap: 16px;
  padding: 12px 16px 12px 16px;
  height: 100%;
}

.world-detail-carousel::after {
  content: '';
  min-width: 16px;
  flex-shrink: 0;
}

.world-detail-carousel::-webkit-scrollbar {
  height: 6px;
}

.world-detail-carousel::-webkit-scrollbar-track {
  background: transparent;
}

.world-detail-carousel::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

.world-detail-slide {
  min-width: 300px;
  max-width: 360px;
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s;
}

.world-detail-slide:hover {
  border-color: var(--border-light);
}

.slide-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slide-header i {
  color: var(--primary);
  flex-shrink: 0;
}

.slide-header .world-item-actions {
  opacity: 1;
}

.slide-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-1);
}

.slide-divider {
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
  margin: 16px 0 20px;
  border-radius: 1px;
}

.slide-image-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  max-height: 280px;
  background: var(--bg-3);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  margin-bottom: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.slide-image-area:hover {
  border-color: var(--primary);
  background: rgba(124, 92, 252, 0.05);
}

.slide-image-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

.slide-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.slide-desc {
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.7;
  white-space: pre-wrap;
  flex: 1;
}

/* ── Tags row in grid cards ── */
.world-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Icon Picker Grid ──────────────────────────────────── */
.icon-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.icon-picker-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all .15s;
}

.icon-picker-cell:hover {
  background: var(--bg-2);
  color: var(--text-primary);
}

.icon-picker-cell.active {
  border-color: var(--accent);
  background: var(--accent-muted, rgba(99, 102, 241, .12));
  color: var(--accent);
}
