/* ═══════════════════════════════════════════════════════════════
   dashboard.css — Profile Editor / Dashboard Page
   ═══════════════════════════════════════════════════════════════
   Sections:
   1. Top bar (logo + user menu)
   2. Main layout & container
   3. Page heading
   4. Avatar upload section
   5. Form sections
   6. Form elements
   7. Dynamic list rows (services, portfolio, testimonials)
   8. Save bar
   9. Message states
═══════════════════════════════════════════════════════════════ */


/* ─── 1. TOP BAR ──────────────────────────────────────────── */
.dash-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  transition: background var(--duration-med) var(--ease),
              border-color var(--duration-med) var(--ease);
}

/* Brand — logo and name */
.dash-topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-display);
  font-size: var(--size-lg);
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -.01em;
}

/* The lock icon box */
.dash-topbar__icon {
  width: 26px;
  height: 26px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--text-inverse);
  flex-shrink: 0;
}

.dash-topbar__icon svg { width: 13px; height: 13px; }

.dash-topbar__brand:hover { color: var(--text-primary); }

.dash-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0; /* stay pinned to the right edge, never compress */
}


/* ─── 2. MAIN LAYOUT & CONTAINER ─────────────────────────── */
.dash-main {
  min-height: 100vh;
  padding: var(--space-3xl) var(--space-lg);
}

.dash-container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}


/* ─── 3. PAGE HEADING ────────────────────────────────────── */
.dash-heading h1 {
  font-size: var(--size-2xl);
  font-family: var(--font-display);
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  letter-spacing: -.01em;
}

.dash-heading__sub {
  color: var(--text-secondary);
  font-size: var(--size-sm);
  line-height: 1.65;
}


/* ─── 4. PHOTO UPLOADS ───────────────────────────────────── */

/* Cover photo — banner-shaped preview at the top of the section */
.cover-upload__preview {
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, #1c2237 0%, #161b2e 55%, #0d1120 100%);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

#cover-file { display: none; }

/* Profile photo upload — circle preview to match the profile page */
.avatar-upload {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xl);
}

@media (max-width: 480px) {
  .avatar-upload { flex-direction: column; align-items: center; }
}

/* Circle preview — matches the round avatar on the profile page */
.avatar-upload__preview {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-subtle);
}

.avatar-upload__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Controls area next to the preview */
.avatar-upload__controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding-top: var(--space-xs);
}

/* The hidden file input is triggered by clicking the label */
#avatar-file { display: none; }

/* Style the label as a button */
.avatar-upload__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-primary);
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease);
}

.avatar-upload__label:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.avatar-upload__label svg { width: 13px; height: 13px; }

.avatar-upload__note {
  font-size: var(--size-xs);
  color: var(--text-tertiary);
  line-height: 1.55;
}

/* Remove photo button — shown only when a photo exists */
.photo-remove-btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: transparent;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease);
}

.photo-remove-btn:hover {
  background: #1a0606;
  color: #f87171;
  border-color: #3d1515;
}


/* ─── 5. FORM SECTIONS ───────────────────────────────────── */
.dash-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.dash-section__title {
  font-size: var(--size-sm);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-light);
}

.dash-section__hint {
  font-size: var(--size-sm);
  color: var(--text-secondary);
  margin-top: calc(-1 * var(--space-xs));
  line-height: 1.6;
}


/* ─── 6. FORM ELEMENTS ───────────────────────────────────── */

/* Two-column row for fields that sit side by side */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

@media (max-width: 580px) {
  .form-row { grid-template-columns: 1fr; }
}

/* Wrapper for a label + input pair */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: var(--size-xs);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.form-hint {
  font-size: var(--size-xs);
  color: var(--text-tertiary);
  line-height: 1.5;
  margin-top: -2px;
}

.char-counter {
  font-size: var(--size-xs);
  color: var(--text-tertiary);
  text-align: right;
  margin-top: 4px;
}

/* The live URL preview — shows "unfoundme.com/your-handle" */
.form-label__hint {
  font-weight: 400;
  color: var(--text-tertiary);
  font-size: var(--size-xs);
  text-transform: none;
  letter-spacing: 0;
}

/* Text inputs and textareas */
.form-input {
  width: 100%;
  padding: 10px 14px;
  font-size: var(--size-sm);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-textarea {
  resize: vertical;
  line-height: 1.6;
}

.form-textarea--sm {
  min-height: 80px;
}

/* "Add" button below dynamic lists */
.add-btn {
  align-self: flex-start;
}

/* Portfolio image upload — thumbnail + upload button inside each portfolio row */
.portfolio-upload {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-xs);
}

.portfolio-upload__thumb {
  width: 100px;
  height: 75px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-subtle);
}

.portfolio-upload__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portfolio-upload__controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding-top: 2px;
}

.portfolio-upload__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-primary);
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease);
}

.portfolio-upload__label:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.portfolio-file-input { display: none; }


/* ─── 7. DYNAMIC LIST ROWS ───────────────────────────────── */
.dynamic-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.dynamic-row {
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: var(--space-xs);
  align-items: start;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
}

.dynamic-row__fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.dynamic-row__inline {
  display: grid;
  grid-template-columns: 80px 1fr; /* default: small first col (icon + name in services) */
  gap: var(--space-sm);
}

/* Equal split — used for experience (Title + Company) */
.dynamic-row__inline--equal {
  grid-template-columns: 1fr 1fr;
}

/* Wide + narrow — used for qualifications and certifications (institution/body + year) */
.dynamic-row__inline--wide-narrow {
  grid-template-columns: 1fr 110px;
}

@media (max-width: 480px) {
  .dynamic-row__inline { grid-template-columns: 1fr; }
}

/* The × remove button */
.remove-btn {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-tertiary);
  font-size: var(--size-base);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease);
  align-self: start;
  margin-top: 2px;
  flex-shrink: 0;
}

.remove-btn:hover {
  background: #1a0606;
  color: #f87171;
  border-color: #3d1515;
}



/* ─── 8. SAVE BAR ────────────────────────────────────────── */
/* Sticky at the bottom so Save is always accessible */
.dash-save-bar {
  position: sticky;
  bottom: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}


/* ─── 9. MESSAGE STATES ──────────────────────────────────── */
.dash-message {
  font-size: var(--size-sm);
  font-weight: 500;
  flex: 1;
  letter-spacing: .02em;
}

.dash-message--success { color: #4ade80; }  /* green */
.dash-message--error   { color: #f87171; }  /* red   */


/* ─── MOBILE ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  /* Reduce topbar side padding so there's more room for content */
  .dash-topbar { padding: 0 var(--space-md); }
}
