/* PMAP — application screens (auth, dashboard, profile, catalog, chat).
   Builds on the design tokens and components defined in styles.css. */

.container--narrow { max-width: 640px; }

.muted { color: var(--ink-soft); }
.small-print { font-size: 0.82rem; }

/* ---------- Alerts / flash messages ---------- */
.alert {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.92rem;
  margin: 0 0 20px;
  border: 1px solid transparent;
  line-height: 1.5;
  animation: alert-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes alert-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.alert ul { margin: 0; padding-left: 20px; }
.alert--success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.alert--error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert--info { background: var(--blue-light); color: #1e40af; border-color: #bfdbfe; }

/* ---------- Auth / form pages ---------- */
.auth-page { padding: 64px 0 96px; }
.section--left,
.section__head--left { text-align: left; margin-left: 0; }

.form-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 40px;
}
.form-card h1 { margin: 6px 0 10px; font-size: 1.6rem; letter-spacing: -0.01em; }
.form-card__lead { color: var(--ink-soft); margin: 0 0 24px; font-size: 0.95rem; }
.form-card__foot { margin: 22px 0 0; text-align: center; color: var(--ink-soft); font-size: 0.92rem; }
.form-card__foot a { color: var(--blue); font-weight: 600; text-decoration: none; }
.form-card__foot a:hover { text-decoration: underline; }

.stacked-form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.86rem; font-weight: 600; color: var(--ink); }
.field input,
.field textarea,
.field select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-light);
  transform: translateY(-1px);
}
.field textarea { resize: vertical; min-height: 90px; }

.radio-group { display: flex; gap: 12px; }
.radio-option {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  font-size: 0.92rem;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.radio-option:hover { transform: translateY(-1px); border-color: var(--blue-light); }
.radio-option:has(input:checked) { border-color: var(--blue); background: var(--blue-light); animation: pop-in 0.3s var(--ease-spring) both; }
.radio-option input { margin: 0; }

/* ---------- State pages (404 / 500) ---------- */
.state-page { padding: 96px 0; }
.state-card {
  text-align: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 56px 40px;
}
.state-card__code {
  display: inline-block;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--blue);
  background: var(--blue-light);
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.state-card h1 { margin: 0 0 10px; }
.state-card p { color: var(--ink-soft); margin: 0 0 8px; }
.state-card .hero__cta { justify-content: center; margin-top: 24px; }

/* ---------- Dashboard shell ---------- */
.dash { padding: 48px 0 96px; }
.dash__inner {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 36px;
  align-items: start;
}
.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  position: sticky;
  top: 92px;
}
.dash-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, padding-left 0.15s ease;
}
.dash-nav a:hover { background: var(--bg-alt); color: var(--ink); padding-left: 18px; }
.dash-nav a.is-active { background: var(--blue-light); color: var(--blue); }
.dash-nav a.is-active:hover { padding-left: 14px; }

.dash__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.dash__head h1 { margin: 0 0 6px; font-size: 1.5rem; }
.dash__head p { margin: 0; color: var(--ink-soft); font-size: 0.92rem; max-width: 520px; }

