/*
 * Wiki Loves Monuments Serbia — app2, version 0.2.1
 *
 * This stylesheet intentionally contains only the new layout refinements.
 * The original app.css remains available and unchanged, making rollback easy.
 *
 * Layout goals:
 *   - Give the results list most of the left column's height.
 *   - Keep the personal photo lists one click away.
 *   - Keep source/licensing information accessible without a permanent footer.
 */

:root {
  --app2-accent: #94243b;
  --app2-border: #e7e8ec;
  --app2-surface: #fff;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Sidebar and efficient results list */
.layout:not(.details-open) > .sidebar {
  position: relative;
  overflow: hidden;
}

.sidebar .panel-top {
  padding: 10px 12px 8px;
  flex: 0 0 auto;
}

.sidebar .panel-top h1 {
  font-size: 18px;
  line-height: 1.25;
  margin: 0 0 5px;
}

.sidebar .panel-top .intro {
  font-size: 11px;
  line-height: 1.4;
  margin: 0 0 6px;
}

.sidebar .search {
  margin: 5px 0 8px;
  min-height: 40px;
  padding: 9px 12px;
  font-size: 13px;
}

/*
 * All five category filters are always visible.
 * The original horizontal scrolling was hard to discover and cramped.
 * One wide "All" button + two rows of two categories, on every screen size.
 */
.sidebar .category-filters,
.sidebar .category-filter-bar .category-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 8px;
  padding: 0;
  overflow: visible;
  width: 100%;
  max-width: 100%;
}

