/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 24px 0;
}

.filter-btn {
  font-family: var(--font-system);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sec);
  padding: 6px 16px;
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.filter-btn:hover {
  border-color: var(--red);
  color: var(--white);
}

.filter-btn.active {
  border-color: var(--red);
  color: var(--white);
  background: rgba(255, 0, 0, 0.1);
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding-bottom: 48px;
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Gallery Item */
.gallery-item {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--gray-mid);
  transition: border-color 0.3s, transform 0.3s;
}

.gallery-item:hover {
  border-color: var(--red);
  transform: translateY(-2px);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 12px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  opacity: 0;
  transition: opacity 0.3s;
}

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

.gallery-item-title {
  font-family: var(--font-system);
  font-size: 12px;
  color: var(--white);
  margin-bottom: 2px;
}

.gallery-item-meta {
  font-family: var(--font-system);
  font-size: 10px;
  color: var(--text-dim);
}

/* Category badge on item */
.gallery-item-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-family: var(--font-system);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-sec);
  border: 1px solid var(--border);
}

.gallery-item-badge.badge-clip { color: var(--red); border-color: rgba(255, 0, 0, 0.3); }
.gallery-item-badge.badge-screenshot { color: var(--green); border-color: rgba(0, 204, 102, 0.3); }
.gallery-item-badge.badge-art { color: var(--purple); border-color: rgba(204, 136, 255, 0.3); }
.gallery-item-badge.badge-highlight { color: var(--amber); border-color: rgba(255, 170, 0, 0.3); }

/* Role lock icon */
.gallery-item-lock {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--font-system);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--purple);
  border: 1px solid rgba(204, 136, 255, 0.3);
}

/* Play icon for clips */
.gallery-item-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.gallery-item-play::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent var(--white);
  margin-left: 3px;
}

.gallery-item:hover .gallery-item-play {
  opacity: 1;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 60px 24px 24px;
}

.lightbox.open {
  display: flex;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-mid);
  border-radius: 50%;
  background: transparent;
  color: var(--text-sec);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  z-index: 2001;
}

.lightbox-close:hover {
  border-color: var(--red);
  color: var(--white);
}

.lightbox-content {
  max-width: 90vw;
  max-height: 75vh;
  position: relative;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: 10px;
}

.lightbox-content iframe {
  width: 80vw;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border-mid);
  border-radius: 10px;
}

.lightbox-info {
  text-align: center;
  margin-top: 16px;
  max-width: 600px;
}

.lightbox-title {
  font-family: var(--font-gothic);
  font-size: 16px;
  color: var(--text-pri);
  margin-bottom: 4px;
}

.lightbox-meta {
  font-family: var(--font-system);
  font-size: 11px;
  color: var(--text-dim);
}

/* Lightbox navigation */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-mid);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: var(--text-sec);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}

.lightbox-nav:hover {
  border-color: var(--red);
  color: var(--white);
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

/* Empty state */
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 24px;
}

.gallery-empty p {
  font-size: 14px;
  color: var(--text-dim);
}

/* Upload Button */
.upload-btn {
  margin-left: auto;
  padding: 6px 16px;
  font-size: 11px;
  letter-spacing: 0.06em;
}

/* Upload Modal */
.upload-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.upload-modal.open {
  display: flex;
}

.upload-modal-content {
  width: 100%;
  max-width: 480px;
  padding: 32px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.upload-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.upload-modal-header h3 {
  font-size: 18px;
}

.upload-modal-close {
  position: static;
  width: 32px;
  height: 32px;
  font-size: 16px;
}

/* Form fields */
.upload-field {
  margin-bottom: 16px;
}

.upload-field label {
  display: block;
  font-family: var(--font-system);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.upload-field input[type="text"],
.upload-field select {
  width: 100%;
  padding: 10px 12px;
  background: var(--gray-lo);
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  color: var(--text-pri);
  font-family: var(--font-system);
  font-size: 13px;
  transition: border-color 0.2s;
}

.upload-field input[type="text"]:focus,
.upload-field select:focus {
  outline: none;
  border-color: var(--red);
}

.upload-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Dropzone */
.upload-dropzone {
  position: relative;
  border: 2px dashed var(--border-mid);
  border-radius: 10px;
  padding: 32px 16px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--red);
  background: rgba(255, 0, 0, 0.03);
}

.upload-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-dropzone p {
  font-family: var(--font-system);
  font-size: 13px;
  color: var(--text-sec);
  margin-bottom: 4px;
}

.upload-dropzone span {
  font-family: var(--font-system);
  font-size: 10px;
  color: var(--text-dim);
}

/* Upload preview */
.upload-preview {
  margin-bottom: 16px;
}

.upload-preview img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* Actions */
.upload-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.upload-actions .btn-primary,
.upload-actions .btn-secondary {
  padding: 10px 24px;
  font-size: 13px;
}

/* Status message */
.upload-status {
  margin-top: 12px;
  font-family: var(--font-system);
  font-size: 12px;
  text-align: center;
}

.upload-status.success { color: var(--green); }
.upload-status.error { color: var(--red); }