.card-switcher {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.card-switcher .chip { text-decoration: none; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 22px;
}
.panel h3 { margin: 0 0 6px; font-size: 1.05rem; }
.panel__hint { margin: 0 0 16px; color: var(--ink-soft); font-size: 0.88rem; }

/* ---------- "Мои MAP" cards grid ---------- */
.unq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.unq-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.unq-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  border-color: var(--blue-light);
}
.unq-card__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.unq-card__views { font-size: 0.8rem; color: var(--ink-soft); }
.unq-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.unq-card__link { font-size: 0.85rem; text-decoration: none; color: var(--blue); }
.unq-card__qr { display: flex; justify-content: center; padding: 16px 0; }
.unq-card__qr img { border-radius: var(--radius-sm); border: 1px solid var(--line); }
.unq-card__status-form select {
  width: 100%;
  font-family: inherit;
  font-size: 0.88rem;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  margin-bottom: 14px;
}
.unq-card__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
}
.status-pill--active { background: #f0fdf4; color: #15803d; }
.status-pill--paused { background: #fffbeb; color: #b45309; }
.status-pill--private { background: #f1f5f9; color: #475569; }
.status-pill--active {
  animation: status-pulse 2.4s ease-out infinite;
}
@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
  50% { box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.16); }
}

.btn--danger { color: #dc2626; }
.btn--danger:hover { color: #b91c1c; }

/* ---------- Card editor ---------- */
.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
.editor-grid .panel { margin-bottom: 0; }
@media (max-width: 880px) { .editor-grid { grid-template-columns: 1fr; } }

.avatar-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.avatar-preview {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--line);
}
.avatar-preview--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 800;
}
.avatar-form { display: flex; flex-direction: column; gap: 10px; }
.avatar-form input[type="file"] {
  font-size: 0;
  color: transparent;
  max-width: 100%;
}
.avatar-form input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 9px 16px;
  margin-right: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--ease-spring), box-shadow 0.2s ease;
}
.avatar-form input[type="file"]::-webkit-file-upload-button {
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 9px 16px;
  margin-right: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--ease-spring), box-shadow 0.2s ease;
}
.avatar-form input[type="file"]:hover::file-selector-button,
.avatar-form input[type="file"]:focus::file-selector-button {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.avatar-form input[type="file"]:hover::-webkit-file-upload-button,
.avatar-form input[type="file"]:focus::-webkit-file-upload-button {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.hint { font-size: 0.78rem; color: var(--ink-soft); }

/* Theme picker — pure visual previews (no names/descriptions): each tile
   renders the exact same gradient + animation as the real card background,
   so picking a theme is just picking the photo you see. */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}
.theme-tile {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--line);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s var(--ease-spring);
}
.theme-tile:hover { transform: translateY(-2px); }
.theme-tile.is-selected { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
.theme-tile input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.theme-tile__preview { position: absolute; inset: 0; background-size: cover; background-position: center; background-repeat: no-repeat; }
.theme-tile__check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s var(--ease-spring);
}
.theme-tile.is-selected .theme-tile__check { opacity: 1; transform: scale(1); }

.theme-tile--classic .theme-tile__preview {
  background-image: linear-gradient(165deg, var(--blue) 0%, #60a5fa 100%);
  background-size: 200% 200%;
  animation: gradient-pan 12s ease infinite;
}
.theme-tile--premium .theme-tile__preview { background-image: url('/img/themes/premium.png'); }
.theme-tile--minimal .theme-tile__preview { background-image: url('/img/themes/minimal.png'); }
.theme-tile--anime .theme-tile__preview { background-image: url('/img/themes/anime.png'); }
.theme-tile--neon .theme-tile__preview {
  background-image: url('/img/themes/neon.png');
  animation: theme-photo-glow 7s ease-in-out infinite;
}
.theme-tile--gaming .theme-tile__preview {
  background-image: url('/img/themes/gaming.png');
  animation: theme-photo-glow 7s ease-in-out infinite;
}

.manage-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.manage-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.manage-list li form { margin: 0; }
.manage-list li { flex-wrap: wrap; align-items: flex-start; }
.manage-list li > .mono { flex: 1; min-width: 220px; padding-top: 4px; }

/* ---------- "Мои покупки" — phone verification + code transfers ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; align-items: start; }
.manage-list__actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; width: 100%; }
.manage-list__actions form { margin: 0; }
.transfer-details[open] { width: 100%; }
.transfer-details summary { cursor: pointer; list-style: none; display: inline-flex; }
.transfer-details summary::-webkit-details-marker { display: none; }
.transfer-details[open] summary { margin-bottom: 16px; }
.transfer-form { max-width: 360px; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input {
  flex: 1;
  min-width: 120px;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  outline: none;
}
.inline-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--blue-light);
  color: var(--blue);
  border-radius: 999px;
  padding: 7px 8px 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0;
}
.tag-pill button {
  border: none;
  background: rgba(37, 99, 235, 0.16);
  color: var(--blue);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}

/* ---------- Posts feed ---------- */
.post-feed { display: flex; flex-direction: column; gap: 14px; }
.post-feed--public { margin-top: 28px; }
.post-feed--public h2 { font-size: 1.15rem; margin: 0 0 4px; }
.post-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  animation: reveal-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.post-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
  border-color: var(--blue-light);
}
.post-card__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.post-card__head form { margin: 0; }
.post-card__date { font-size: 0.78rem; color: var(--ink-soft); }
.post-card p { margin: 0; font-size: 0.94rem; line-height: 1.6; white-space: pre-wrap; }

