/**
 * Layout y home desktop (≥1024px).
 * No altera la experiencia móvil/PWA por debajo de 1024px.
 *
 * Autor: Juan Morel (jcmorelm@mvisual.cl)
 */

/* Ocultar home desktop en móvil; mostrar solo el bloque móvil */
.home-desktop-only {
  display: none;
}

.glem-desktop-topbar {
  display: none;
}

/* ——— Desktop real ——— */
@media (min-width: 1024px) {
  html.glem-desktop .home-mobile-only {
    display: none !important;
  }

  html.glem-desktop .home-desktop-only {
    display: block;
  }

  html.glem-desktop body {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 0;
    padding-top: 3.5rem; /* espacio bajo menú fijo */
  }

  html.glem-desktop body::-webkit-scrollbar {
    display: block;
    width: 10px;
  }

  html.glem-desktop .bottom-bar,
  html.glem-desktop .desktop-nav-buttons {
    display: none !important;
  }

  html.glem-desktop .glem-desktop-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.65rem max(1.25rem, calc((100% - 1280px) / 2 + 1.25rem));
    background: rgba(255, 248, 225, 0.97);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(78, 52, 46, 0.08);
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  }

  html.glem-desktop .glem-desktop-topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--glem-title-color);
    font-weight: 700;
    font-size: 1.05rem;
    flex-shrink: 0;
  }

  html.glem-desktop .glem-desktop-topbar-brand img {
    width: 36px;
    height: 36px;
    object-fit: contain;
  }

  html.glem-desktop .glem-desktop-topbar-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem 0.75rem;
  }

  html.glem-desktop .glem-desktop-topbar-nav a {
    text-decoration: none;
    color: var(--glem-text);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.35rem 0.55rem;
    border-radius: 8px;
    white-space: nowrap;
  }

  html.glem-desktop .glem-desktop-topbar-nav a:hover {
    background: rgba(226, 27, 30, 0.08);
    color: var(--glem-red);
  }

  html.glem-desktop .glem-desktop-topbar-nav a.is-active {
    color: var(--glem-red);
    background: rgba(226, 27, 30, 0.1);
  }

  html.glem-desktop .main-content {
    overflow: visible;
    max-height: none;
    height: auto;
    flex: none;
    padding: 0 1.25rem 2.5rem;
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }

  html.glem-desktop .main-content::-webkit-scrollbar {
    display: block;
  }

  html.glem-desktop body.page-inner .app-inner-wrap {
    max-width: 1280px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    flex: none;
    min-height: auto;
  }

  html.glem-desktop body.page-inner .app-header {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  html.glem-desktop .page-content {
    max-width: none;
    width: 100%;
  }

  html.glem-desktop .mascotas-perdidas-list,
  html.glem-desktop #anuncios-list,
  html.glem-desktop #veterinarias-list,
  html.glem-desktop #tiendas-list,
  html.glem-desktop #adopciones-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    align-items: stretch;
  }

  html.glem-desktop .galeria-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }

  html.glem-desktop .card-anuncio {
    height: 100%;
  }

  /* ——— Home desktop ——— */
  .desktop-home {
    padding: 1rem 0 2rem;
  }

  .desktop-home-notifications {
    margin-bottom: 1rem;
  }

  .desktop-home-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .desktop-home-block {
    min-width: 0;
    padding: 1.15rem 1.15rem 1.25rem;
    border-radius: 16px;
    border: 1px solid transparent;
  }

  .desktop-home-block--full {
    margin-bottom: 1.5rem;
  }

  .desktop-home-block--perdidas {
    background: linear-gradient(160deg, rgba(226, 27, 30, 0.1) 0%, rgba(255, 255, 255, 0.55) 55%);
    border-color: rgba(226, 27, 30, 0.14);
  }

  .desktop-home-block--adopciones {
    background: linear-gradient(160deg, rgba(247, 148, 29, 0.14) 0%, rgba(255, 255, 255, 0.55) 55%);
    border-color: rgba(230, 81, 0, 0.16);
  }

  .desktop-home-block--galeria {
    background: linear-gradient(160deg, rgba(155, 85, 0, 0.1) 0%, rgba(255, 248, 225, 0.85) 50%, rgba(255, 255, 255, 0.5) 100%);
    border-color: rgba(155, 85, 0, 0.14);
  }

  .desktop-home-block--veterinarias {
    background: linear-gradient(160deg, rgba(46, 125, 50, 0.1) 0%, rgba(255, 255, 255, 0.55) 55%);
    border-color: rgba(46, 125, 50, 0.16);
  }

  .desktop-home-block--tiendas {
    background: linear-gradient(160deg, rgba(21, 101, 192, 0.1) 0%, rgba(255, 255, 255, 0.55) 55%);
    border-color: rgba(21, 101, 192, 0.14);
  }

  .desktop-home-block--colaboradores {
    background: linear-gradient(160deg, rgba(78, 52, 46, 0.08) 0%, rgba(255, 255, 255, 0.6) 55%);
    border-color: rgba(78, 52, 46, 0.12);
  }

  .desktop-home-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .desktop-home-block-head h2 {
    margin: 0;
    font-size: 0.7rem;
    line-height: 1;
  }

  .desktop-home-title-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    background: var(--glem-brown);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .desktop-home-block--perdidas .desktop-home-title-badge {
    background: var(--glem-red);
  }

  .desktop-home-block--adopciones .desktop-home-title-badge {
    background: var(--glem-orange);
  }

  .desktop-home-block--galeria .desktop-home-title-badge {
    background: var(--glem-title-color);
  }

  .desktop-home-block--veterinarias .desktop-home-title-badge {
    background: #2e7d32;
  }

  .desktop-home-block--tiendas .desktop-home-title-badge {
    background: #1565c0;
  }

  .desktop-home-block--colaboradores .desktop-home-title-badge {
    background: var(--glem-brown);
  }

  .desktop-home-ver-todos {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--glem-red);
    text-decoration: none;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .desktop-home-ver-todos:hover {
    text-decoration: underline;
  }

  .desktop-home-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .desktop-home-cards--gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .desktop-home-empty {
    margin: 0;
    grid-column: 1 / -1;
    color: var(--glem-text-muted);
    font-size: 0.9rem;
  }

  .desktop-home-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(78, 52, 46, 0.08);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
    min-height: 100%;
  }

  .desktop-home-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
  }

  .desktop-home-card-media {
    position: relative;
    aspect-ratio: 4 / 3;
    background: rgba(78, 52, 46, 0.06);
    overflow: hidden;
  }

  .desktop-home-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .desktop-home-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(78, 52, 46, 0.35);
  }

  .desktop-home-card-badge {
    position: absolute;
    top: 0.45rem;
    left: 0.45rem;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    background: rgba(226, 27, 30, 0.92);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  .desktop-home-card-body {
    padding: 0.65rem 0.7rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
  }

  .desktop-home-card-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--glem-text);
    line-height: 1.25;
  }

  .desktop-home-card-comuna {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--glem-brown);
  }

  .desktop-home-card-meta {
    margin: 0;
    font-size: 0.75rem;
    color: var(--glem-text-muted);
  }

  .desktop-home-colab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
  }

  .desktop-home-colab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 0.5rem;
    text-decoration: none;
    color: var(--glem-text);
    background: rgba(255, 255, 255, 0.65);
    border-radius: 12px;
    border: 1px solid rgba(78, 52, 46, 0.08);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
  }

  .desktop-home-colab-item img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 8px;
  }

  .desktop-home-colab-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }
}

@media (min-width: 1280px) {
  html.glem-desktop .mascotas-perdidas-list,
  html.glem-desktop #anuncios-list,
  html.glem-desktop #veterinarias-list,
  html.glem-desktop #tiendas-list,
  html.glem-desktop #adopciones-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
