/* Gallery Lightbox */
.glightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 9999;
  display: none; justify-content: center; align-items: center; padding: 40px;
}
.glightbox-overlay.active { display: flex; }
.glightbox-overlay img {
  max-width: 100%; max-height: 85vh; border-radius: 12px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5); object-fit: contain;
}
.glightbox-close {
  position: absolute; top: 20px; right: 25px;
  color: #fff; font-size: 36px; cursor: pointer; opacity: 0.7;
  transition: opacity 0.2s; background: none; border: none; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
}
.glightbox-close:hover { opacity: 1; }
.glightbox-nav {
  position: absolute; color: #fff; font-size: 2.5rem;
  top: 50%; transform: translateY(-50%); cursor: pointer;
  padding: 20px; user-select: none; opacity: 0.6;
  transition: opacity 0.2s; background: none; border: none;
}
.glightbox-nav:hover { opacity: 1; }
.glightbox-prev { left: 10px; }
.glightbox-next { right: 10px; }
.glightbox-caption {
  position: absolute; bottom: 25px; left: 50%; transform: translateX(-50%);
  color: #fff; background: rgba(0,0,0,0.6); padding: 8px 24px;
  border-radius: 999px; font-size: 14px; max-width: 80%;
  text-align: center; backdrop-filter: blur(4px);
}
.glightbox-counter {
  position: absolute; top: 20px; left: 25px;
  color: rgba(255,255,255,0.5); font-size: 14px;
}
.glightbox-info {
  position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.8); font-size: 13px;
  text-align: center; max-width: 80%;
}

/* Gallery Card */
.gallery-card {
  position: relative; overflow: hidden; border-radius: 16px;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow 0.3s, transform 0.3s;
  border: 1px solid #f0f0f0;
}
.gallery-card:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.1); transform: translateY(-2px);
}
.gallery-card img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  transition: transform 0.5s;
}
.gallery-card:hover img { transform: scale(1.05); }

/* Floating Action Button (for featured/publish quick toggles) */
.action-btn {
  width: 30px; height: 30px; border-radius: 8px; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; cursor: pointer; transition: all 0.2s;
}

/* Table View Action Buttons */
.table-action-btn {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; transition: all 0.2s;
}
.table-action-btn.edit { background: #ecfdf5; color: #059669; }
.table-action-btn.edit:hover { background: #a7f3d0; color: #047857; }
.table-action-btn.publish { background: #ecfdf5; color: #059669; }
.table-action-btn.publish:hover { background: #a7f3d0; color: #047857; }
.table-action-btn.unpublish { background: #fef3c7; color: #d97706; }
.table-action-btn.unpublish:hover { background: #fde68a; color: #b45309; }
.table-action-btn.feature { background: #fef3c7; color: #d97706; }
.table-action-btn.feature:hover { background: #fde68a; color: #b45309; }
.table-action-btn.feature.on { background: #f59e0b; color: #fff; }
.table-action-btn.feature.on:hover { background: #d97706; }
.table-action-btn.archive { background: #fee2e2; color: #dc2626; }
.table-action-btn.archive:hover { background: #fecaca; color: #b91c1c; }
.table-action-btn.delete { background: #fee2e2; color: #dc2626; }
.table-action-btn.delete:hover { background: #fecaca; color: #b91c1c; }

/* Gallery Badge */
.gallery-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px; font-size: 11px;
  font-weight: 500; white-space: nowrap;
}
.gallery-badge-project { background: #dbeafe; color: #1e40af; }
.gallery-badge-category { background: #fce7f3; color: #9d174d; }
.gallery-badge-year { background: #fef3c7; color: #92400e; }
.gallery-badge-featured { background: #fef3c7; color: #92400e; }
.gallery-badge-draft { background: #f3f4f6; color: #6b7280; }
.gallery-badge-published { background: #d1fae5; color: #065f46; }
.gallery-badge-archived { background: #fee2e2; color: #991b1b; }

/* Filter Bar */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
}
.filter-bar select, .filter-bar input {
  padding: 10px 16px; border: 1px solid #e5e7eb; border-radius: 12px;
  font-size: 14px; background: #fff; outline: none; 
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 160px;
}
.filter-bar select:focus, .filter-bar input:focus {
  border-color: #059669; box-shadow: 0 0 0 3px rgba(5,150,105,0.1);
}

/* Admin Gallery Tables */
.admin-gallery-grid { min-height: 200px; }
.gallery-card { width: 100%; }
.admin-gallery-table { width: 100%; border-collapse: collapse; }
.admin-gallery-table th {
  padding: 12px 16px; text-align: left; font-size: 12px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: #6b7280; background: #f9fafb; border-bottom: 1px solid #e5e7eb;
}
.admin-gallery-table td {
  padding: 12px 16px; border-bottom: 1px solid #f3f4f6; vertical-align: middle;
}
.admin-gallery-table tr:hover td { background: #f9fafb; }
.admin-gallery-table .thumb {
  width: 48px; height: 48px; border-radius: 8px; object-fit: cover;
  cursor: pointer; transition: transform 0.2s;
}
.admin-gallery-table .thumb:hover { transform: scale(1.1); }

/* Summary Cards */
.summary-card {
  padding: 20px; border-radius: 16px; background: #fff;
  border: 1px solid #f3f4f6; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex; align-items: center; gap: 16px;
}
.summary-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}

/* Upload Dropzone */
.gallery-dropzone {
  border: 2px dashed #d1d5db; border-radius: 16px; padding: 32px;
  text-align: center; cursor: pointer; transition: all 0.3s;
}
.gallery-dropzone:hover, .gallery-dropzone.dragover {
  border-color: #059669; background: #ecfdf5;
}
.gallery-preview-img {
  width: 100px; height: 100px; object-fit: cover;
  border-radius: 10px; border: 1px solid #e5e7eb;
}

/* Edit Modal */
.gallery-edit-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 9998; display: none; justify-content: center;
  align-items: center; padding: 20px; backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.gallery-edit-modal.active { display: flex; }
.gallery-edit-modal-content {
  background: #fff; border-radius: 20px; padding: 28px;
  max-width: 640px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
  animation: slideUp 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* View Toggle */
.view-toggle-btn {
  padding: 8px 16px; border-radius: 10px; font-size: 13px;
  border: 1px solid #e5e7eb; background: #fff; color: #6b7280;
  cursor: pointer; transition: all 0.2s;
}
.view-toggle-btn.active { background: #059669; color: #fff; border-color: #059669; }
.view-toggle-btn:hover:not(.active) { background: #f3f4f6; }

/* Gallery Checkbox - always visible */
.gallery-check {
  opacity: 0.8;
  transition: opacity 0.2s;
}
.gallery-check:hover {
  opacity: 1;
}

/* Scrollbar for edit modal */
.gallery-edit-modal-content::-webkit-scrollbar { width: 4px; }
.gallery-edit-modal-content::-webkit-scrollbar-track { background: transparent; }
.gallery-edit-modal-content::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* Responsive */
@media (max-width: 640px) {
  .glightbox-overlay { padding: 16px; }
  .glightbox-nav { font-size: 1.8rem; padding: 12px; }
  .glightbox-close { font-size: 28px; top: 12px; right: 14px; }
  .glightbox-caption { font-size: 12px; padding: 6px 16px; bottom: 16px; }
  .filter-bar { flex-direction: column; }
  .filter-bar select, .filter-bar input { width: 100%; min-width: unset; }
  .gallery-edit-modal-content { padding: 20px; }
}