/* Layout and structure. Colors come only from theme.css (var(--ws-...)): no literal colors here. */

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--ws-body-bg), 0 0 0 0.25rem var(--ws-focus-ring);
}

/* Sticky footer: the page is a column, the content grows and the footer stays at the bottom. */
.ws-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--ws-body-bg);
  color: var(--ws-body-fg);
}

.ws-body > .container {
  flex: 1 0 auto;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ---- Header (black) ---- */

.ws-header {
  background-color: var(--ws-header-bg);
  color: var(--ws-header-fg);
  box-shadow: 0 0.25rem 0.75rem var(--ws-shadow);
}

.ws-header .navbar-brand {
  padding: 0;
}

.ws-header .ws-logo img {
  display: block;
  height: 32px;
  width: auto;
}

.ws-header .nav-link,
.ws-header .navbar-text {
  color: var(--ws-header-fg-muted);
}

.ws-header .nav-link:hover,
.ws-header .nav-link:focus {
  color: var(--ws-header-fg);
}

.ws-header .btn-link.nav-link {
  text-decoration: none;
}

.ws-header .navbar-toggler {
  border-color: var(--ws-header-fg-muted);
}

.ws-header .ws-user-name {
  color: var(--ws-header-fg);
}

.ws-publish {
  white-space: nowrap;
}

/* ---- Footer (black) ---- */

.ws-footer {
  flex-shrink: 0;
  background-color: var(--ws-footer-bg);
  color: var(--ws-footer-fg);
  padding: 1.5rem 0;
}

.ws-footer a {
  color: var(--ws-footer-fg-strong);
  text-decoration: none;
}

.ws-footer a:hover,
.ws-footer a:focus {
  color: var(--ws-footer-fg);
  text-decoration: underline;
}

.ws-footer-note {
  font-size: 0.875rem;
}

/* ---- User area side menu ---- */

.ws-user-menu-link {
  color: var(--ws-body-fg);
  border-radius: 0.375rem;
}

.ws-user-menu-link:hover {
  background-color: color-mix(in srgb, var(--ws-primary) 8%, transparent);
}

.ws-user-menu-link.active {
  background-color: var(--ws-primary);
  color: var(--ws-primary-contrast);
  font-weight: 600;
}

/* ---- OpenStreetMap component ---- */

.ws-osm-map {
  height: 320px;
  width: 100%;
  border: 1px solid var(--ws-border);
  border-radius: 0.375rem;
  z-index: 0;
}

/* ---- Listing photos page ---- */

.ws-photo-item[draggable="true"] {
  cursor: grab;
}

.ws-photo-dragging {
  opacity: 0.5;
}

.ws-photo-grid .card-img-top {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  height: auto;
}

/* ---- Listing gallery: one 4:3 frame for every photo, so the page does not jump; photos are never cropped ---- */

.ws-gallery-frame {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 70vh;
  background: var(--ws-header-bg);
  overflow: hidden;
}

/* The display of .carousel-item is Bootstrap's (none, except the slide in view): setting it here would show every slide at once. */
.ws-gallery-frame .carousel-item {
  height: 100%;
}

.ws-gallery-frame .carousel-item > a {
  display: block;
  height: 100%;
}

.ws-gallery-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---- Search results ---- */

.ws-result-photo {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.ws-result-more {
  background: var(--ws-border);
  color: var(--ws-body-fg);
  font-weight: 600;
}

.ws-result-card-featured {
  border-color: var(--ws-featured-accent);
  box-shadow: 0 0 0 1px var(--ws-featured-accent);
}

/* ---- Homepage ---- */

.ws-quick-search .nav-tabs .nav-link.active {
  border-bottom-color: var(--ws-primary);
}

/* "Destaques": a row of cards that scrolls sideways. 4 cards and the start of the 5th on desktop, 2 on tablet, 1 and the start of the next on a phone. */
.ws-featured {
  --ws-featured-gap: 1rem;
  --ws-featured-visible: 1.15;
  --ws-featured-gaps: 1;
}

@media (min-width: 576px) {
  .ws-featured {
    --ws-featured-visible: 2.25;
    --ws-featured-gaps: 2;
  }
}

@media (min-width: 992px) {
  .ws-featured {
    --ws-featured-visible: 4.25;
    --ws-featured-gaps: 4;
  }
}

.ws-featured-wrap {
  position: relative;
}

.ws-featured-track {
  display: flex;
  gap: var(--ws-featured-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  padding-bottom: 0.25rem;
}

.ws-featured-item {
  flex: 0 0 calc((100% - var(--ws-featured-gaps) * var(--ws-featured-gap)) / var(--ws-featured-visible));
  scroll-snap-align: start;
  display: flex;
}

.ws-featured-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--ws-body-bg);
  border: 1px solid var(--ws-border);
  border-radius: 0.5rem;
  overflow: hidden;
}

.ws-featured-photo {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background: var(--ws-border);
  color: var(--ws-text-secondary);
}

.ws-featured-photo img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-featured-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ws-primary-contrast);
  background: var(--ws-primary);
  border-radius: 0.5rem;
}

