/* ==========================================================================
   MASONRY GALLERY PRO - STYLESHEET
   Bố cục Masonry đa cột, tương tác Hover, Thanh điều khiển & Hộp thoại Lightbox
   Không sử dụng thư viện ngoài, tối ưu hiệu năng và Responsive
   ========================================================================== */

:root {
  --masonry-cols: 3;
  --masonry-gap: 20px;
  --masonry-border-radius: 14px;
  --masonry-transition-speed: 0.35s;
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --glass-bg: rgba(15, 23, 42, 0.75);
  --glass-border: rgba(255, 255, 255, 0.1);
}

/* Base Wrapper */
.masonry-plugin-wrapper {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  box-sizing: border-box;
}

.masonry-plugin-wrapper * {
  box-sizing: border-box;
}

/* ==========================================================================
   0. THANH LỌC ALBUM THEO NĂM / CHỦ ĐỀ (ALBUM TABS FILTER BAR)
   ========================================================================== */
.gallery-album-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 16px;
  padding: 4px 0;
}

.album-filter-btn {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
  text-decoration: none;
}

.album-filter-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
  text-decoration: none;
}

.album-filter-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  text-decoration: none;
}

.album-filter-btn .album-count-badge {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 6px;
  border-radius: 999px;
}

.album-filter-btn.active .album-count-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Ẩn triệt để ảnh khi lọc album (hoạt động hoàn hảo trên mọi layout Masonry, Grid, Mosaic, Carousel) */
.masonry-item.mg-album-hidden {
  display: none !important;
}

/* Giao diện nhập mật khẩu mở khóa Album & Toàn bộ Gallery */
.mg-album-lock-overlay,
.mg-gallery-lock-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  width: 100%;
}

.mg-album-lock-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 36px 28px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  animation: mgFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@keyframes mgFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.mg-lock-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  border: 1px solid #bfdbfe;
}

.mg-album-lock-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.mg-album-lock-card p {
  margin: 0 0 20px;
  font-size: 14px;
  color: #64748b;
  line-height: 1.5;
}

.mg-lock-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.mg-lock-password-input {
  flex: 1;
  height: 42px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: #f8fafc;
  color: #0f172a;
  box-sizing: border-box;
}

.mg-lock-password-input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.mg-lock-unlock-btn {
  height: 42px;
  padding: 0 20px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.mg-lock-unlock-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.mg-lock-error {
  color: #ef4444;
  font-size: 13px;
  font-weight: 500;
  margin-top: 10px;
  padding: 8px 12px;
  background: #fef2f2;
  border-radius: 6px;
  border: 1px solid #fecaca;
  display: none;
}

/* ==========================================================================
   1. THANH ĐIỀU KHIỂN NHANH (QUICK CONTROLS) - HIỆN ĐẠI, TINH TẾ & GỌN GÀNG
   ========================================================================== */
.gallery-controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 10px 18px;
  margin-top: 20px;
  margin-bottom: 24px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
}

.control-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.control-label {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.control-label svg {
  width: 15px;
  height: 15px;
  color: #94a3b8;
}

/* Thanh trượt zoom kích thước thay thế vị trí số cột (Clean Range Slider) */
.zoom-slider-container {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.zoom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 130px;
  height: 5px;
  border-radius: 4px;
  background: #e2e8f0;
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 20px;
}

.zoom-slider:hover {
  background: #cbd5e1;
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #2563eb;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, background 0.15s ease;
}

.zoom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #1d4ed8;
}

.zoom-slider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #2563eb;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.slider-value-badge {
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 6px;
  color: #475569;
  min-width: 36px;
  text-align: center;
  border: 1px solid #e2e8f0;
}

/* Bộ đếm ảnh thanh lịch */
.gallery-counter {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  background: #f8fafc;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.gallery-counter span {
  color: #0f172a;
  font-weight: 700;
  margin-left: 2px;
}

/* ==========================================================================
   2. BỐ CỤC MASONRY / MULTI-COLUMN (CSS NGUYÊN BẢN)
   ========================================================================== */
.masonry-container {
  column-count: var(--masonry-cols);
  column-gap: var(--masonry-gap);
  width: 100%;
  transition: column-count 0.3s ease, column-gap 0.3s ease;
}

