/* =========================================================================
   Wonderdoodle: Account page
   Two panels: the details we keep about the parent, and every book they have
   started. Reuses the builder's form controls, auth overlay and toast.
   ========================================================================= */

.profile {
  padding: calc(var(--nav-h) + 42px) 0 84px;
  background: var(--cream-2);
  min-height: 70vh;
}

/* Header ----------------------------------------------------------------- */
.profile__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}
.profile__id { display: flex; align-items: center; gap: 16px; }
.profile__avatar {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font: 600 1.4rem/1 var(--font-body);
}
.profile__head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.4vw, 2.1rem);
  font-weight: 500;
  margin: 0;
  line-height: 1.15;
}
.profile__meta { margin: 4px 0 0; color: var(--muted); font-size: 0.88rem; }

/* Panels ----------------------------------------------------------------- */
.profile__grid {
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow-sm);
}
.card h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  margin: 0 0 6px;
}
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card__count { color: var(--muted); font-size: 0.84rem; white-space: nowrap; }
.card__intro {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
  max-width: 60ch;
}

/* Details form ----------------------------------------------------------- */
.profile__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
}
.profile__saved { color: var(--green); font-size: 0.88rem; font-weight: 600; }
.profile__saved.is-hidden { display: none; }

.profile__signout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.profile__email { margin: 0; color: var(--muted); font-size: 0.84rem; word-break: break-all; }

/* Book list -------------------------------------------------------------- */
.books { display: grid; gap: 14px; }
.books__loading, .books__error { color: var(--muted); font-size: 0.9rem; margin: 0; }
.books__error { color: #A6362C; }

.books__empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 34px 24px;
  text-align: center;
  color: var(--ink-soft);
}
.books__empty p { margin: 0 0 10px; font-size: 0.92rem; line-height: 1.6; }
.books__empty .btn { margin-top: 10px; }

.book-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--paper);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.book-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }

.book-card__cover {
  width: 76px;
  height: 92px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
}
.book-card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.book-card__body { min-width: 0; }
.book-card__body h3 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 500;
  margin: 6px 0 3px;
  overflow-wrap: anywhere;
}
.book-card__meta { margin: 0; color: var(--muted); font-size: 0.82rem; }
.book-card__tags { margin: 9px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }

.book-card__status {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.book-card__status--done { background: var(--green-soft); color: var(--green-dark); }
.book-card__status--busy { background: var(--butter-soft); color: #7A5C0E; }
.book-card__status--draft { background: var(--cream-3); color: var(--ink-soft); }

.book-card__actions { display: flex; align-items: center; gap: 6px; }
.book-card__delete {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  line-height: 0;
  transition: color 0.15s ease, background 0.15s ease;
}
.book-card__delete:hover { color: #A6362C; background: var(--cream-2); }
.book-card__delete:disabled { opacity: 0.4; cursor: default; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 940px) {
  .profile__grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .profile { padding-top: calc(var(--nav-h) + 26px); }
  .card { padding: 22px 18px; }
  .book-card {
    grid-template-columns: 60px minmax(0, 1fr);
    row-gap: 12px;
  }
  .book-card__cover { width: 60px; height: 74px; }
  /* Actions drop to their own full-width row rather than squeezing the title. */
  .book-card__actions {
    grid-column: 1 / -1;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: 10px;
  }
}
