/* =====================
   GALLERY STYLES
===================== */

.gallery-container {
  max-width: 1000px;
  padding-top: 40px;
}

/* Header - same style as search-bar in index */
.gallery-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 1px solid rgba(176, 176, 176, 0.2);
  flex-wrap: wrap;
}

.back-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(176, 176, 176, 0.3);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  flex-shrink: 0;
}

.back-btn:hover {
  border-color: #1a1a1a;
  background: rgba(0, 0, 0, 0.03);
}

.back-icon {
  width: 20px;
  height: 20px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.back-btn:hover .back-icon {
  opacity: 1;
}

.gallery-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-title {
  font-family: 'Special Elite', monospace;
  font-size: 0.95rem;
  font-weight: normal;
  margin: 0;
  letter-spacing: 0.02em;
  color: #1a1a1a;
}

.active-filter-label {
  font-family: 'Special Elite', monospace;
  font-size: 0.85rem;
  color: #888;
  text-transform: capitalize;
}

.active-filter-label:not(:empty)::before {
  content: '/ ';
}

.gallery-header .sentiment-filters {
  margin-left: auto;
}

/* Esconder elementos mobile em desktop */
.mobile-gallery-top,
.manifest-btn-mobile {
  display: none;
}

/* Masonry Grid */
.masonry-grid {
  column-count: 3;
  column-gap: 20px;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 20px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: 4px;
  background: #f0f0f0;
}

.masonry-item img {
  width: 100%;
  display: block;
  transition: transform 0.3s ease;
}

.masonry-item:hover img {
  transform: scale(1.03);
}

.masonry-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 15px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.masonry-item:hover .masonry-item-overlay {
  opacity: 1;
}

.masonry-sentiment {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-family: 'Special Elite', monospace;
  color: #1a1a1a;
  text-transform: capitalize;
}

.masonry-date {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  font-family: 'Special Elite', monospace;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 25px;
  font-size: 2.5rem;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  z-index: 2001;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.2s ease;
  padding: 20px 15px;
  border-radius: 4px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

.lightbox-content {
  max-width: 90%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-info {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  font-family: 'Special Elite', monospace;
}

.lightbox-sentiment {
  padding: 6px 16px;
  border-radius: 15px;
  font-size: 0.9rem;
  text-transform: capitalize;
  color: #1a1a1a;
}

.lightbox-date {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.lightbox-link {
  color: #fff;
  text-decoration: none;
  padding: 6px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.lightbox-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Loading */
.masonry-grid .loading {
  column-span: all;
  text-align: center;
  padding: 60px;
  color: #888;
  font-family: 'Special Elite', monospace;
}

/* Dark Mode */
body.dark-mode .gallery-title {
  color: #d4d4d4;
}

body.dark-mode .back-btn {
  border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .back-btn:hover {
  border-color: #d4d4d4;
  background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .back-icon {
  filter: invert(1);
}

body.dark-mode .active-filter-label {
  color: #888;
}

body.dark-mode .masonry-item {
  background: #2a2a2a;
}

body.dark-mode .gallery-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Garantir que filtros em dark mode tenham mesma cor que no index */
body.dark-mode .gallery-header .sentiment-filter {
  background: var(--sentiment-color, #3a3a3a);
  border-color: var(--sentiment-color, #555);
}

/* Responsive */
@media (max-width: 768px) {
  .masonry-grid {
    column-count: 2;
  }

  .gallery-header .sentiment-filters {
    margin-left: 0;
    width: 100%;
    margin-top: 15px;
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  /* Container igual ao index */
  .gallery-container {
    padding-top: 20px;
  }

  .masonry-grid {
    column-count: 2;
    column-gap: 12px;
  }

  .masonry-item {
    margin-bottom: 12px;
  }

  .gallery-header {
    gap: 12px;
  }

  .gallery-title {
    font-size: 0.9rem;
  }

  .active-filter-label {
    font-size: 0.8rem;
  }

  /* Esconder título e botão voltar do header em mobile */
  .gallery-header .back-btn,
  .gallery-header .gallery-title-wrapper {
    display: none;
  }

  /* =====================
     MOBILE: Header fixo unificado
     ===================== */
  .gallery-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 998;
  }

  body.dark-mode .gallery-container::before {
    background: rgba(30, 30, 30, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  /* Barra topo mobile: botão voltar + título */
  .mobile-gallery-top {
    display: flex;
    position: fixed;
    top: 15px;
    left: 15px;
    gap: 12px;
    align-items: center;
    z-index: 1000;
  }

  /* Botão voltar */
  .back-btn-mobile {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(176, 176, 176, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    flex-shrink: 0;
  }

  .back-btn-mobile:hover {
    border-color: #1a1a1a;
    background: rgba(0, 0, 0, 0.03);
  }

  .back-btn-mobile .back-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
  }

  .back-btn-mobile:hover .back-icon {
    opacity: 1;
  }

  body.dark-mode .back-btn-mobile {
    border-color: rgba(255, 255, 255, 0.2);
  }

  body.dark-mode .back-btn-mobile:hover {
    border-color: #d4d4d4;
    background: rgba(255, 255, 255, 0.05);
  }

  body.dark-mode .back-btn-mobile .back-icon {
    filter: invert(1);
  }

  /* Título mobile ao lado do botão */
  .gallery-title-mobile {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Special Elite', monospace;
  }

  .gallery-title-mobile .title-text {
    font-size: 0.95rem;
    color: #1a1a1a;
  }

  .gallery-title-mobile .active-filter-label-mobile {
    font-size: 0.85rem;
    color: #888;
    text-transform: capitalize;
  }

  .gallery-title-mobile .active-filter-label-mobile:not(:empty)::before {
    content: '/ ';
  }

  body.dark-mode .gallery-title-mobile .title-text {
    color: #d4d4d4;
  }

  body.dark-mode .gallery-title-mobile .active-filter-label-mobile {
    color: #888;
  }

  /* Botão Manifesto fixo no canto direito - redondo igual ao dark mode */
  .manifest-btn-mobile {
    display: flex;
    position: fixed;
    top: 15px;
    right: 60px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
  }

  .manifest-btn-mobile:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #c0c0c0;
  }

  .manifest-btn-mobile .mobile-icon {
    width: 18px;
    height: 18px;
  }

  .manifest-btn-mobile:hover .mobile-icon {
    transform: scale(1.1);
  }

  body.dark-mode .manifest-btn-mobile {
    background: #2a2a2a;
    border-color: #444;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  body.dark-mode .manifest-btn-mobile:hover {
    border-color: #666;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  }

  body.dark-mode .manifest-btn-mobile .mobile-icon {
    filter: invert(1);
  }

  /* Header só mostra filtros em mobile */
  .gallery-header {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
  }

  /* Filtros fixos igual ao index */
  .gallery-header .sentiment-filters {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    justify-content: center;
    padding: 10px 15px;
    z-index: 999;
    margin-left: 0;
    margin-top: 0;
    width: auto;
  }

  /* Espaço para o header fixo */
  .masonry-grid {
    margin-top: 135px;
  }

  .lightbox-prev,
  .lightbox-next {
    padding: 15px 10px;
    font-size: 1.5rem;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }

  .lightbox-info {
    flex-direction: column;
    gap: 10px;
  }
}