/* Thẻ bao từng ảnh (Item) */
.masonry-item {
  break-inside: avoid;
  margin-bottom: var(--masonry-gap);
  position: relative;
  border-radius: var(--masonry-border-radius);
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transform: translateZ(0); /* Kích hoạt tăng tốc phần cứng GPU */
  transition: box-shadow var(--masonry-transition-speed) ease, transform var(--masonry-transition-speed) ease;
}

.masonry-item:hover {
  box-shadow: 0 16px 30px -10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(59, 130, 246, 0.2);
  transform: translateY(-4px);
}

/* Ảnh hiển thị */
.masonry-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  transition: transform var(--masonry-transition-speed) cubic-bezier(0.25, 1, 0.5, 1);
}

/* Tương tác di chuột (Hover phóng to nhẹ) */
.masonry-item:hover .masonry-img {
  transform: scale(1.06);
}

/* ==========================================================================
   2.1 CÁC KIỂU BỐ CỤC HIỂN THỊ ẢNH (LAYOUT MODES)
   ========================================================================== */
/* A. Bố cục Lưới Vuông Đồng Đều (Square Grid 1:1) */
.masonry-plugin-wrapper.layout-grid .masonry-container {
  display: grid !important;
  column-count: auto !important;
  column-gap: normal !important;
  grid-template-columns: repeat(var(--masonry-cols, 3), 1fr) !important;
  gap: var(--masonry-gap, 20px) !important;
}

.masonry-plugin-wrapper.layout-grid .masonry-item {
  break-inside: auto !important;
  margin-bottom: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.masonry-plugin-wrapper.layout-grid .masonry-item-media {
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.masonry-plugin-wrapper.layout-grid .masonry-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* B. Bố cục Lát Gạch Nổi Bật (Mosaic / Highlight Featured) */
.masonry-plugin-wrapper.layout-mosaic .masonry-container {
  display: grid !important;
  column-count: auto !important;
  column-gap: normal !important;
  grid-template-columns: repeat(var(--masonry-cols, 3), 1fr) !important;
  grid-auto-rows: 240px !important;
  gap: var(--masonry-gap, 20px) !important;
}

.masonry-plugin-wrapper.layout-mosaic .masonry-item {
  break-inside: auto !important;
  margin-bottom: 0 !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}

.masonry-plugin-wrapper.layout-mosaic .masonry-item:first-child {
  grid-column: span 2 !important;
  grid-row: span 2 !important;
}

.masonry-plugin-wrapper.layout-mosaic .masonry-item-media {
  flex: 1;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.masonry-plugin-wrapper.layout-mosaic .masonry-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* C. Bố cục Băng Chuyền Trượt Ngang (Carousel / Horizontal Slider) */
.masonry-plugin-wrapper.layout-carousel .masonry-container {
  display: flex !important;
  column-count: auto !important;
  column-gap: normal !important;
  overflow-x: auto !important;
  scroll-snap-type: x mandatory !important;
  gap: var(--masonry-gap, 20px) !important;
  padding-bottom: 16px !important;
  -webkit-overflow-scrolling: touch;
}

.masonry-plugin-wrapper.layout-carousel .masonry-container::-webkit-scrollbar {
  height: 6px;
}
.masonry-plugin-wrapper.layout-carousel .masonry-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}
.masonry-plugin-wrapper.layout-carousel .masonry-container::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

.masonry-plugin-wrapper.layout-carousel .masonry-item {
  flex: 0 0 calc((100% - (var(--masonry-cols, 3) - 1) * var(--masonry-gap, 20px)) / var(--masonry-cols, 3)) !important;
  min-width: 280px !important;
  scroll-snap-align: start !important;
  margin-bottom: 0 !important;
}

.masonry-plugin-wrapper.layout-carousel .masonry-item-media {
  height: 280px;
  overflow: hidden;
  position: relative;
}

.masonry-plugin-wrapper.layout-carousel .masonry-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Khối ảnh bọc riêng */
.masonry-item-media {
  position: relative;
  overflow: hidden;
  width: 100%;
}

/* Khối thông tin Tên & Ghi chú cố định bên dưới ảnh (Card Details) */
.masonry-card-details {
  padding: 14px 16px;
  background: var(--card-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.masonry-card-details .masonry-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.masonry-card-details .masonry-tag {
  font-size: 11px;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.masonry-card-details .masonry-note {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #cbd5e1;
  font-style: normal;
  display: block;
}

/* ==========================================================================
   2.2 CÁC HIỆU ỨNG RÊ CHUỘT (HOVER EFFECTS)
   ========================================================================== */
/* Hiệu ứng Đen trắng sang Màu (Grayscale to Color) */
.masonry-plugin-wrapper.hover-grayscale .masonry-img {
  filter: grayscale(100%);
  transition: filter 0.35s ease, transform var(--masonry-transition-speed) ease;
}
.masonry-plugin-wrapper.hover-grayscale .masonry-item:hover .masonry-img {
  filter: grayscale(0%);
}

/* Hiệu ứng Nâng bóng 3D (Shadow Lift) */
.masonry-plugin-wrapper.hover-lift .masonry-item {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}
.masonry-plugin-wrapper.hover-lift .masonry-item:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.4), 0 0 25px rgba(59, 130, 246, 0.3);
}

/* Hiệu ứng Ánh kim lướt qua (Shine Shimmer) */
.masonry-plugin-wrapper.hover-shine .masonry-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.25) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  transition: left 0.7s ease;
  pointer-events: none;
  z-index: 2;
}
.masonry-plugin-wrapper.hover-shine .masonry-item:hover::after {
  left: 130%;
}

/* Lớp phủ Overlay khi di chuột */
.masonry-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(15, 23, 42, 0.9) 0%,
    rgba(15, 23, 42, 0.4) 40%,
    rgba(15, 23, 42, 0.15) 100%
  );
  opacity: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  transition: opacity var(--masonry-transition-speed) ease;
  pointer-events: none;
}

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

