:root {
  --accent-from: #ff5f8f;
  --accent-to: #ff9a5a;
  --bg: #0e0a10;
  --panel: #17111a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f1ecf3;
  --text-dim: rgba(241, 236, 243, 0.6);
  --ok: #4ade80;
  --danger: #f87171;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.particles-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  display: block;
  width: 100vw;
  height: 100vh;
}

.brand-name {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: 600;
  margin: 0;
}

/* Buttons */

.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

.btn-pill:active { transform: scale(0.97); }

@keyframes btn-pop-3d {
  0% { transform: perspective(600px) translateY(0) scale(1) rotateX(0deg) rotateY(0deg); }
  30% { transform: perspective(600px) translateY(-8px) scale(1.06) rotateX(14deg) rotateY(-12deg); }
  60% { transform: perspective(600px) translateY(2px) scale(0.97) rotateX(-6deg) rotateY(6deg); }
  100% { transform: perspective(600px) translateY(0) scale(1) rotateX(0deg) rotateY(0deg); }
}

.btn-pop {
  animation: btn-pop-3d 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-gradient {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 55%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent-from) 70%, transparent), color-mix(in srgb, var(--accent-to) 70%, transparent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -10px 14px -10px rgba(0, 0, 0, 0.25),
    0 8px 20px -10px var(--accent-from);
}

.btn-gradient:hover {
  filter: brightness(1.07);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -10px 14px -10px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.25),
    0 0 26px 5px color-mix(in srgb, var(--accent-from) 60%, transparent),
    0 10px 26px -10px var(--accent-from);
}

.btn-outline {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 60%),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  border-radius: 999px;
  padding: 13px 24px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-outline:active { transform: scale(0.97); }

.btn-outline:hover {
  border-color: rgba(255, 255, 255, 0.32);
  transform: translateY(-2px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 60%),
    rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 20px 4px rgba(255, 255, 255, 0.14);
}

.btn-sm { padding: 9px 16px; font-size: 0.8rem; }

.icon-btn {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 60%),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.12s ease, background 0.12s ease;
}

.icon-btn:active { transform: scale(0.94); }

.icon-btn:hover {
  transform: translateY(-2px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 60%),
    rgba(255, 255, 255, 0.09);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 16px 3px rgba(255, 255, 255, 0.16);
}
.icon-btn.danger:hover {
  color: var(--danger);
  border-color: var(--danger);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 0 1px color-mix(in srgb, var(--danger) 50%, transparent),
    0 0 16px 3px color-mix(in srgb, var(--danger) 45%, transparent);
}

.file-btn { cursor: pointer; }

/* Login */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 600px 400px at 50% 0%, rgba(255, 95, 143, 0.16), transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
}

.login-card .brand-name { font-size: 1.6rem; margin-bottom: 6px; }
.login-sub { font-size: 0.85rem; color: var(--text-dim); margin: 0 0 24px; }

.mode-toggle {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin: 20px 0 0;
}
.mode-toggle a { color: var(--accent-from); font-weight: 600; text-decoration: none; }
.mode-toggle a:hover { text-decoration: underline; }

.orb-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.orb-divider::before,
.orb-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.google-btn {
  text-decoration: none;
  background: #ffffff;
  color: #1f1f1f;
  border-color: rgba(255, 255, 255, 0.4);
}
.google-btn:hover { background: #f2f2f2; }

.google-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.google-status-text {
  margin: 0;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Expanding login orb */

.login-orb {
  position: relative;
  width: 210px;
  margin: 0 auto;
  padding: 2px;
  border-radius: 999px;
  overflow: hidden;
  transition: width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), border-radius 0.45s ease;
}

.login-orb:hover,
.login-orb:focus-within {
  width: 100%;
  border-radius: 24px;
}

.orb-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 260%;
  height: 260%;
  background: conic-gradient(from 0deg, var(--accent-from), #ffd166, var(--accent-to), var(--accent-from));
  transform: translate(-50%, -50%) rotate(0deg);
  animation: orb-spin 4s linear infinite;
}

.login-orb:hover .orb-ring,
.login-orb:focus-within .orb-ring { animation-duration: 1.4s; }

@keyframes orb-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.orb-body {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border-radius: inherit;
  padding: 4px;
}

.orb-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-height: 48px;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-radius: inherit;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: default;
  overflow: hidden;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
}

.login-orb:hover .orb-trigger,
.login-orb:focus-within .orb-trigger {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.orb-form {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 12px;
  transition: max-height 0.45s ease 0.05s, opacity 0.3s ease 0.1s, padding 0.35s ease;
}

.login-orb:hover .orb-form,
.login-orb:focus-within .orb-form {
  max-height: 320px;
  opacity: 1;
  padding: 14px 12px 6px;
}

.error-text {
  color: var(--danger);
  font-size: 0.82rem;
  margin: 4px 0 0;
  text-align: left;
}

.slug-input-row {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.slug-prefix {
  padding: 11px 0 11px 12px;
  font-size: 0.85rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.slug-input-row input {
  border: none !important;
  background: transparent !important;
  padding-left: 2px !important;
}
.slug-input-row input:focus { outline: none; }

/* Fields */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  margin-bottom: 14px;
  min-width: 0;
}

.field input,
.field select {
  width: 100%;
}

.field span {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 500;
}

.field input,
.field select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 0.9rem;
  font-family: inherit;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent-from);
}

.field input[type="color"] {
  padding: 4px;
  height: 42px;
  cursor: pointer;
}

.field input[type="range"] {
  padding: 0;
  height: 42px;
  accent-color: var(--accent-from);
  cursor: pointer;
  background: transparent;
  border: none;
}

.field-row {
  display: flex;
  gap: 12px;
  min-width: 0;
}

.field.small {
  flex: 1;
  min-width: 0;
}

.form-grid { display: flex; flex-direction: column; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 0 16px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  cursor: pointer;
}

.switch-row input { width: 18px; height: 18px; accent-color: var(--accent-from); }

.hint { font-size: 0.75rem; color: var(--text-dim); margin: 8px 0 0; }

/* Topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(14, 10, 16, 0.9);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.topbar-title { font-size: 1.3rem; }
.topbar-actions { display: flex; gap: 10px; }

/* Dashboard layout */

.dash-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
}

.card-title {
  font-size: 1.05rem;
  margin: 0 0 18px;
  font-weight: 700;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-title-row .card-title { margin: 0; }

/* Avatar editor */

.avatar-editor {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  background: #241019;
}

.bg-editor {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.background-preview {
  width: 96px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--border);
  background: #241019;
  flex-shrink: 0;
}

.bg-editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Links admin list */

.links-admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.link-admin-row.disabled { opacity: 0.5; }

.reorder-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.link-thumb {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  overflow: hidden;
}

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

.link-admin-info { flex: 1; min-width: 0; }
.link-admin-info .label { font-weight: 600; font-size: 0.92rem; display: flex; align-items: center; gap: 8px; }
.link-admin-info .subtitle { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.type-tag {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

.link-admin-actions { display: flex; gap: 6px; flex-shrink: 0; }

.empty-state {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* Modal */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 2, 4, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  overflow-y: auto;
}

.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 420px;
  width: 100%;
  margin: auto;
}

.modal-card h2 { margin: 0 0 18px; font-size: 1.1rem; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}

.modal-actions .btn-outline,
.modal-actions .btn-pill { flex: 1; }

/* Toast */

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.85rem;
  z-index: 100;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--ok); color: var(--ok); }