/* Favourite heart (_FavoriteButton): the wrapper is placed by each page, the button looks the same everywhere. */
.ws-favorite-wrap form {
  margin: 0;
}

.ws-featured-heart,
.ws-result-heart {
  position: absolute;
  z-index: 2;
  top: 0.5rem;
  right: 0.5rem;
}

.ws-detail-heart {
  flex: 0 0 auto;
}

.ws-favorite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--ws-body-fg);
  background: var(--ws-body-bg);
  border: 1px solid var(--ws-border);
  border-radius: 50%;
  cursor: pointer;
}

.ws-favorite:disabled {
  opacity: 0.6;
}

.ws-favorite[aria-pressed="true"] {
  color: var(--ws-primary);
}

.ws-favorite[aria-pressed="true"] svg {
  fill: currentColor;
}

.ws-favorite-toast {
  position: fixed;
  z-index: 1080;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  max-width: 28rem;
  margin: 0 0 0 auto;
}

.ws-favorite-toast[hidden] {
  display: none;
}

.ws-featured-body {
  flex: 1;
  padding: 0.75rem;
}

.ws-featured-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
}

.ws-featured-title a {
  color: var(--ws-body-fg);
  text-decoration: none;
}

.ws-featured-price {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.ws-featured-specs,
.ws-featured-place {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ws-text-secondary);
}

.ws-featured-nav {
  position: absolute;
  z-index: 3;
  top: 40%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--ws-body-fg);
  background: var(--ws-body-bg);
  border: 1px solid var(--ws-border);
  border-radius: 50%;
  box-shadow: 0 0.125rem 0.5rem var(--ws-shadow);
}

.ws-featured-nav[hidden] {
  display: none;
}

.ws-featured-nav:disabled {
  opacity: 0.4;
}

.ws-featured-prev {
  left: -0.75rem;
}

.ws-featured-next {
  right: -0.75rem;
}

.ws-featured-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.ws-featured-dots[hidden] {
  display: none;
}

.ws-featured-dot {
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  background: var(--ws-border);
  border: 0;
  border-radius: 50%;
}

.ws-featured-dot.active {
  background: var(--ws-primary);
}

/* ---- Multiple selection dropdown ---- */

.ws-multiselect {
  position: relative;
}

/* Without JavaScript the panel is a plain list; with it, a dropdown under the button. */
.ws-multiselect.is-enhanced .ws-ms-panel {
  position: absolute;
  z-index: 1050;
  top: 100%;
  left: 0;
  min-width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  background: var(--ws-body-bg);
  border: 1px solid var(--ws-border);
  border-radius: 0.375rem;
  box-shadow: 0 0.25rem 0.75rem var(--ws-shadow);
}

.ws-ms-list {
  max-height: 16rem;
  overflow-y: auto;
}

.ws-ms-group {
  margin-bottom: 0.5rem;
}

.ws-ms-heading {
  float: none;
  width: auto;
  margin: 0.25rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ws-text-secondary);
}

.ws-ms-toggle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Public listing page ---- */

.ws-price {
  color: var(--ws-price-color);
}

.ws-description {
  white-space: pre-line;
}

/* Contact form honeypot: out of sight for people and assistive technology, still present for robots. */
.ws-hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Search results: side filters and active filters ---- */

.ws-filter-group {
  min-width: 0;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

.ws-filter-title {
  float: none;
  width: auto;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ws-text-secondary);
}

.ws-filters-form .form-check-label {
  font-size: 0.9rem;
}

.ws-filter-chip {
  padding: 0.4rem 0.6rem;
  font-weight: 500;
  color: var(--ws-body-fg);
  background: var(--ws-body-bg);
  border: 1px solid var(--ws-border);
}

.ws-chip-remove {
  margin-left: 0.4rem;
  color: var(--ws-text-secondary);
  text-decoration: none;
}

/* The narrow bar of the collapsed side exists only when the script marked the page (the class is set before the page is painted). */
.ws-filters-bar {
  display: none;
  flex-direction: column;
  align-items: center;
}