/* Nút "Xem lớn" ở chính giữa */
.view-large-btn-wrapper {
  margin: auto;
  transform: translateY(12px) scale(0.9);
  transition: transform var(--masonry-transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}

.masonry-item:hover .view-large-btn-wrapper {
  transform: translateY(0) scale(1);
}

.btn-view-large {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--glass-bg);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.25s ease;
}

.btn-view-large:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
  transform: scale(1.05);
}

.btn-view-large svg {
  width: 18px;
  height: 18px;
}

/* Thông tin tiêu đề ảnh phía dưới */
.masonry-caption {
  transform: translateY(10px);
  transition: transform var(--masonry-transition-speed) ease;
}

.masonry-item:hover .masonry-caption {
  transform: translateY(0);
}

.masonry-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.masonry-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #cbd5e1;
}

.masonry-note {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: #e2e8f0;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   3. HỘP THOẠI LIGHTBOX (MODAL TOÀN MÀN HÌNH)
   ========================================================================== */
.masonry-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(10, 15, 29, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 20px;
}

.masonry-lightbox.active {
  opacity: 1;
  visibility: visible;
}

/* Vùng hiển thị ảnh trong Lightbox */
.lightbox-content-box {
  position: relative;
  max-width: 90vw;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: lightboxPopIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes lightboxPopIn {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.lightbox-image-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 78vh;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.lightbox-img {
  max-width: 90vw;
  max-height: 78vh;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 12px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Thanh thông tin dưới ảnh trong Lightbox */
.lightbox-info {
  margin-top: 14px;
  text-align: center;
  color: #e2e8f0;
}

.lightbox-info-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.lightbox-info-counter {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Các nút điều khiển trong Lightbox */
.lightbox-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: absolute;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
}

.lightbox-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.6);
}

.lightbox-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Nút Đóng */
.lightbox-close-btn {
  top: 24px;
  right: 24px;
}

/* Nút Lùi (Prev) & Tiến (Next) */
.lightbox-prev-btn {
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next-btn {
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev-btn:hover {
  transform: translateY(-50%) scale(1.1);
}

.lightbox-next-btn:hover {
  transform: translateY(-50%) scale(1.1);
}

/* Khóa cuộn trang khi mở Lightbox */
body.lightbox-open {
  overflow: hidden;
}

/* ==========================================================================
   4. THIẾT KẾ ĐÁP ỨNG (RESPONSIVE)
   ========================================================================== */
@media (max-width: 1024px) {
  :root {
    --masonry-cols: 3;
    --masonry-gap: 16px;
  }
}

@media (max-width: 768px) {
  :root {
    --masonry-cols: 2 !important; /* Máy tính bảng ưu tiên tối đa 2 cột */
    --masonry-gap: 14px;
  }

  .gallery-controls-bar {
    justify-content: center;
    border-radius: 10px;
    padding: 8px 12px;
    gap: 8px 12px;
  }

  .control-group {
    justify-content: center;
  }

  .lightbox-prev-btn {
    left: 10px;
  }

  .lightbox-next-btn {
    right: 10px;
  }

  .lightbox-close-btn {
    top: 14px;
    right: 14px;
  }
}

@media (max-width: 480px) {
  :root {
    --masonry-cols: 1 !important; /* Điện thoại di động tối ưu 1 cột để xem rõ nét */
    --masonry-gap: 12px;
  }

  .col-btn[data-cols="4"],
  .col-btn[data-cols="5"] {
    display: none; /* Ẩn nút 4, 5 cột trên màn hình điện thoại nhỏ */
  }

  .lightbox-btn {
    width: 40px;
    height: 40px;
  }

  .lightbox-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* ==========================================================================
   5. BẢNG ĐIỀU KHIỂN QUẢN TRỊ ADMIN (SETTINGS & AJAX DRAG-DROP)
   ========================================================================== */
.mg-settings-card {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  padding: 24px;
  margin-bottom: 24px;
}

.mg-settings-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mg-settings-desc {
  color: #64748b;
  font-size: 13px;
  margin: 0 0 20px;
}

.mg-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.mg-setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mg-setting-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.mg-setting-info h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.mg-setting-info p {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}

/* Nhóm chọn trực quan (Radio Cards) */
.mg-radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 10px;
  width: 100%;
}

.mg-radio-card {
  position: relative;
  cursor: pointer;
  border: 1.5px solid #cbd5e1;
  border-radius: 9px;
  padding: 10px 8px;
  text-align: center;
  background: #ffffff;
  transition: all 0.2s ease;
  user-select: none;
}

.mg-radio-card input {
  position: absolute;
  opacity: 0;
}

.mg-radio-card:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}

.mg-radio-card.active,
.mg-radio-card:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.mg-radio-card .card-icon {
  font-size: 22px;
  display: block;
  margin-bottom: 4px;
}

.mg-radio-card .card-title {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  display: block;
}

.mg-radio-card .card-desc {
  font-size: 10px;
  color: #64748b;
  display: block;
  margin-top: 2px;
}

.mg-zoom-hint {
  transition: all 0.2s ease;
}
.mg-zoom-hint:hover {
  border-color: #94a3b8 !important;
  background: #f1f5f9 !important;
}
.mg-zoom-hint.active {
  border-color: #2563eb !important;
  background: #eff6ff !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Công tắc chuyển đổi (Modern Toggle Switch) */
.mg-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.mg-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.mg-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.25s;
  border-radius: 34px;
}

.mg-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mg-switch input:checked + .mg-slider {
  background-color: #10b981;
}

.mg-switch input:focus + .mg-slider {
  box-shadow: 0 0 1px #10b981;
}

.mg-switch input:checked + .mg-slider:before {
  transform: translateX(22px);
}

.mg-admin-wrapper {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  padding: 24px;
  margin-top: 20px;
}

.mg-admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 24px;
}

.mg-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mg-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Lưới thẻ ảnh Drag & Drop */
.mg-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  min-height: 120px;
}

/* Thẻ ảnh riêng lẻ */
.mg-admin-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: grab;
}