/* ---------- Analytics ---------- */
.metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.metric-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.metric-card__value { font-size: 1.5rem; font-weight: 800; color: var(--blue); }
.metric-card__label { font-size: 0.82rem; color: var(--ink-soft); }
@media (max-width: 760px) { .metric-row { grid-template-columns: repeat(2, 1fr); } }

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 180px;
  padding-top: 12px;
}
.bar-chart__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar-chart__bar {
  width: 100%;
  max-width: 28px;
  background: linear-gradient(180deg, var(--blue), #93c5fd);
  border-radius: 8px 8px 4px 4px;
}
.bar-chart__value { font-size: 0.74rem; font-weight: 700; color: var(--ink); }
.bar-chart__label { font-size: 0.72rem; color: var(--ink-soft); }

/* ---------- Pricing inside dashboard ---------- */
.pricing--dashboard { margin: 0 0 24px; max-width: none; grid-template-columns: repeat(2, 1fr); }
.price-card--current { border-color: var(--blue); }

/* ---------- Public profile page ---------- */
.profile-page { padding: 48px 0 96px; }
.profile-card {
  position: relative;
  isolation: isolate;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0 0 28px;
  overflow: hidden;
}
.profile-card__cover {
  position: relative;
  z-index: 1;
  height: 120px;
  overflow: hidden;
}

/* Selectable full-card backgrounds — see utils/themes.js for the catalogue.
   The chosen gradient now paints the *entire* card surface (not just the
   cover banner) and stays visible as a frame around the content panel
   (.profile-card__body, below), which keeps text crisp and legible no
   matter how dark, light or saturated the chosen picture is. */
.profile-card.theme-classic {
  background: linear-gradient(165deg, var(--blue) 0%, #60a5fa 100%);
  background-size: 200% 200%;
  animation: gradient-pan 12s ease infinite;
}
/* Photo-based themes paint their picture on a dedicated ::before layer
   (rather than the element's own background) so that the "glow" animation
   below — which uses `filter` — affects only the picture, never the text. */
.profile-card.theme-premium::before,
.profile-card.theme-minimal::before,
.profile-card.theme-anime::before,
.profile-card.theme-neon::before,
.profile-card.theme-gaming::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.profile-card.theme-premium::before { background-image: url('/img/themes/premium.png'); }
.profile-card.theme-minimal::before { background-image: url('/img/themes/minimal.png'); }
.profile-card.theme-anime::before { background-image: url('/img/themes/anime.png'); }
.profile-card.theme-neon::before {
  background-image: url('/img/themes/neon.png');
  animation: theme-photo-glow 7s ease-in-out infinite;
}
.profile-card.theme-gaming::before {
  background-image: url('/img/themes/gaming.png');
  animation: theme-photo-glow 7s ease-in-out infinite;
}
@keyframes theme-photo-glow {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1.16) saturate(1.3); }
}

.profile-card__head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: -44px 28px 0;
}

/* Frosted-glass content panel — floats on top of the full-bleed theme
   background so the picture's true colours stay visible around the edges
   while the text underneath remains crisp and readable on every theme. */
/* Tinted-dark glass rather than tinted-white: the smoky tint is what
   makes light text reliably readable over *any* theme picture (bright
   or dark) while the high blur+saturation still lets the picture's
   true colour wash through — genuinely see-through, not painted over. */
