/* Media Manager - 02-layout.css */

/* ---------- Shell / Sidebar ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;

  background: var(--surface-sidebar);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--border-subtle);

  padding: 14px 12px;
  z-index: 20;
}

.sidebar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 6px 10px;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.sidebar__nav {
  margin-top: 8px;
  padding: 8px 6px;
}

.sidebarGroup {
  margin: 10px 0 14px;
}

.sidebarGroup__title,
.sidebar__sectionTitle {
  color: var(--muted);
  margin: 10px 0 8px;
}

.sideItem {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 10px 10px;
  border-radius: 12px;

  border: 1px solid transparent;
  background: transparent;
  color: var(--text);

  cursor: pointer;
  text-align: left;

  transition:
    transform .12s var(--ease),
    background .12s var(--ease),
    border-color .12s var(--ease),
    box-shadow .12s var(--ease);
}

/* Sidebar items: anchors should not underline */
.sideItem {
  text-decoration: none;
  position: relative;
  /* anchor pseudo-elements consistently */
}


.sideField {
  display: block;
  margin: 0 0 10px;
}

.sideField__label {
  display: block;
  color: var(--muted);
  margin: 0 0 6px;
}

/* Content column */
.content {
  min-width: 0;
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 10;

  background: var(--surface-header);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  border-bottom: 1px solid var(--border-subtle);
}

.header__inner {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
}

/* Brand */
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.brand__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 0 4px var(--glow-1),
    0 0 18px var(--glow-2);
  transition: transform .2s var(--ease);
}

.brand:hover .brand__dot {
  transform: scale(1.08);
}

.brand__text {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: .2px;
}

/* Header tools (legacy) */
.header__tools {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
  justify-content: flex-end;

  overflow: auto;
  /* allow scroll when expanded */
  max-height: 220px;
  opacity: 1;
  transform: translateY(0);
  transition: max-height .18s var(--ease), opacity .18s var(--ease), transform .18s var(--ease);
}

.header__tools.is-collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

/* Toggle button (older layout support) */
.toolsToggle {
  height: 38px;
  width: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015));
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: transform .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}

.toolsToggle:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .35);
}

/* Hide tools + toggle when modal is open */
body.is-modal-open #headerTools,
body.is-modal-open #toolsToggle {
  display: none !important;
}

/* Form controls */
.tool {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tool__label {
  font-size: 12px;
  color: var(--muted);
}

.input,
.select {
  height: 38px;
  min-width: 170px;
  padding: 8px 10px;
  border-radius: 10px;

  border: 1px solid var(--border);
  background: var(--surface-card-2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  color: var(--text);
  outline: none;

  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}

/* Improve placeholder contrast on dark glass inputs */
.input::placeholder {
  color: rgba(185, 185, 185, .85);
}

.input:focus,
.select:focus {
  border-color: rgba(125, 211, 252, .55);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, .12);
}

/* ----- Dark theme dropdown menu fix ----- */
/* The closed <select> is styled via .select above, but the opened native menu can still be light.
   These rules + color-scheme help ensure readable options across browsers. */
.select {
  color: rgba(255, 255, 255, .92);
}

.select option,
.select optgroup {
  background-color: var(--panel);
  color: rgba(255, 255, 255, .92);
}

.select option:checked {
  background-color: rgba(125, 211, 252, .18);
  color: rgba(255, 255, 255, .95);
}

/* Buttons */
.btn {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;

  border: 1px solid var(--border);
  background: var(--surface-card-2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  color: var(--text);
  cursor: pointer;

  transition: transform .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}

.btn--ghost {
  background: transparent;
}

.btn:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .32);
}

.btn:active {
  transform: translateY(0);
}

/* ---------- Main ---------- */
.main {
  /* Keep layout fluid so the grid can use available space.
     (The grid itself is capped per breakpoint in 03-components.css.) */
  max-width: none;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.view {
  padding-top: 10px;
}

.h1 {
  margin: 6px 0 8px;
}

.h2 {
  margin: 0 0 10px;
}

.h3 {
  margin: 0 0 6px;
}

.muted {
  margin: 0 0 14px;
  color: var(--muted);
}

/* ---------- Mobile drawer behavior ---------- */
.sidebarToggle {
  display: none;
  border: 1px solid var(--border);
  background: rgba(26, 26, 26, .65);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background .15s var(--ease), transform .15s var(--ease);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sidebarToggle:hover {
  background: var(--border-soft);
  transform: translateY(-1px);
}

.sidebarToggle__text {
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
}

.sidebarOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 30;
}

.brand--header {
  display: none;
}

/* Home tile labels: ensure readable (fix black text) */
.card--home .card__title,
.card--home .card-info h3 {
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 1px 10px rgba(0, 0, 0, .55);
}

/* Optional: make the subtitle consistent too (if you have one) */
.card--home .card__sub,
.card--home .card-info p {
  color: rgba(255, 255, 255, .72);
  text-shadow: 0 1px 10px rgba(0, 0, 0, .45);
}

/* Optional “glass label strip” behind text (subtle, premium) */
.card--home .card__info,
.card--home .card-info {
  background: linear-gradient(180deg,
      rgba(0, 0, 0, 0),
      rgba(0, 0, 0, .28) 40%,
      rgba(0, 0, 0, .38));
}

/* =========================================================
   View Bar — ensure horizontal layout (title left, Filters right)
   ========================================================= */

.viewBar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start; /* align button with title line */
}