.mg-admin-card:active {
  cursor: grabbing;
}

.mg-admin-card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

/* Trạng thái đang kéo (Dragging) */
.mg-admin-card.dragging {
  opacity: 0.4;
  transform: scale(0.96);
  border: 2px dashed #3b82f6 !important;
}

/* Trạng thái vị trí thả (Drag over) */
.mg-admin-card.drag-over {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
  transform: translateY(-4px);
}

/* Trạng thái ảnh bị Ẩn (Hidden) */
.mg-admin-card.is-hidden {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.mg-admin-card.is-hidden .mg-thumb-img {
  filter: grayscale(85%) opacity(50%);
}

.mg-card-header {
  position: relative;
  height: 160px;
  background: #0f172a;
  overflow: hidden;
}

.mg-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: all 0.25s ease;
}

.mg-drag-handle {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.mg-status-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-visible {
  background: #10b981;
  color: #ffffff;
}

.badge-hidden {
  background: #f59e0b;
  color: #ffffff;
}

.mg-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.mg-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mg-card-note-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 2px;
  display: block;
}

.mg-card-note-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 48px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.mg-card-note-input:focus {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.mg-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  gap: 8px;
}

/* Nút Toggle Ẩn / Hiện */
.mg-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  background: #ffffff;
  color: #334155;
  transition: all 0.2s ease;
}

