/* myp7 mobile — NovoDacha brand palette */
:root {
  --brand: #131313;
  --accent: #E84619;
  --accent-dark: #C23612;
  --accent-light: #FFE9E2;
  --muted: #6b7280;
  --bg: #ffffff;
  --bg-alt: #faf8f5;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --warn: #a16207;
  --warn-bg: #fef3c7;
  --info: #1e40af;
  --info-bg: #dbeafe;
  --ok: #166534;
  --ok-bg: #dcfce7;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding-bottom: 72px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--brand);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 0.9em; }

.mobile-topbar {
  background: var(--brand);
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky; top: 0; z-index: 10;
  border-bottom: 3px solid var(--accent);
}
.mobile-topbar .brand { color: white; font-weight: 700; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.mobile-topbar .brand img { height: 26px; width: auto; filter: brightness(0) invert(1); }
.mobile-topbar .icon-btn { color: rgba(255,255,255,0.9); text-decoration: none; font-size: 0.85em; }

.mobile-main { padding: 14px; }

h1 { font-size: 1.4em; margin-top: 4px; font-weight: 700; }
h2 { font-size: 1.15em; font-weight: 600; }
h3 { font-size: 1.02em; font-weight: 600; }

.flash { padding: 10px 12px; margin-bottom: 10px; border-left: 4px solid var(--muted); background: var(--surface); border-radius: 4px; }
.flash-success { border-color: var(--ok); background: var(--ok-bg); }
.flash-danger  { border-color: var(--danger); background: var(--danger-bg); }
.flash-warning { border-color: var(--warn); background: var(--warn-bg); }
.flash-info    { border-color: var(--accent); background: var(--accent-light); }

.mobile-form label { display: block; margin: 14px 0 4px; font-weight: 500; font-size: 0.92em; }
.mobile-form input[type=text], .mobile-form input[type=email], .mobile-form input[type=password],
.mobile-form input[type=search], .mobile-form select, .mobile-form textarea, .mobile-form input[type=file] {
  width: 100%; padding: 11px 13px; font-size: 1em;
  border: 1px solid var(--border); border-radius: 6px; background: white;
  font-family: inherit;
}
.mobile-form input:focus, .mobile-form select:focus, .mobile-form textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light);
}
.btn-primary, button.btn-primary, input[type=submit].btn-primary {
  background: var(--accent); color: white; border: none; padding: 13px 20px;
  border-radius: 6px; cursor: pointer; font-size: 1em; font-weight: 600;
  width: 100%; text-align: center; text-decoration: none; display: inline-block; margin-top: 12px;
}
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font-size: inherit; text-decoration: underline; font-family: inherit; }

/* Rubric tree — matches desktop structure */
.rubric-tree { list-style: none; padding: 0; margin: 0; }
.rubric-tree details { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); margin-bottom: 6px; }
.rubric-tree details[open] { box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.rubric-tree details summary {
  list-style: none;
  padding: 12px 14px;
  cursor: pointer; font-weight: 600; color: var(--brand);
  display: flex; align-items: center; gap: 10px; user-select: none;
  min-height: 44px;
}
.rubric-tree details summary::-webkit-details-marker { display: none; }
.rubric-tree details summary::before {
  content: "+";
  width: 26px; height: 26px; flex-shrink: 0;
  text-align: center; line-height: 24px;
  color: white; background: var(--accent); border-radius: 4px;
  font-weight: 700; font-size: 1.2em;
}
.rubric-tree details[open] > summary::before { content: "−"; }
.rubric-tree details > ul { list-style: none; padding: 0 8px 8px 10px; margin: 0; border-top: 1px solid var(--border); }
.rubric-tree details details summary::before { background: var(--brand); width: 22px; height: 22px; line-height: 20px; }
.rubric-tree li.rubric-leaf { padding: 10px 12px 10px 30px; position: relative; }
.rubric-tree li.rubric-leaf::before { content: "•"; position: absolute; left: 14px; color: var(--accent); font-weight: 700; }

.rubric-tree .article-item { padding: 10px 12px 10px 30px; position: relative; font-size: 1em; display: block; }
.rubric-tree .article-item::before { content: "📄"; position: absolute; left: 6px; font-size: 0.95em; opacity: 0.6; }
.rubric-tree .article-item a { color: var(--brand); display: block; }
.rubric-tree .article-item .block-count { color: var(--muted); font-size: 0.82em; background: var(--bg-alt); padding: 1px 8px; border-radius: 10px; margin-left: 6px; }
.rubric-tree .summary-count { color: var(--muted); font-size: 0.82em; font-weight: 400; margin-left: 6px; }

.mobile-bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  background: white; border-top: 1px solid var(--border);
  padding: 6px 0; font-size: 0.75em; text-align: center;
  z-index: 10;
}
.mobile-bottom-nav a { color: var(--brand); text-decoration: none; flex: 1; padding: 4px; line-height: 1.2; }
.mobile-bottom-nav a:active { background: var(--accent-light); }

.breadcrumb { margin-bottom: 4px; font-size: 0.85em; }
.article-meta { margin-bottom: 12px; font-size: 0.88em; }

