/* =============================================
   EuroCustomAutos — Gallery page
   ============================================= */

/* --- Search & filter bar --- */
.gallery-toolbar {
  padding: 32px 0 0;
  border-bottom: 1px solid var(--border);
  background: var(--concrete);
  position: sticky;
  top: var(--nav-height);
  z-index: 100;
}

.gallery-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.gallery-search-wrap {
  flex: 1;
  position: relative;
  max-width: 480px;
}
.gallery-search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dust);
  pointer-events: none;
}
.gallery-search {
  width: 100%;
  padding: 10px 14px 10px 42px;
  font-size: 14px;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--asphalt);
  background: var(--offwhite);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition);
}
.gallery-search::placeholder { color: var(--dust); opacity: 0.7; }
.gallery-search:focus { border-color: var(--asphalt); }

.gallery-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--border-strong);
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--dust);
  transition: background var(--transition);
}
.gallery-search-clear.visible { display: flex; }
.gallery-search-clear:hover { background: var(--asphalt); color: var(--concrete); }

.gallery-result-count {
  font-size: 13px;
  color: var(--dust);
  white-space: nowrap;
  margin-left: auto;
}
.gallery-result-count strong { color: var(--asphalt); }

/* Filter chips */
.gallery-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 16px;
  -ms-overflow-style: none;
}
.gallery-filters::-webkit-scrollbar { display: none; }

.filter-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--dust);
  background: var(--offwhite);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.filter-chip:hover { color: var(--asphalt); border-color: var(--asphalt); }
.filter-chip.active {
  background: var(--asphalt);
  color: var(--concrete);
  border-color: var(--asphalt);
}
/* Volt on one chip — the "All" active state */
.filter-chip[data-tag="all"].active {
  background: var(--asphalt);
  border-color: var(--asphalt);
  color: var(--concrete);
}
.filter-chip[data-tag="all"].active::after {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--volt);
  border-radius: 50%;
  margin-left: 2px;
}

/* --- Gallery grid --- */
.gallery-section { padding: 40px 0 80px; }

.gallery-grid {
  columns: 3;
  column-gap: 8px;
}
.gallery-item {
  break-inside: avoid;
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: var(--offwhite);
  border: 1px solid var(--border);
}
.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.4s ease;
}
.gallery-item:hover img { transform: scale(1.03); }

/* Video play badge */
.gallery-item-play {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(26,26,26,0.6);
  color: var(--offwhite);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
  transition: background 0.3s ease;
}
.gallery-item-play svg { margin-left: 2px; }
.gallery-item:hover .gallery-item-play { background: var(--volt); color: var(--asphalt); }

/* Hover overlay */
.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26,26,26,0);
  display: flex;
  align-items: flex-end;
  padding: 16px;
  transition: background 0.3s ease;
}
.gallery-item:hover .gallery-item-overlay { background: rgba(26,26,26,0.55); }

.gallery-item-caption {
  color: var(--concrete);
  font-size: 12px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gallery-item:hover .gallery-item-caption { opacity: 1; transform: translateY(0); }

.gallery-item-tags {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.gallery-item:hover .gallery-item-tags { opacity: 1; }
.gallery-item-tag {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  padding: 2px 7px;
  background: rgba(232,228,220,0.9);
  color: var(--asphalt);
  border-radius: var(--radius-pill);
}

/* Placeholder cards (before API loads) */
.gallery-placeholder {
  break-inside: avoid;
  margin-bottom: 8px;
  background: var(--offwhite);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-placeholder-inner {
  width: 100%;
  padding-top: 100%;
  position: relative;
  background: linear-gradient(90deg, var(--offwhite) 0%, var(--concrete) 50%, var(--offwhite) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* Empty / no results state */
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  color: var(--dust);
}
.gallery-empty h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--asphalt);
  margin-bottom: 8px;
}
.gallery-empty p { font-size: 15px; }

/* Load more */
.gallery-load-more {
  text-align: center;
  margin-top: 40px;
}

/* --- Lightbox --- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.94);
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 24px;
}
.lightbox-overlay.open { opacity: 1; pointer-events: auto; }

.lightbox {
  position: relative;
  max-width: 960px;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 320px;
  background: var(--offwhite);
  border-radius: var(--radius);
  overflow: hidden;
  transform: scale(0.97);
  transition: transform 0.25s ease;
  max-height: 90vh;
}
.lightbox-overlay.open .lightbox { transform: scale(1); }

.lightbox-image-wrap {
  background: var(--asphalt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 400px;
}
.lightbox-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lightbox-image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--dust);
  opacity: 0.3;
  padding: 48px;
}
.lightbox-image-placeholder svg { width: 48px; height: 48px; }

.lightbox-info {
  display: flex;
  flex-direction: column;
  padding: 28px;
  overflow-y: auto;
  max-height: 90vh;
}
.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.lightbox-account {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lightbox-avatar {
  width: 32px; height: 32px;
  background: var(--asphalt);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--concrete);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
}
.lightbox-username {
  font-size: 13px;
  font-weight: 500;
  color: var(--asphalt);
}
.lightbox-close {
  width: 28px; height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--dust);
  cursor: pointer;
  background: none;
  flex-shrink: 0;
  transition: var(--transition);
}
.lightbox-close:hover { border-color: var(--asphalt); color: var(--asphalt); }

.lightbox-caption {
  font-size: 14px;
  color: var(--asphalt);
  line-height: 1.7;
  flex: 1;
  white-space: pre-line;
  word-break: break-word;
}
.lightbox-hashtag { color: var(--dust); }

.lightbox-meta {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lightbox-date {
  font-size: 12px;
  color: var(--dust);
}
.lightbox-ig-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--asphalt);
  border-bottom: 2px solid var(--volt);
  padding-bottom: 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}
.lightbox-ig-link:hover { border-color: var(--asphalt); }

/* Prev / next */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  background: rgba(232,228,220,0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--asphalt);
}
.lightbox-nav:hover { background: var(--concrete); }
.lightbox-prev { left: -52px; }
.lightbox-next { right: -52px; }

/* --- Setup notice (shown when token not configured) --- */
.ig-setup-notice {
  background: var(--offwhite);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  max-width: 540px;
  margin: 0 auto;
}
.ig-setup-notice h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--asphalt);
  margin-bottom: 10px;
}
.ig-setup-notice p {
  font-size: 14px;
  color: var(--dust);
  line-height: 1.7;
  margin-bottom: 20px;
}
.ig-setup-steps {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.ig-setup-step {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--dust);
  align-items: flex-start;
}
.ig-setup-step-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  background: var(--asphalt);
  color: var(--concrete);
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.ig-setup-step a { color: var(--asphalt); border-bottom: 1px solid var(--border); transition: border-color var(--transition); }
.ig-setup-step a:hover { border-color: var(--asphalt); }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .lightbox { grid-template-columns: 1fr; max-width: 540px; }
  .lightbox-image-wrap { min-height: 320px; max-height: 400px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}
@media (max-width: 768px) {
  .gallery-grid { columns: 2; }
  .gallery-search-row { flex-wrap: wrap; }
  .gallery-result-count { order: 3; width: 100%; margin-left: 0; padding-bottom: 4px; }
}
@media (max-width: 480px) {
  .gallery-grid { columns: 1; }
}