@media (min-width: 992px) {
  html.ws-filters-collapsed .ws-filters-col {
    flex: 0 0 auto;
    width: 3.5rem;
  }

  html.ws-filters-collapsed .ws-results-col {
    flex: 1 1 0;
    width: auto;
  }

  html.ws-filters-collapsed .ws-filters-expanded {
    display: none;
  }

  html.ws-filters-collapsed .ws-filters-bar {
    display: flex;
  }
}

/* ---- Wish pages ---- */

/* "Novo" and a deadline that is about to end use the primary color of the palette. */
.ws-new-badge {
  background-color: var(--ws-primary);
  color: var(--ws-primary-contrast);
  font-weight: 600;
}

.ws-wish-expiring {
  color: var(--ws-primary);
  font-weight: 600;
}

.ws-wish-thumb {
  width: 120px;
}

.ws-wish-thumb-photo {
  display: block;
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 0.25rem;
  margin-bottom: 0.25rem;
}

/* ---- Favourites page ---- */

.ws-favorite-photo {
  object-fit: cover;
  border-radius: 0.375rem;
  background: var(--ws-border);
}

.ws-favorite-inactive {
  opacity: 0.7;
}

/* ---- Stand profile page ---- */

.ws-profile-logo {
  max-width: 160px;
  max-height: 120px;
  object-fit: contain;
  border: 1px solid var(--ws-border);
  border-radius: 0.375rem;
}

.ws-profile-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ws-primary-contrast);
  background: var(--ws-primary);
  border-radius: 0.5rem;
}

.ws-hours-name {
  min-width: 8rem;
}

/* ---- Stand public page ---- */

.ws-stand-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border: 1px solid var(--ws-border);
  border-radius: 0.5rem;
  background: var(--ws-body-bg);
}

.ws-stand-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--ws-primary);
  color: var(--ws-primary-contrast);
  font-size: 2.5rem;
  font-weight: 600;
}

.ws-stand-open {
  background: var(--ws-open-bg);
  color: var(--ws-open-fg);
}

.ws-stand-closed {
  background: var(--ws-closed-bg);
  color: var(--ws-closed-fg);
}

.ws-stand-actions {
  min-width: 11rem;
}

/* The name of a stand on a card or in the seller box: a link that stays clickable above the stretched link of the card. */
.ws-seller-link {
  position: relative;
  z-index: 2;
}

/* ---- Seller statistics chart ---- */

.ws-chart-views {
  stroke: var(--ws-chart-views);
}

.ws-chart-contacts {
  stroke: var(--ws-chart-contacts);
  stroke-dasharray: 6 3;
}

.ws-chart-reveals {
  stroke: var(--ws-chart-reveals);
  stroke-dasharray: 2 3;
}

/* ---- Account card of the header (TSK-0167): round image or initials, and the name, in one link ---- */

.ws-account-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2rem;
  padding: 0.25rem 0;
  color: var(--ws-header-fg);
  text-decoration: none;
}

.ws-account-badge:hover {
  color: var(--ws-header-fg);
  text-decoration: underline;
}

.ws-account-badge:focus-visible {
  outline: 2px solid var(--ws-header-fg);
  outline-offset: 3px;
  border-radius: 1rem;
}

/* The image and the initials have the same size, so the header does not change when a stand adds a logo. */
.ws-avatar {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--ws-header-fg);
}

.ws-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--ws-primary);
  color: var(--ws-primary-contrast);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
}

.ws-account-name {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 991.98px) {
  /* In the collapsed menu the name has the whole line. */
  .ws-account-name {
    max-width: calc(100vw - 6rem);
  }
}

/* Share menu of "Os meus anúncios" (a <details>: it opens without JavaScript). */
.ws-share { position: relative; display: inline-block; }
.ws-share > summary { list-style: none; cursor: pointer; }
.ws-share > summary::-webkit-details-marker { display: none; }
.ws-share-menu {
    position: absolute;
    z-index: 1000;
    min-width: 11rem;
    margin: .25rem 0 0;
    padding: .25rem 0;
    background: var(--ws-body-bg);
    border: 1px solid var(--ws-border);
    border-radius: .375rem;
}
.ws-share-item {
    display: block;
    width: 100%;
    padding: .375rem 1rem;
    color: inherit;
    text-align: left;
    text-decoration: none;
    background: none;
    border: 0;
}
.ws-share-item:hover, .ws-share-item:focus-visible { background-color: color-mix(in srgb, var(--ws-primary) 8%, transparent); }
.ws-share-item:focus-visible, .ws-share > summary:focus-visible { outline: 2px solid var(--ws-focus-ring); outline-offset: 2px; }