.mg-toggle-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.mg-toggle-btn.is-active-btn {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}

.mg-toggle-btn.is-hidden-btn {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #92400e;
}

.mg-delete-btn {
  color: #ef4444;
  border: 1px solid #fecaca;
  background: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mg-delete-btn:hover {
  background: #fee2e2;
  border-color: #ef4444;
}

/* Toast Thông Báo Trạng Thái Ajax */
.mg-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 999999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.mg-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.mg-toast.success {
  border-left: 4px solid #10b981;
}

.mg-toast.loading {
  border-left: 4px solid #3b82f6;
}

/* ==========================================================================
   6. GIAO DIỆN QUẢN LÝ ALBUM / NĂM TRONG ADMIN (ALBUM BUILDER STYLES)
   ========================================================================== */
.mg-admin-album-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 20px;
}

.mg-admin-album-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.mg-admin-album-pill {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.mg-admin-album-pill:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.mg-admin-album-pill.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.mg-admin-album-pill .pill-count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}

.mg-admin-album-pill.active .pill-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.mg-admin-album-pill.mg-pill-dragging {
  opacity: 0.45;
  border-style: dashed;
  border-color: #2563eb;
  transform: scale(0.96);
}

.mg-album-drag-handle {
  cursor: grab;
  color: #94a3b8;
  font-size: 13px;
  user-select: none;
}

.mg-admin-album-pill:hover .mg-album-drag-handle {
  color: #475569;
}

.mg-admin-album-pill.active .mg-album-drag-handle {
  color: rgba(255, 255, 255, 0.7);
}

.mg-album-sort-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s;
}

.mg-album-sort-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.mg-admin-album-pill.active .mg-album-sort-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Khung chọn Album trên mỗi thẻ ảnh trong Admin */
.mg-card-album-select {
  width: 100%;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #1e293b;
  cursor: pointer;
}

.mg-card-album-select:focus {
  border-color: #2563eb;
  outline: none;
}

/* Badge hiển thị tên Album trên góc ảnh */
.mg-album-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(37, 99, 235, 0.9);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  pointer-events: none;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   8. TÍNH NĂNG UPLOAD ẢNH CHO NGƯỜI XEM (FRONTEND USER UPLOAD)
   ========================================================================== */
/* Tiêu đề H2 Bộ Sưu Tập và Nút Đóng Góp Ảnh Inline Sau Chữ H2 */
.gallery-heading-bar {
  margin-bottom: 20px;
  padding: 4px 0 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.gallery-heading-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gallery-heading-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.35;
  color: #0f172a;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
}

.gallery-heading-title .heading-text {
  background: linear-gradient(135deg, #0f172a 30%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.gallery-heading-subtitle {
  margin: 0;
  font-size: 14px;
  color: #64748b;
  line-height: 1.5;
}

/* Nút Đóng Góp Ảnh Inline Ngay Sau Chữ H2 - Thiết Kế Tinh Tế & Sang Trọng */
.mg-btn-user-upload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border-radius: 999px;
  border: 1px solid #3b82f6;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  vertical-align: middle;
}

.mg-btn-user-upload:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.42);
  transform: translateY(-1.5px) scale(1.02);
}

.mg-btn-user-upload:active {
  transform: translateY(0) scale(0.99);
}