.profile-card__body {
  position: relative;
  z-index: 1;
  margin: 18px 16px 0;
  padding: 22px 22px 24px;
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.42), rgba(15, 23, 42, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  backdrop-filter: blur(36px) saturate(1.65);
  -webkit-backdrop-filter: blur(36px) saturate(1.65);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: rgba(241, 245, 249, 0.92);
}
.profile-card__body h1 { color: #fff; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25); }
.profile-card__body .profile-card__meta,
.profile-card__body .profile-card__stats span { color: rgba(226, 232, 240, 0.7); }
.profile-card__body .profile-card__bio { color: rgba(241, 245, 249, 0.92); }
.profile-card__body .profile-card__stats strong { color: #fff; }
.profile-card__body .profile-card__stats { border-color: rgba(255, 255, 255, 0.18); }
.profile-card__avatar {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  border: 4px solid var(--white);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  background: var(--blue-light);
  position: relative;
  transition: transform 0.3s var(--ease-spring);
}
.profile-card__avatar:hover { transform: scale(1.05) rotate(-2deg); }
.profile-card__avatar--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  font-weight: 800;
  font-size: 1.4rem;
}
.profile-card__qr {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 9px;
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 1;
}
.profile-card__qr img { display: block; }
.profile-card h1 { margin: 16px 0 4px; font-size: 1.7rem; }
.profile-card__meta { margin: 0 0 14px; color: var(--ink-soft); font-size: 0.92rem; }
.profile-card__bio { margin: 0 0 18px; font-size: 0.95rem; line-height: 1.6; }
.profile-card__tags,
.profile-card__links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip--link { text-decoration: none; }
.chip--link:hover { border-color: var(--blue); color: var(--blue); }

.profile-card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.profile-card__stats div { display: flex; flex-direction: column; }
.profile-card__stats strong { font-size: 1.1rem; }
.profile-card__stats span { font-size: 0.78rem; color: var(--ink-soft); }
.profile-card__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.profile-card__actions form { margin: 0; }

.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  font-size: 0.7rem;
  vertical-align: middle;
}

/* ---------- Catalog ---------- */
.search-form { display: flex; gap: 10px; max-width: 560px; margin: 0 auto 8px; }
.search-form input {
  flex: 1;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  outline: none;
}
.search-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
.search-form__hint { text-align: center; margin: 0 0 28px; }

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.catalog-card {
  display: flex;
  gap: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.catalog-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--blue-light); }
.catalog-card:hover .avatar { transform: scale(1.08) rotate(-3deg); }
.catalog-card__body h3 { margin: 0 0 2px; font-size: 1rem; }
.catalog-card__body p { margin: 0 0 8px; font-size: 0.82rem; }
.catalog-card__meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.8rem; color: var(--ink-soft); align-items: center; }

.avatar--lg { width: 56px; height: 56px; border-radius: 16px; font-size: 1.05rem; flex-shrink: 0; object-fit: cover; }
.avatar--md { width: 44px; height: 44px; border-radius: 13px; font-size: 0.95rem; flex-shrink: 0; object-fit: cover; }
.avatar { display: inline-flex; align-items: center; justify-content: center; transition: transform 0.2s var(--ease-spring); }

/* ---------- Chat ---------- */
.chat-list {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.chat-list__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s ease, padding-left 0.2s ease;
}
.chat-list__item:last-child { border-bottom: none; }
.chat-list__item:hover { background: var(--bg-alt); padding-left: 26px; }
.chat-list__item:hover .avatar { transform: scale(1.06); }
.chat-list__body { flex: 1; min-width: 0; }
.chat-list__row { display: flex; justify-content: space-between; gap: 12px; }
.chat-list__row strong { font-size: 0.95rem; }
.chat-list__time { font-size: 0.76rem; color: var(--ink-soft); white-space: nowrap; }
.chat-list__preview {
  margin: 2px 0 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--blue);
  color: var(--white);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0 6px;
  animation: pulse-dot 2.2s ease-out infinite, pop-in 0.3s var(--ease-spring) both;
}

