/* ====================================================
   FolioLink — /edit Live Customizer Styles
   Glass aesthetic, dark/light aware, mobile-first.
   ==================================================== */

/* ---------- LAYOUT SHELL ---------- */
html, body { height: 100%; overflow: hidden; }

.edit-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: 60px;
}
.edit-header-inner {
  max-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
}
.edit-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- SPLIT LAYOUT ---------- */
.edit-layout {
  display: flex;
  height: 100vh;
  padding-top: 60px; /* header height */
}

/* Left editor pane */
.edit-pane {
  width: 420px;
  min-width: 320px;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.edit-pane-inner {
  padding: 24px 20px 80px;
}

/* Right preview pane */
.preview-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  /* Subtle distinction from editor */
  background-image: radial-gradient(ellipse at 50% 0%, var(--glow-color) 0%, transparent 60%);
}
.preview-sticky-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
}
.preview-label {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.preview-open-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s;
}
.preview-open-link:hover { opacity: 0.75; }

.preview-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 32px 20px 60px;
}
.preview-frame {
  max-width: 540px;
  margin: 0 auto;
}
/* Don't animate preview elements (they update live) */
.preview-frame .profile-card,
.preview-frame .link-button,
.preview-frame .section-heading,
.preview-frame .projects-section,
.preview-frame .project-tile,
.preview-frame .social-row,
.preview-frame .profile-footer {
  animation: none !important;
}

/* ---------- FORM ELEMENTS ---------- */
.form-section {
  margin-bottom: 32px;
}
.form-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.form-section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.form-section-header .form-section-title {
  margin-bottom: 0;
}

.form-row {
  margin-bottom: 12px;
}
.form-row-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}
.form-row-inline .form-label {
  margin-bottom: 0;
  min-width: 100px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.form-input {
  width: 100%;
  padding: 9px 13px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(8px);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-textarea {
  resize: vertical;
  min-height: 72px;
}

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.form-color {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid var(--glass-border);
  background: none;
  cursor: pointer;
  padding: 2px;
}
.form-color::-webkit-color-swatch-wrapper { padding: 0; }
.form-color::-webkit-color-swatch { border-radius: 5px; border: none; }
.color-hex {
  font-size: 13px;
  font-family: 'DM Mono', monospace;
  color: var(--text-secondary);
}

/* ---------- BUTTON STYLES ---------- */
.btn-ghost {
  padding: 7px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border-bright);
  color: var(--text-primary);
}
.btn-danger:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

.btn-add {
  padding: 5px 11px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-glow);
  border-radius: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s, transform 0.15s;
}
.btn-add:hover {
  background: var(--accent-glow);
  transform: scale(1.04);
}
.btn-add:active { transform: scale(0.97); }

/* ---------- REPEATING ITEM ROWS ---------- */
.list-container { display: flex; flex-direction: column; gap: 10px; }

.list-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  backdrop-filter: var(--blur-sm);
  position: relative;
}
.list-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.list-item-drag {
  cursor: grab;
  color: var(--text-muted);
  font-size: 16px;
  flex-shrink: 0;
  touch-action: none;
  user-select: none;
}
.list-item-drag:active { cursor: grabbing; }
.list-item-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item-controls {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-bright);
}
.btn-icon.btn-delete:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

.list-item-fields { display: flex; flex-direction: column; gap: 8px; }
.field-mini {
  display: grid;
  grid-template-columns: 70px 1fr;
  align-items: center;
  gap: 8px;
}
.field-mini .form-label { margin-bottom: 0; font-size: 11px; }
.field-mini .form-input { padding: 7px 10px; font-size: 13px; }

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text-primary);
  color: var(--bg);
  padding: 10px 22px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---------- MOBILE STACK ---------- */
@media (max-width: 768px) {
  html, body { overflow: auto; height: auto; }

  .edit-layout {
    flex-direction: column;
    height: auto;
    padding-top: 60px;
  }
  .edit-pane {
    width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-y: visible;
  }
  .preview-pane {
    overflow: visible;
  }
  .preview-scroll {
    overflow: visible;
    padding: 24px 16px 80px;
  }
  .edit-header-actions .btn-ghost:not(:last-child):not(:nth-last-child(2)) {
    display: none;
  }
}

/* ---------- PUBLISH SECTION ---------- */
.form-section-publish {
  background: var(--glass-bg);
  border: 1px solid var(--accent-glow);
  border-radius: var(--radius-sm);
  padding: 16px 16px 18px;
  backdrop-filter: blur(10px);
}

.username-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
}
.username-prefix {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-right: 4px;
  font-family: 'DM Sans', sans-serif;
}
.username-input {
  flex: 1;
  padding-right: 32px;
  font-family: 'DM Mono', monospace, sans-serif;
  letter-spacing: 0.02em;
}
.username-status {
  position: absolute;
  right: 10px;
  font-size: 16px;
  pointer-events: none;
}
.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin: 4px 0 0;
}
.form-hint.error { color: #ef4444; }
.form-hint.success { color: #22c55e; }

.btn-publish {
  width: 100%;
  padding: 11px;
  margin-top: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: 0.02em;
}
.btn-publish:hover:not(:disabled) { opacity: 0.88; }
.btn-publish:active:not(:disabled) { transform: scale(0.98); }
.btn-publish:disabled { opacity: 0.38; cursor: not-allowed; }

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none !important; }
}