.mg-btn-user-upload svg {
  flex-shrink: 0;
  stroke: #ffffff;
  transition: transform 0.25s ease;
}

.mg-btn-user-upload:hover svg {
  transform: translateY(-2px);
}

/* Nút Đóng Góp Ảnh Inline Sau H2 */
.mg-btn-inline-h2 {
  font-size: 13px;
  padding: 6px 14px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
  position: relative;
  top: -1px;
}

/* Nút Đóng Góp Ảnh Trên Thanh Điều Khiển Controls Bar */
.mg-btn-control-bar {
  font-size: 12.5px;
  padding: 5px 13px;
}

/* Modal Popup Upload */
body.mg-modal-open {
  overflow: hidden;
}

.mg-upload-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.mg-upload-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  animation: mgFadeIn 0.25s ease;
}

.mg-upload-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05);
  animation: mgScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
  display: flex;
  flex-direction: column;
}

@keyframes mgFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes mgScaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.mg-upload-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.mg-upload-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mg-upload-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #eff6ff;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mg-upload-icon-circle svg {
  stroke: #2563eb;
}

.mg-upload-modal-title h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.mg-upload-modal-close {
  background: transparent;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: all 0.2s;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mg-upload-modal-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.mg-upload-modal-body {
  padding: 20px 24px;
}

.mg-upload-notice-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.mg-notice-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* Thanh tiến trình upload thời gian thực (Progress Bar) */
.mg-upload-progress-container {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  animation: mgFadeIn 0.2s ease;
}

.mg-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

.mg-progress-percent {
  color: #2563eb;
  font-weight: 700;
}

.mg-progress-bar-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.mg-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  border-radius: 999px;
  transition: width 0.2s ease;
}

/* Thông báo trạng thái Ajax */
.mg-upload-status {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mg-status-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.mg-status-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.mg-status-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Dropzone Kéo Thả Nhiều Ảnh */
.mg-dropzone {
  position: relative;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 14px;
}

.mg-dropzone:hover,
.mg-dropzone.dragover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.mg-dropzone.has-files {
  padding: 16px 14px;
  border-style: dashed;
  background: #f1f5f9;
}

.mg-dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.mg-dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.mg-dropzone-icon {
  stroke: #64748b;
  margin-bottom: 2px;
}

.mg-dropzone-text {
  margin: 0;
  font-size: 14px;
  color: #334155;
}

.mg-dropzone-text strong {
  color: #2563eb;
}

.mg-dropzone-hint {
  margin: 0;
  font-size: 12px;
  color: #94a3b8;
}

/* Khu Vực Xem Trước Danh Sách Ảnh & Tùy Chọn Xóa Từng Ảnh */
.mg-preview-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.mg-preview-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.mg-preview-count {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.mg-preview-count strong {
  color: #2563eb;
}

.mg-clear-all-btn {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.2s;
}

.mg-clear-all-btn:hover {
  background: #fee2e2;
}

.mg-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 10px;
  max-height: 230px;
  overflow-y: auto;
  padding: 2px;
}

.mg-preview-item {
  position: relative;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mg-preview-thumb {
  width: 100%;
  height: 65px;
  object-fit: cover;
  border-radius: 6px;
  background: #f1f5f9;
}

.mg-preview-name {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.mg-preview-size {
  font-size: 10px;
  color: #94a3b8;
}

/* Nút Xóa Bớt Từng Ảnh */
.mg-preview-remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  border: 2px solid #ffffff;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, background 0.2s;
}

.mg-preview-remove-btn:hover {
  background: #dc2626;
  transform: scale(1.15);
}

.mg-optional-text {
  font-size: 12px;
  font-weight: normal;
  color: #94a3b8;
  margin-left: 4px;
}

/* Màn hình Thông báo Thành công sau khi tải ảnh (Ẩn form, chống spam upload) */
.mg-upload-success-screen {
  padding: 10px 0 20px;
  animation: mgFadeIn 0.3s ease;
}

.mg-success-card {
  text-align: center;
  padding: 24px 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 14px;
}

.mg-success-icon-animated {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  background: #dcfce7;
  border-radius: 50%;
  margin-bottom: 16px;
  animation: mgScaleIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mg-success-icon-animated svg {
  animation: mgCheckPulse 1.5s infinite alternate ease-in-out;
}

@keyframes mgCheckPulse {
  from { transform: scale(0.95); }
  to { transform: scale(1.05); }
}

.mg-success-title {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  color: #14532d;
}

.mg-success-desc {
  margin: 0 auto 24px;
  font-size: 14px;
  line-height: 1.6;
  color: #166534;
  max-width: 440px;
}

.mg-success-desc strong {
  color: #052e16;
}

.mg-success-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mg-btn-close-modal,
.mg-btn-upload-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.mg-btn-close-modal {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
}

.mg-btn-close-modal:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.mg-btn-upload-more {
  background: #16a34a;
  border: 1px solid #16a34a;
  color: #ffffff;
}

.mg-btn-upload-more:hover {
  background: #15803d;
  border-color: #15803d;
}

/* Nút Xóa tất cả với icon */
.mg-clear-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.mg-clear-all-btn:hover {
  background: #fee2e2;
}

/* Form fields */
.mg-form-row {
  margin-bottom: 14px;
}

.mg-form-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.mg-form-row label svg {
  color: #64748b;
  flex-shrink: 0;
}

.mg-form-input,
.mg-form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
  color: #1e293b;
  background: #ffffff;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mg-form-input:focus,
.mg-form-textarea:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.mg-upload-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f9;
}

.mg-upload-btn-cancel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}

.mg-upload-btn-cancel:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.mg-upload-btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 22px;
  background: #2563eb;
  border: 1px solid #2563eb;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s;
}