.chat-suggest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.chat-suggest {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.chat-suggest:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.chat-suggest:hover .avatar { transform: scale(1.08); }
.chat-suggest div { display: flex; flex-direction: column; min-width: 0; }
.chat-suggest strong { font-size: 0.92rem; }

.section--tight { padding: 32px 0 96px; }
.dialog {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 620px;
  overflow: hidden;
  margin-top: 8px;
}
.dialog__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.dialog__head strong { display: block; font-size: 0.96rem; }
.dialog__head a { font-size: 0.8rem; text-decoration: none; }
.dialog__status { display: inline-block; margin-left: auto; font-size: 0.78rem; color: #16a34a; white-space: nowrap; }
.dialog__status.is-offline { color: #b45309; }
.dialog__status:not(.is-offline)::first-letter { display: inline-block; animation: blink-soft 1.8s ease-in-out infinite; }

.dialog__messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 72%;
  align-self: flex-start;
  background: var(--bg-alt);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  font-size: 0.9rem;
  animation: bubble-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.bubble p { margin: 0 0 4px; line-height: 1.5; white-space: pre-wrap; }
.bubble span { font-size: 0.7rem; color: var(--ink-soft); }
.bubble--mine {
  align-self: flex-end;
  background: var(--blue);
  color: var(--white);
  border-radius: 16px 16px 4px 16px;
}
.bubble--mine span { color: rgba(255,255,255,0.75); }

.dialog__typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 22px 8px;
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-style: italic;
  animation: alert-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.dialog__typing::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 10px 0 var(--blue), 20px 0 var(--blue);
  animation: typing-wave 1.1s ease-in-out infinite;
}
@keyframes typing-wave {
  0%, 60%, 100% { opacity: 0.25; }
  30% { opacity: 1; }
}
.dialog__form { display: flex; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }
.dialog__form input {
  flex: 1;
  font-family: inherit;
  font-size: 0.92rem;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  outline: none;
}
.dialog__form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .dash__inner { grid-template-columns: 1fr; }
  .dash-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
  }
  .dash-nav a { white-space: nowrap; }
  .pricing--dashboard { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .form-card { padding: 28px 22px; }
  .profile-card { padding: 0 0 16px; }
  .profile-card__head { margin: -44px 18px 0; }
  .profile-card__body { margin: 16px 10px 0; padding: 18px 16px 20px; }
  .dialog { height: 70vh; }
  .search-form { flex-direction: column; }
}

/* ---------- Marketplace: browse ---------- */
.market-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 0 0 28px;
}
.market-toolbar a.chip { text-decoration: none; }

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.market-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.market-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--blue); }
.market-card:hover .ai-score { transform: scale(1.05); }
.market-card:hover .market-card__price { color: var(--blue); }
.market-card__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.market-card__code { font-weight: 800; font-size: 1.05rem; }
.market-card__summary { margin: 0; font-size: 0.88rem; color: var(--ink-soft); line-height: 1.5; }
.market-card__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.market-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 4px; }
.market-card__price { font-weight: 800; font-size: 1.05rem; transition: color 0.2s ease; }

.tag-chip {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  transition: transform 0.2s var(--ease-spring), border-color 0.2s ease, color 0.2s ease;
}
.tag-chip:hover { transform: translateY(-2px); border-color: var(--blue); color: var(--blue); }

.ai-score {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  transition: transform 0.25s var(--ease-spring);
}
.ai-score--top { animation: status-pulse 2.6s ease-out infinite; }
.ai-score strong { font-size: 0.95rem; }
.ai-score--top { background: #f0fdf4; color: #15803d; }
.ai-score--high { background: var(--blue-light); color: var(--blue); }
.ai-score--mid { background: #fffbeb; color: #b45309; }

.chip--sale { background: var(--blue-light); color: var(--blue); border-color: transparent; }
.chip--auction { background: #fef2f2; color: #b91c1c; border-color: transparent; }

.sales-list { display: flex; flex-direction: column; gap: 8px; max-width: 720px; margin: 0 auto; }
.sales-list__item {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.sales-list__item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
  border-color: var(--blue-light);
}
.sales-list__price { margin-left: auto; font-weight: 800; color: var(--blue); }

.market-note {
  max-width: 760px;
  margin: 48px auto 0;
  background: var(--blue-light);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #1e3a5f;
}

/* ---------- Marketplace: listing detail ---------- */
.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--blue);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.2s ease, color 0.15s ease;
}
.back-link:hover { transform: translateX(-4px); color: var(--blue-dark); text-decoration: underline; }

.lot-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
}
.lot-card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.lot-card__code { font-size: 1.5rem; font-weight: 800; }