.alert-banner { padding: 12px 14px; margin: 10px 0; border-left: 4px solid var(--warn); background: var(--warn-bg); border-radius: 6px; }
.alert-banner.alert-critical { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.alert-banner.alert-info { border-color: var(--info); background: var(--info-bg); }

.article-description { background: var(--bg-alt); padding: 12px 14px; border-radius: 6px; margin: 10px 0; }

.block { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin: 12px 0; }
.block-head { font-size: 0.82em; color: var(--muted); margin-bottom: 8px; }
.block-kind { font-weight: 600; color: var(--brand); }
.block img, .block video { max-width: 100%; height: auto; border-radius: 6px; display: block; }
.block audio { width: 100%; }
.block .caption { font-size: 0.9em; color: var(--muted); margin-top: 6px; font-style: italic; }
.pdf-link { display: inline-block; padding: 12px 14px; background: var(--accent-light); border-radius: 6px; text-decoration: none; font-weight: 500; color: var(--brand); }

/* Mobile photo-pair: stack vertically */
.photo-pair { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 12px 0; }
.photo-pair .photo-col { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.photo-pair .photo-col.good { border-top: 4px solid var(--ok); }
.photo-pair .photo-col.bad { border-top: 4px solid var(--danger); }
.photo-pair .photo-col .label { font-size: 0.82em; font-weight: 700; text-transform: uppercase; margin-bottom: 8px; display: inline-block; padding: 3px 10px; border-radius: 4px; }
.photo-pair .photo-col.good .label { background: var(--ok-bg); color: var(--ok); }
.photo-pair .photo-col.bad .label { background: var(--danger-bg); color: var(--danger); }
.photo-pair img { max-width: 100%; height: auto; border-radius: 4px; }
.photo-pair .caption { font-size: 0.9em; color: var(--muted); margin-top: 6px; font-style: italic; }

.comments { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--border); }
.comment { padding: 10px 12px; background: var(--bg-alt); border-radius: 6px; margin: 8px 0; }

.user-cards { list-style: none; padding: 0; }
.user-card { background: var(--surface); border: 1px solid var(--border); padding: 12px 14px; border-radius: 8px; margin-bottom: 8px; }
.card-inactive { opacity: 0.55; }

.article-cards { list-style: none; padding: 0; }
.article-cards > li { background: var(--surface); border: 1px solid var(--border); padding: 12px; border-radius: 8px; margin-bottom: 8px; }

.admin-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 16px; }
.admin-stats > div { background: var(--surface); padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.admin-stats > div strong { display: block; font-size: 1.5em; color: var(--accent); font-weight: 700; }
.admin-stats > div span { font-size: 0.82em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

.mobile-search { display: flex; gap: 8px; margin: 10px 0; }
.mobile-search input[type=search] { flex: 1; padding: 11px 13px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 1em; }

.badge-ok { background: var(--ok-bg); color: var(--ok); padding: 2px 8px; border-radius: 10px; font-size: 0.85em; }
.badge-off { background: var(--danger-bg); color: var(--danger); padding: 2px 8px; border-radius: 10px; font-size: 0.85em; }

/* Lightbox (mobile) */
.mobile-main img:not(.no-zoom) { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.94);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 12px;
}
.lightbox[hidden] { display: none; }
.lightbox-img {
  max-width: 100vw; max-height: 90vh;
  object-fit: contain;
  cursor: zoom-out;
}
.lightbox-close {
  position: absolute; top: 12px; right: 12px;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.2); color: white; border: none;
  font-size: 2em; line-height: 1;
}

/* PDF block — mobile: hide the iframe, show action buttons only */
.pdf-block { display: block; }
.pdf-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.pdf-link, .pdf-download {
  display: block; padding: 14px 16px; text-align: center;
  background: var(--accent-light); color: var(--brand);
  border-radius: 8px; text-decoration: none; font-weight: 500;
}
.pdf-download { background: var(--bg-alt); }
.pdf-viewer { display: none; }

/* ──────────────────────────────────────────────────
   Reusable utility classes (parity with desktop)
   ────────────────────────────────────────────────── */
.thumb-sm { width: 54px; height: 54px; object-fit: cover; border-radius: 4px; display: block; }
.thumb-xs { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; display: block; }
.emoji-icon { font-size: 1.8em; line-height: 1; display: inline-block; }
.tag-good     { background: var(--ok-bg);      color: var(--ok); }
.tag-bad      { background: var(--danger-bg);  color: var(--danger); }
.tag-neutral  { background: var(--accent-light); color: var(--accent-dark); }
.tag-warn     { background: var(--warn-bg);    color: var(--warn); }
.tag-info     { background: var(--info-bg);    color: var(--info); }
.tag-critical { background: var(--danger-bg);  color: var(--danger); }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.action-row form { display: inline; }
.action-row .link-btn { padding: 4px 0; font-size: 0.9em; }
.action-row .action-danger { color: var(--danger); }

/* Mobile admin card helpers */
.m-card-row { display: flex; gap: 10px; align-items: flex-start; }
.m-card-body { flex: 1; min-width: 0; }
.m-thumb-wrap { flex-shrink: 0; }

.mobile-topbar-right { display: flex; align-items: center; gap: 10px; }
.mobile-user-name {
  color: rgba(255,255,255,0.78);
  font-size: 0.85em;
  font-weight: 500;
  padding-right: 10px;
  border-right: 1px solid rgba(255,255,255,0.22);
}
