/* Media library /media/ — chrome on top of the admin ui.css tokens (Cleopatra).
   Ф0 minimal (login + placeholder home). Ф3 rebuilds the full search UI from the
   finalized design (design_handoff_media_library). ui.css loads first and provides
   :root vars, .card, .btn, .field, .label. */

body.media-body { background: var(--bg-page); -webkit-tap-highlight-color: transparent; }

/* Header */
.media-top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
}
.media-logo { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; background: var(--bg-page); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.media-logo img { width: 26px; height: 26px; object-fit: contain; display: block; }
.media-title { font-size: 17px; font-weight: 800; }
.media-out { flex: 0 0 auto; color: var(--text-3); text-decoration: none; font-weight: 600; font-size: 13px; }

/* Content column */
.media-wrap {
  max-width: 480px; margin: 0 auto;
  padding: 16px 14px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
.media-soon { padding: 20px 18px; }
.media-soon-h { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.media-soon p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.media-up-link { display: inline-block; margin-top: 12px; background: var(--dark); color: var(--on-dark); padding: 10px 16px; border-radius: 10px; font-weight: 700; text-decoration: none; }

/* Uploader (Ф2 minimal) */
.media-up { padding: 18px; }
.media-up-h { font-size: 17px; font-weight: 800; margin-bottom: 12px; }
.media-up-drop { display: flex; align-items: center; justify-content: center; min-height: 120px; border: 2px dashed var(--border-strong); border-radius: 12px; color: var(--muted); font-size: 14px; text-align: center; padding: 16px; cursor: pointer; }
.media-up-drop.over { border-color: var(--dark); background: var(--bg-page); }
.media-up-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.media-up-item { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 8px 10px; background: var(--bg-page); border-radius: 8px; }
.media-up-item .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-up-item .s { white-space: nowrap; color: var(--muted); }
.media-up-item .s.ok { color: var(--ok); }
.media-up-item .s.err { color: var(--danger); }

/* ── S2 feed ─────────────────────────────────────────────── */
.media-wrap { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
.mf-search { position: relative; display: flex; align-items: center; height: 44px; background: #f4f4f5; border: 1px solid #e4e4e7; border-radius: 12px; padding: 0 12px; }
.mf-mag { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 2px #52525b; position: relative; margin-right: 8px; }
.mf-mag::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 7px; height: 2px; background: #52525b; transform: rotate(45deg); }
.mf-q { flex: 1; border: 0; background: transparent; font-size: 15px; outline: none; }
.mf-q::placeholder { color: #52525b; }
.mf-clear { flex: 0 0 auto; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; color: #52525b; font-size: 20px; text-decoration: none; }

.mf-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: none; }
.mf-chips::-webkit-scrollbar { display: none; }
.mf-chip { flex: 0 0 auto; display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1px solid #e4e4e7; border-radius: 999px; background: #fff; color: #3f3f46; font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.mf-chip.on { background: #171717; color: #fff; border-color: #171717; }
.mf-chip--clear { background: #171717; color: #fff; border-color: #171717; }

.mf-count { font-size: 12.5px; color: #52525b; margin: 2px 2px 0; }

.mf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; align-items: start; }
.mf-card { background: #fff; border: 1px solid #e4e4e7; border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit; transition: transform .12s; }
.mf-card:active { transform: scale(.97); }
.mf-cover { position: relative; width: 100%; aspect-ratio: 3/4; background: #e9e9ec; }
.mf-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mf-badge { position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; background: rgba(9,9,11,.72); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.mf-play { width: 0; height: 0; border-left: 6px solid #fff; border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.mf-proc { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #52525b; font-size: 12px; }
.mf-spin { width: 15px; height: 15px; border: 2px solid #ececee; border-top-color: #171717; border-radius: 50%; animation: mfspin .7s linear infinite; }
@keyframes mfspin { to { transform: rotate(360deg); } }
.mf-cap { padding: 8px 9px 9px; display: flex; flex-direction: column; gap: 5px; }
.mf-ev { font-size: 12px; font-weight: 600; color: #171717; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mf-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.mf-tag { font-size: 10.5px; color: #3f3f46; background: #f4f4f5; border: 1px solid #e4e4e7; border-radius: 6px; padding: 1px 6px; }
.mf-more { font-size: 10.5px; color: #71717a; }

.mf-empty { text-align: center; padding: 40px 20px; color: #3f3f46; }
.mf-empty-ic { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 2px #a1a1aa; margin: 0 auto 14px; }
.mf-empty p { font-size: 15px; max-width: 260px; margin: 0 auto 14px; }

.mf-fab { position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 50%; background: #171717; color: #fff; font-size: 28px; font-weight: 300; display: flex; align-items: center; justify-content: center; text-decoration: none; box-shadow: 0 10px 24px -6px rgba(9,9,11,.5); }

/* ── S3 media card ───────────────────────────────────────── */
.mv-back { display: inline-flex; align-items: center; min-height: 44px; color: #171717; text-decoration: none; font-size: 15px; font-weight: 600; }
.mv-stage { background: #0a0a0a; border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 300px; max-height: 62vh; }
.mv-stage video, .mv-stage img { width: 100%; max-height: 62vh; object-fit: contain; display: block; }
.mv-proc { color: #a1a1aa; font-size: 14px; display: flex; align-items: center; gap: 8px; padding: 40px; }
.mv-body { display: flex; flex-direction: column; gap: 11px; padding: 4px 2px; }
.mv-meta { font-size: 13px; font-weight: 600; color: #171717; }
.mv-descr { font-size: 14px; line-height: 1.55; color: #3f3f46; margin: 0; }
.mv-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.mv-tag { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 12px; border-radius: 999px; background: #ececee; color: #171717; font-size: 13px; font-weight: 600; text-decoration: none; }
.mv-tag.ai { background: #fff; border: 1px solid #e4e4e7; color: #3f3f46; font-weight: 500; }
.mv-ai { font-size: 8.5px; font-weight: 800; color: #71717a; letter-spacing: .3px; }
.mv-legend { font-size: 11.5px; color: #71717a; }
.mv-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid #e4e4e7; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
.mv-dl { display: flex; align-items: center; justify-content: center; height: 48px; max-width: 452px; margin: 0 auto; background: #171717; color: #fff; font-size: 15px; font-weight: 600; border-radius: 12px; text-decoration: none; }

/* Login (mirrors /my/ login) */
.media-login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--bg-page); }
.media-login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; }
/* 16px inputs — else iOS Safari auto-zooms the page on focus (email has autofocus) */
.media-login .field { font-size: 16px; }
.media-login .brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 18px; }
.media-login .brand .media-logo { width: 56px; height: 56px; }
.media-login .brand .media-logo img { width: 40px; height: 40px; }
.media-login .brand .ttl { font-size: 21px; font-weight: 700; letter-spacing: -0.2px; }
.media-login .brand .sub { font-size: 13px; color: var(--text-3); }
.media-remember { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-3); }
.media-remember input { width: 18px; height: 18px; }
.media-err { background: var(--danger-bg); border: 1px solid var(--danger-bd); color: var(--danger); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.media-save { width: 100%; height: 52px; font-size: 16px; justify-content: center; margin-top: 4px; }