.ai-panel {
  display: flex;
  gap: 22px;
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 26px;
  animation: reveal-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ai-panel__score {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.66rem;
  line-height: 1.3;
  animation: pop-in 0.5s 0.1s var(--ease-spring) both;
}
.ai-panel__score strong {
  display: inline-block;
  animation: pop-in 0.6s 0.25s var(--ease-spring) both;
}
.ai-panel__score strong { font-size: 1.7rem; line-height: 1; margin-bottom: 2px; }
.ai-panel__body h3 { margin: 0 0 8px; font-size: 1.05rem; }
.ai-panel__body p { margin: 0 0 14px; font-size: 0.92rem; line-height: 1.6; color: var(--ink); }
.ai-panel__body .market-card__tags { margin-bottom: 12px; }
.ai-panel__body .hint { margin: 0; }

.lot-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.lot-action__label { display: block; font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 4px; }
.lot-action__price { font-size: 1.6rem; font-weight: 800; color: var(--blue); }
.lot-action__countdown { font-size: 0.88rem; color: var(--ink-soft); text-align: right; }
.lot-action__timer { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.bid-form { display: flex; gap: 10px; align-items: center; padding-top: 18px; }
.bid-form .field__prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  height: 46px;
  border: 1px solid var(--line);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--bg-alt);
  font-weight: 700;
  color: var(--ink-soft);
}
.bid-form input {
  flex: 1;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  outline: none;
}
.bid-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }

.bid-history__title { margin: 22px 0 10px; font-size: 0.98rem; }
.bid-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bid-history li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
}
.bid-history li.is-leading { border-color: var(--blue); background: var(--blue-light); }
.bid-history li span:first-child { flex: 1; }

@media (max-width: 640px) {
  .lot-card { padding: 22px; }
  .ai-panel { flex-direction: column; align-items: flex-start; }
  .lot-action { flex-direction: column; align-items: flex-start; }
  .lot-action__countdown { text-align: left; }
  .bid-form { flex-wrap: wrap; }
}

/* ---------- Admin: marketplace management ---------- */
.nav__admin { color: var(--blue) !important; font-weight: 700; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.admin-stats__item {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  text-align: center;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.admin-stats__item:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-3px);
  border-color: var(--blue-light);
}
.admin-stats__item strong { display: block; font-size: 1.5rem; font-weight: 800; color: var(--ink); transition: color 0.2s ease; }
.admin-stats__item:hover strong { color: var(--blue); }
.admin-stats__item span { font-size: 0.8rem; color: var(--ink-soft); }

.admin-form { display: flex; flex-direction: column; gap: 18px; margin-top: 6px; }
.admin-form__row { display: flex; gap: 18px; flex-wrap: wrap; }
.admin-form__row .field { flex: 1; min-width: 200px; }
.admin-form__row[hidden] { display: none; }

.admin-form__toggle { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}
.radio-pill:hover { transform: translateY(-1px); border-color: var(--blue-light); }
.radio-pill:has(input:checked) { border-color: var(--blue); color: var(--blue); background: var(--blue-light); animation: pop-in 0.3s var(--ease-spring) both; }
.radio-pill input { accent-color: var(--blue); }

.ai-preview {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  animation: reveal-up 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ai-preview__score {
  flex-shrink: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  animation: pop-in 0.4s var(--ease-spring) both;
}
.ai-preview__score strong { font-size: 1.2rem; }
.ai-preview__body strong { font-size: 0.92rem; }
.ai-preview__body p { margin: 4px 0 10px; font-size: 0.88rem; line-height: 1.55; color: var(--ink); }
.ai-preview__body .market-card__tags { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 640px) {
  .admin-form__row { flex-direction: column; }
  .ai-preview { flex-direction: column; align-items: flex-start; }
}
