/* ── Component: GalleryPage full-page overlay ──
 * Class prefix: gal-
 */

/* ── GalleryPage — full-page overlay ── */
.gal-page {
  position: fixed;
  top: var(--topbar-h, 0);
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 400;
  background: var(--bg-primary, #080B14);
  display: flex;
  flex-direction: column;
  animation: galFadeIn 0.25s ease-out;
}
@keyframes galFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ── */
.gal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.gal-back-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.gal-back-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.gal-header-title {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}
.gal-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.gal-upload-btn {
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  background: var(--accent-primary, #7C6FF7);
  color: #fff;
}
.gal-upload-btn:hover {
  background: var(--accent-hover, #6B5CE7);
  transform: translateY(-1px);
}

/* ── Toolbar ── */
.gal-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.gal-search-input {
  flex: 1;
  min-width: 180px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.gal-search-input:focus {
  border-color: var(--accent-primary, #7C6FF7);
}
.gal-search-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}
.gal-filter-select {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}
.gal-filter-select option {
  background: #1a1d2e;
  color: #fff;
}

/* Tag pills */
.gal-tag-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.gal-tag-pill {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.15s;
}
.gal-tag-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.gal-tag-pill.active {
  background: var(--accent-primary, #7C6FF7);
  color: #fff;
  border-color: var(--accent-primary, #7C6FF7);
}

/* View toggle */
.gal-view-toggle {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 2px;
}
.gal-view-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.gal-view-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Favourite filter */
.gal-fav-btn {
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.gal-fav-btn.active {
  color: #f5c542;
  border-color: #f5c542;
  background: rgba(245, 197, 66, 0.1);
}

/* ── Body ── */
.gal-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 20px 24px;
}

/* ── Grid view ── */
.gal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* ── Card ── */
.gal-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.gal-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.gal-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}
.gal-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s;
}
.gal-card-img.loading {
  opacity: 0;
}
.gal-card-img.loaded {
  opacity: 1;
}

/* Skeleton shimmer */
.gal-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.02) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.02) 75%);
  background-size: 200% 100%;
  animation: galShimmer 1.5s infinite;
}
@keyframes galShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.gal-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
}
.gal-card-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.3);
  transition: color 0.15s;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
.gal-card-fav.active {
  color: #f5c542;
}

.gal-card-meta {
  padding: 10px 12px;
}
.gal-card-filename {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gal-card-info {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 4px;
  display: flex;
  gap: 8px;
}

/* ── List view ── */
.gal-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gal-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.gal-list-row:hover {
  background: rgba(255, 255, 255, 0.04);
}
.gal-list-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.02);
}
.gal-list-name {
  flex: 1;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gal-list-id {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  width: 80px;
  flex-shrink: 0;
}
.gal-list-source {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  width: 60px;
  flex-shrink: 0;
}
.gal-list-date {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  width: 100px;
  flex-shrink: 0;
  text-align: right;
}
.gal-list-fav {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}
.gal-list-fav.active {
  color: #f5c542;
}

/* ── Detail drawer ── */
.gal-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.5);
  animation: galFadeIn 0.15s ease-out;
}
.gal-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 90vw);
  z-index: 501;
  background: var(--bg-primary, #080B14);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  animation: galSlideIn 0.25s ease-out;
  overflow-y: auto;
}
@keyframes galSlideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.gal-drawer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.gal-drawer-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.gal-drawer-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.gal-drawer-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gal-drawer-img-wrap {
  padding: 16px 20px;
  flex-shrink: 0;
}
.gal-drawer-img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.gal-drawer-section {
  padding: 12px 20px;
}
.gal-drawer-section-title {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.gal-drawer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}
.gal-drawer-label {
  color: rgba(255, 255, 255, 0.4);
}
.gal-drawer-value {
  color: rgba(255, 255, 255, 0.8);
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

/* Editable fields */
.gal-drawer-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 13px;
  outline: none;
  margin-top: 4px;
  transition: border-color 0.15s;
}
.gal-drawer-input:focus {
  border-color: var(--accent-primary, #7C6FF7);
}
.gal-drawer-textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 13px;
  outline: none;
  margin-top: 4px;
  min-height: 60px;
  resize: vertical;
  font-family: inherit;
}

/* Tag editor */
.gal-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.gal-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  background: rgba(124, 111, 247, 0.15);
  color: var(--accent-primary, #7C6FF7);
}
.gal-tag-remove {
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.gal-tag-remove:hover {
  opacity: 1;
}

/* Drawer actions */
.gal-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: auto;
  flex-shrink: 0;
}
.gal-action-btn {
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.gal-action-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.gal-action-btn.danger {
  color: #e74c3c;
  border-color: rgba(231, 76, 60, 0.3);
}
.gal-action-btn.danger:hover {
  background: rgba(231, 76, 60, 0.1);
}
.gal-action-btn.primary {
  background: var(--accent-primary, #7C6FF7);
  color: #fff;
  border-color: var(--accent-primary, #7C6FF7);
}
.gal-action-btn.primary:hover {
  background: var(--accent-hover, #6B5CE7);
}

/* ── Pagination ── */
.gal-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  flex-shrink: 0;
}
.gal-page-btn {
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.gal-page-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.gal-page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.gal-page-info {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

/* ── Empty state ── */
.gal-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
}
.gal-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}
.gal-empty-text {
  font-size: 14px;
  margin-bottom: 4px;
}
.gal-empty-sub {
  font-size: 12px;
  opacity: 0.6;
}

/* ── Drag & drop overlay ── */
.gal-dropzone {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(124, 111, 247, 0.15);
  border: 3px dashed var(--accent-primary, #7C6FF7);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.gal-dropzone-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-primary, #7C6FF7);
}

/* ── Toast (reuse existing pattern) ── */
.gal-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 13px;
  z-index: 700;
  backdrop-filter: blur(12px);
  animation: galFadeIn 0.2s ease-out;
}

/* ── Mobile responsive ── */
@media (max-width: 768px) {
  .gal-header { padding: 12px 16px; }
  .gal-toolbar { padding: 10px 16px; }
  .gal-body { padding: 16px; }
  .gal-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
  .gal-drawer {
    width: 100vw;
  }
  .gal-list-source,
  .gal-list-id { display: none; }
}