.mg-upload-btn-submit:hover:not(:disabled) {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.mg-upload-btn-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}


/* Spinner quay tròn */
.mg-spinner {
  animation: mgSpin 0.9s linear infinite;
}

@keyframes mgSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   9. GIAO DIỆN TRANG DUYỆT ẢNH QUẢN TRỊ (MODERATION ADMIN PAGE)
   ========================================================================== */
.mg-mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.mg-mod-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.mg-mod-card:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.mg-mod-thumb-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  background: #f1f5f9;
  overflow: hidden;
}

.mg-mod-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.mg-mod-card:hover .mg-mod-thumb {
  transform: scale(1.03);
}

.mg-mod-status-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #f59e0b;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.mg-mod-info {
  padding: 14px 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mg-mod-uploader {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.mg-mod-date {
  font-size: 12px;
  color: #64748b;
}

.mg-mod-note {
  font-size: 13px;
  color: #334155;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 3px solid #3b82f6;
  margin-top: 4px;
  word-break: break-word;
}

.mg-mod-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}

.mg-mod-btn-approve,
.mg-mod-btn-reject {
  flex: 1;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s;
  border: none;
}

.mg-mod-btn-approve {
  background: #10b981;
  color: #ffffff;
}

.mg-mod-btn-approve:hover {
  background: #059669;
}

.mg-mod-btn-reject {
  background: #fee2e2;
  color: #dc2626;
}

.mg-mod-btn-reject:hover {
  background: #fecaca;
}

/* ==========================================================================
   10. PHÂN TRANG ALBUM & BỘ SƯU TẬP (PAGINATION & LOAD MORE)
   ========================================================================== */
.mg-page-hidden {
  display: none !important;
}

.mg-pagination-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 36px;
  margin-bottom: 20px;
  width: 100%;
}

/* Khối nút Phân trang số */
.mg-pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mg-page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mg-page-btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
}

.mg-page-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
  pointer-events: none;
}

.mg-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.mg-page-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  color: #94a3b8;
  font-weight: 700;
  font-size: 14px;
  user-select: none;
}

.mg-pagination-info {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

.mg-pagination-info strong {
  color: #2563eb;
}

/* Nút Xem Thêm (Load More) */
.mg-loadmore-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.mg-btn-loadmore {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: #ffffff;
  border: 1.5px solid #2563eb;
  color: #2563eb;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}

.mg-btn-loadmore:hover {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
  transform: translateY(-2px);
}

.mg-loadmore-counter {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

.mg-loadmore-counter strong {
  color: #0f172a;
}

.mg-pagination-status {
  padding: 10px 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: 13.5px;
  color: #166534;
  font-weight: 600;
}