.viewBar__left {
  flex: 1 1 auto;
  min-width: 0;
}

.viewBar__right {
  flex: 0 0 auto;
  margin-left: auto;
  align-self: flex-start;
  padding-top: 2px; /* tweak 0–4px if needed */
}

/* =========================================================
   Sidebar — keep count pills pinned to the far right
   (Some earlier rules can be overridden by later blocks)
   ========================================================= */

.sideItem__main {
  flex: 1 1 auto;
  min-width: 0;
}

.sideItem__count {
  margin-left: auto !important;
}
.filtersPanel{
  margin:10px 0 14px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border-subtle);
  background:var(--surface-card);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
}

.filtersPanel__grid{
  display:flex;
  flex-wrap:wrap;
  align-items:flex-end;
  gap:10px;
}

.filtersPanel .sideField{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin:0;
  flex:1 1 190px;
  min-width:170px;
}

.filtersPanel .input,
.filtersPanel .select{
  min-width:0;
  width:100%;
}

.filtersPanel__actions{
  display:flex;
  align-items:flex-end;
  justify-content:flex-end;
  flex:0 0 auto;
  margin-left:auto;
}

@media (max-width:520px){
  .filtersPanel{padding:10px;}
  .filtersPanel__grid{gap:8px;}
  .filtersPanel .sideField{flex:1 1 100%;min-width:0;}
  .filtersPanel__actions{width:100%;margin-left:0;}
}

/* =========================================================
   Sidebar density + count alignment (tightened)
   - Compact vertical rhythm
   - Preserve hierarchy (child indent)
   - Keep count pills right-aligned
   ========================================================= */

/* Tighten group spacing (VIDEO / AUDIO labels, etc.) */
.sidebarGroup {
  margin: 10px 0 14px;       /* tighter than default */
  padding-top: 8px;          /* slightly tighter */
}

/* If you use label chips for titles, keep them compact */
.sidebarGroup__title,
.sidebar__sectionTitle {
  margin: 8px 0 6px;
}

/* Compact row height + padding */
.sideItem {
  padding: 6px 10px;
  min-height: 36px;
}

/* Slightly tighter rhythm between items */
.sideItem + .sideItem {
  margin-top: 2px;
}

/* Child items: keep indent + slightly tighter padding */
.sideItem--child {
  padding-left: 28px;
  padding-top: 4px;
  padding-bottom: 4px;
  opacity: .95;
}

/* Keep child icon aligned visually with parent icons */
.sideItem--child .sideItem__icon,
.sideItem--child .sideItem__bullet {
  /* Pull icon/bullet back a touch so indent reads as hierarchy, not misalignment */
  margin-left: -14px;
}

/* Ensure main cluster can shrink, so count stays pinned right */
.sideItem__main {
  min-width: 0;
}

/* Label truncation so counts don't shift */
.sideItem__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



/* ---------- Sidebar icon bullets (mask-based) ---------- */
/* Drawer injects:
   <span class="sideItem__bullet" style="--bullet-icon:url('...')"></span>
   If no icon is available, bullet gets: sideItem__bullet--dot
*/
.sideItem__bullet{
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin-right: 10px;

  display: inline-block;
  background-color: var(--media-accent, currentColor);
  opacity: .85;

  -webkit-mask-image: var(--bullet-icon);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;

  mask-image: var(--bullet-icon);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.sideItem__bullet--dot{
  background: none;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  box-sizing: border-box;
  opacity: .55;
}

/* Size tweaks for hierarchy (optional) */
.sideItem--parent .sideItem__bullet{ width: 1.25rem; height: 1.25rem; flex-basis: 1.25rem; }
.sideItem--child .sideItem__bullet{ width: 0.9rem; height: 0.9rem; flex-basis: 0.9rem; }


/* Count pill: always flush-right */
.sideItem__count {
  margin-left: auto;
}

/* Optional subtle de-emphasis for child counts */
.sideItem--child .sideItem__count {
  opacity: 0.85;
}

/* END Sidebar density + count alignment */

/* Sidebar group divider (replaces VIDEO/PRINT/AUDIO labels) */
.sidebar__divider {
  height: 1px;
  margin: 14px 10px;
  background: rgba(255, 255, 255, .06);
  border-radius: 999px;
}

/* ---------- Mobile drawer behavior (<= 900px) ---------- */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: min(320px, 88vw);
    transform: translateX(-102%);
    transition: transform .2s var(--ease);
    z-index: 35;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebarToggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .brand--header {
    display: flex;
  }

  .fab-home {
    left: 50%;
  }
}