.sidebar .filter-chip,
.sidebar .filter-chip.filter-all {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  gap: 5px;
  border: 1px solid var(--filter-category-border, #dddfe5);
  border-left: 3px solid var(--filter-category-color, #9ca3af);
  border-radius: 9px;
  background: var(--filter-category-bg, #fff);
  text-align: left;
  white-space: normal;
  flex-wrap: nowrap;
  box-shadow: none;
}

.sidebar .filter-chip.filter-all {
  grid-column: 1 / -1;
  min-height: 33px;
  border-left-color: var(--app2-accent);
  background: #f4f5f8;
}

.sidebar .filter-chip:not(.filter-all)[aria-pressed="true"] {
  background: var(--filter-category-selected-bg, #fff2f5);
  border-color: var(--filter-category-color, var(--app2-accent));
  box-shadow: inset 0 0 0 1px var(--filter-category-color, var(--app2-accent));
}

.sidebar .filter-chip.filter-all[aria-pressed="true"] {
  color: #fff;
  background: var(--app2-accent);
  border-color: var(--app2-accent);
}

.sidebar .filter-chip strong {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1.2;
  color: inherit;
}

.sidebar .filter-chip span:not(.category-symbol) {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.sidebar .filter-chip .category-symbol,
.sidebar .filter-chip .category-symbol svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.sidebar .filter-chip.filter-all[aria-pressed="true"] strong {
  color: #fff;
}

.sidebar-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-meta-row .stat {
  min-width: 0;
  font-size: 11px;
  line-height: 1.35;
}

.sidebar-meta-row .actions {
  flex: 0 0 auto;
  margin: 0;
}

.sidebar-meta-row .refresh {
  width: 29px;
  height: 29px;
  min-width: 29px;
  padding: 0;
  border-radius: 8px;
  font-size: 0;
}

.sidebar-meta-row .refresh::before {
  content: "↻";
  font-size: 20px;
  line-height: 1;
}

.sidebar .data-freshness {
  margin-top: 4px;
  min-height: 14px;
  font-size: 10px;
  line-height: 1.35;
}

.sidebar #data-freshness-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar > .status {
  flex: 0 0 auto;
  padding: 5px 12px 4px;
  min-height: 25px;
  font-size: 11px;
}

.sidebar > .list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1px 8px 8px;
  scrollbar-width: thin;
}

.sidebar .item-row {
  gap: 5px;
  padding: 2px 0;
}

.sidebar .list .item-open {
  min-height: 47px;
  padding: 6px 8px;
}

.sidebar .item-title {
  font-size: 12.5px;
  line-height: 1.3;
}

.sidebar .item-sub {
  margin-top: 3px;
  font-size: 10.5px;
}

.sidebar .item-upload {
  min-width: 77px;
  min-height: 37px;
  padding: 6px 8px;
  font-size: 11px;
}

.sidebar .item-upload svg {
  width: 16px;
  height: 16px;
}

/* Compact, always-accessible personal list and expandable attribution menu */
.sidebar-bottom {
  position: relative;
  z-index: 8;
  display: flex;
  align-items: stretch;
  flex: 0 0 43px;
  min-height: 43px;
  border-top: 1px solid var(--app2-border);
  background: var(--app2-surface);
}

.planner-quick-open {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 5px 13px;
  border: 0;
  background: transparent;
  color: #7b2338;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.planner-quick-open:hover,
.planner-quick-open:focus-visible {
  background: #fff1f4;
}

.planner-quick-icon {
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}

.planner-quick-count {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 23px;
  height: 23px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 12px;
  color: #fff;
  background: var(--app2-accent);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.sidebar-sources {
  position: static;
  display: flex;
  flex: 0 0 45px;
  border-left: 1px solid var(--app2-border);
}

.sidebar-sources > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  cursor: pointer;
  font-size: 21px;
  color: #596171;
  list-style: none;
}

.sidebar-sources > summary::-webkit-details-marker {
  display: none;
}

.sidebar-sources > summary:hover,
.sidebar-sources > summary:focus-visible {
  background: #f2f3f6;
}

.sidebar-sources-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 7px);
  right: 8px;
  width: min(320px, calc(100% - 16px));
  max-height: min(58vh, 360px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid #dddfe5;
  border-radius: 12px;
  background: #fff;
  color: #606a79;
  box-shadow: 0 8px 28px #18213222;
  font-size: 11px;
  line-height: 1.5;
}

.sidebar-sources[open] .sidebar-sources-popup {
  display: block;
}

.sidebar-sources-popup p {
  margin: 9px 0;
}

.sidebar-sources-popup a {
  color: #9b2944;
}

.sidebar-sources-popup .more-footer {
  gap: 9px 14px;
  margin-bottom: 9px;
}

.sidebar-sources-popup .more-footer button {
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 3px 0;
  color: #92243e;
  text-decoration: underline;
  font-size: 11px;
}

.sidebar-sources-popup .logo-attribution {
  font-size: 10px;
}

/* Download actions are important but remain visually calm. */
.planner-tools {
  padding-top: 2px;
}

.planner-tools .planner-download-main {
  background: var(--app2-accent);
  border-color: var(--app2-accent);
  color: #fff;
}

.planner-tools .planner-download-main:hover,
.planner-tools .planner-download-main:focus-visible {
  background: #73152a;
  border-color: #73152a;
}

@media (min-width: 701px) {
  .layout:not(.details-open) {
    grid-template-columns: minmax(320px, 375px) minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  /* The four-tab mobile navigation is inherited from photo-planner.css. */
  .layout:not(.details-open).mobile-list-view > .sidebar {
    padding-bottom: 76px;
  }

  .sidebar .panel-top {
    padding: 9px 10px 7px;
  }

  .sidebar .panel-top h1 {
    font-size: 17px;
  }

  .sidebar .panel-top .intro {
    margin-bottom: 3px;
  }

  .sidebar .search {
    min-height: 38px;
  }

  .sidebar > .status {
    min-height: 20px;
  }

  .sidebar-bottom {
    flex-basis: 43px;
  }
}

@media (max-height: 620px) and (min-width: 701px) {
  .sidebar .panel-top .intro,
  .sidebar .data-freshness {
    display: none;
  }
}

/* Calm, consistent spacing for rich monument details. */
.details-panel .detail-header h2 {
  letter-spacing: -0.02em;
}

.details-panel .detail-block p {
  max-width: 75ch;
}

.details-panel .detail-box,
.details-panel .detail-hero {
  border-radius: 12px;
}

.details-panel .photo-list-add {
  margin-bottom: 12px;
  border-color: #bb8d9a;
  background: #fff9fa;
}


@media (max-width: 700px) {
  .sidebar .category-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    margin: 0 0 7px;
    padding: 0;
    overflow: visible;
  }

  .sidebar .filter-chip,
  .sidebar .filter-chip.filter-all {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 39px;
    padding: 6px 7px;
    white-space: normal;
  }

  .sidebar .filter-chip.filter-all {
    min-height: 33px;
  }
}
