/* like-it — общие стили (ПК + мобильный) */
:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --text: #2b2724;
  --muted: #8a8178;
  --line: #ece5dc;
  --accent: #e05a6d;
  --accent-soft: #fdeef0;
  --ok: #3f9d6e;
  --danger: #d64545;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(43, 39, 36, .08), 0 4px 14px rgba(43, 39, 36, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Шапка ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 247, 242, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.logo {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.3px;
  color: var(--text);
}
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}
.nav a:hover { background: var(--accent-soft); text-decoration: none; color: var(--accent); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.header-user { color: var(--muted); font-size: 14px; font-weight: 600; }

/* ---------- Контент ---------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}
.page-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
}
.page-title h1 { font-size: 24px; margin: 0; }
.page-title .spacer { flex: 1; }

/* ---------- Кнопки и поля ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }

input[type="text"], input[type="password"], input[type="url"], input[type="number"],
input[type="search"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 90px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span, .field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field-row > * { flex: 1; min-width: 120px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- Карточки-плитки ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform .12s ease;
}
.tile:hover { transform: translateY(-2px); }
.tile-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #f6e3e0, #f3ede1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
}
.tile-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, .92);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}
.tile-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tile-title { font-weight: 700; font-size: 15.5px; }
.tile-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.tile-icons { display: flex; gap: 8px; font-size: 13px; }
.tile-icons a { color: var(--muted); text-decoration: none; }
.tile-icons a:hover { color: var(--accent); }
.tile-author { font-size: 12.5px; color: var(--muted); margin-top: auto; }
.tile-author b { color: var(--text); }

/* ---------- Чипы категорий ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Панель поиска ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type="search"] { flex: 1; min-width: 200px; max-width: 360px; }

/* ---------- Форма карточки ---------- */
.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  max-width: 640px;
}
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { accent-color: var(--accent); width: 17px; height: 17px; }

/* ---------- Фото в карточке ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #f3ede1; }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.55); color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer;
}
.upload-drop {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 8px;
}
.upload-drop:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Просмотр карточки ---------- */
.view-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.view-photos img { width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; }
.view-meta { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.view-meta .row { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.view-meta .k { color: var(--muted); font-size: 13px; font-weight: 700; min-width: 90px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.pill.cat { background: var(--accent-soft); color: var(--accent); }
.pill.pub { background: #e7f5ee; color: var(--ok); }
.pill.priv { background: #f1efe9; color: var(--muted); }

/* ---------- Лента ---------- */
.feed-layout { display: grid; grid-template-columns: 1fr 260px; gap: 24px; align-items: start; }
.people-panel { position: sticky; top: 76px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.people-panel h3 { margin: 0 0 10px; font-size: 15px; }
.person { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.person .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.person .name small { display: block; color: var(--muted); font-weight: 500; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}

/* ---------- Профиль ---------- */
.profile-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 20px;
}
.profile-head .avatar { width: 60px; height: 60px; font-size: 24px; }
.profile-stats { display: flex; gap: 16px; color: var(--muted); font-size: 14px; }
.profile-stats b { color: var(--text); }

/* ---------- Админка ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table.users { width: 100%; border-collapse: collapse; min-width: 640px; }
table.users th, table.users td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.users th { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; }
table.users tr:last-child td { border-bottom: none; }
.pill.role { background: #ece9fd; color: #6450d8; }
.pill.off { background: #fdeaea; color: var(--danger); }
td.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Диалог ---------- */
dialog {
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
  padding: 20px;
  width: min(440px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(43, 39, 36, .4); }
dialog h2 { margin: 0 0 14px; font-size: 18px; }

/* ---------- Теги ---------- */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.tag-pill button {
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}
.tags-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  margin-bottom: 4px;
}
.tags-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.tags-input #tags-pills { display: contents; }
.tags-input input {
  border: none;
  flex: 1;
  min-width: 120px;
  padding: 4px;
  background: transparent;
}
.tags-input input:focus {
  outline: none;
  border: none;
  box-shadow: none;
}
.chip small { opacity: .7; font-weight: 600; }
.tile-badge .tag-pill { background: rgba(255, 255, 255, .95); color: var(--accent); }

/* ---------- Прочее ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 50px 16px;
  font-size: 15px;
}
.empty .big { font-size: 42px; display: block; margin-bottom: 10px; }
.error-box {
  background: #fdeaea; color: var(--danger);
  border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px;
  display: none;
}
.error-box.show { display: block; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: min(380px, 100%); }
.login-card .logo { display: block; text-align: center; font-size: 30px; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.back-link { display: inline-block; margin-bottom: 14px; font-size: 14px; font-weight: 600; }

/* ---------- Want-it ---------- */
.tile[data-href] { cursor: pointer; }
.tile-want { margin-top: auto; padding-top: 2px; }
.tile-author:has(+ .tile-want) { margin-top: 0; }
.want-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.want-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.want-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.want-btn.static { border: none; background: none; padding: 2px 0; cursor: default; }
.want-btn.static:hover { color: var(--muted); }
.want-bar { margin-top: 14px; }

/* ---------- Мобильная версия ---------- */
@media (max-width: 760px) {
  .feed-layout { grid-template-columns: 1fr; }
  .people-panel { position: static; }
  .header-inner { padding: 8px 12px; gap: 8px; }
  .container { padding: 14px 12px 50px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .page-title h1 { font-size: 20px; }
  .header-user { display: none; }
  .btn { padding: 9px 14px; }
}
