/* Gallery Page Styles */

.gallery-page {
  padding: var(--space-2xl, 3rem) 0;
  background: linear-gradient(180deg, var(--color-light-blue, #E6EEF6) 0%, var(--color-background, #FAFAFA) 30%);
  min-height: calc(100vh - 200px);
  position: relative;
}

.gallery-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 400px;
  background-image: url('../images/watercolor-texture.svg');
  background-size: 600px 600px;
  opacity: 0.1;
  pointer-events: none;
}

.page-header {
  text-align: center;
  margin-bottom: 2rem;
}

.page-header h2 {
  margin: 0 0 0.5rem 0;
  font-size: 2rem;
}

.gallery-stats {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* Gallery Grid */
.gallery-container {
  max-width: 1200px;
  margin: 0 auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Gallery Card */
.gallery-card {
  background: var(--color-surface, #FFFFFF);
  border: 1px solid rgba(31, 41, 55, 0.04);
  border-radius: var(--radius-lg, 16px);
  overflow: hidden;
  transition: transform 200ms ease, box-shadow 200ms ease;
  cursor: pointer;
}

.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(31, 41, 55, 0.1);
}

.gallery-card .card-image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-light-blue, #E6EEF6) 0%, var(--color-background, #FAFAFA) 100%);
}

.gallery-card .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}

.gallery-card:hover .card-image img {
  transform: scale(1.04);
}

.gallery-card .card-content {
  padding: 1rem;
}

.gallery-card .card-title {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-card .card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.gallery-card .card-user {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.gallery-card .card-user:hover {
  color: var(--color-primary);
}

.gallery-card .card-user .mini-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--color-bg);
  overflow: hidden;
}

.gallery-card .card-user .mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-card .card-league {
  color: var(--color-primary);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.gallery-card .card-league:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.gallery-card .card-divider {
  color: var(--color-border);
}

/* Load More */
.load-more-container {
  text-align: center;
  margin-top: 2rem;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 4rem 2rem;
  color: var(--color-text-muted);
}

.loading-state[hidden] {
  display: none;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-3xl, 4rem) var(--space-xl, 2rem);
  background: linear-gradient(135deg, var(--color-light-blue, #E6EEF6) 0%, var(--color-background, #FAFAFA) 100%);
  border-radius: var(--radius-lg, 16px);
}

.empty-state[hidden] {
  display: none;
}

.empty-state::before {
  content: '';
  display: block;
  width: 120px;
  height: 100px;
  margin: 0 auto var(--space-lg, 1.5rem);
  background-image: url('../images/empty-state-art.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.empty-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 1rem;
}

.empty-state h3 {
  margin: 0 0 0.5rem 0;
}

.empty-state p {
  margin-bottom: 1.5rem;
}

/* Image Modal */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.image-modal:not([hidden]) {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.modal-content {
  position: relative;
  max-width: 900px;
  max-height: 90vh;
  background: var(--color-bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.7);
}

#modal-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.modal-info {
  padding: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.modal-info h3 {
  margin: 0 0 0.5rem 0;
}

.modal-info p {
  margin: 0 0 1rem 0;
  color: var(--color-text-muted);
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  font-size: 0.9rem;
}

.modal-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.modal-user:hover {
  color: var(--color-primary);
}

.modal-user .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--color-bg);
  overflow: hidden;
}

.modal-user .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-league {
  color: var(--color-primary);
  text-decoration: none;
}

.modal-league:hover {
  text-decoration: underline;
}

.modal-date {
  color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }

  .image-modal {
    padding: 1rem;
  }

  .modal-content {
    max-height: 85vh;
  }

  #modal-image {
    max-height: 50vh;
  }
}
