/* ===========================================================
   Lumina Gallery — shared styles, animations & interactivity
   =========================================================== */

* {
  scroll-behavior: smooth;
}

body {
  transition: background-color 0.35s ease, color 0.35s ease;
}

/* ---------- Masonry grid ---------- */
.masonry-grid {
  column-count: 1;
  column-gap: 24px;
}
@media (min-width: 768px) {
  .masonry-grid { column-count: 2; }
}
@media (min-width: 1024px) {
  .masonry-grid { column-count: 3; }
}
.masonry-item {
  break-inside: avoid;
  margin-bottom: 24px;
}

/* ---------- Gallery item entrance animation ---------- */
.masonry-item {
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  animation: itemIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes itemIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Smooth show/hide for filtering (instead of hard display:none jump) */
.masonry-item.is-hidden {
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}
.masonry-item.is-filtering {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* Image fade-in once loaded（缩略图保持模糊，点开灯箱查看高清原图） */
.gallery-item img {
  opacity: 0;
  filter: blur(12px) scale(1.06);
  transition: opacity 0.5s ease, transform 0.4s ease, filter 0.4s ease;
}
.gallery-item img.loaded {
  opacity: 1;
}

/* Skeleton shimmer while an image loads */
.img-skeleton {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(128,128,128,0.12) 25%, rgba(128,128,128,0.22) 37%, rgba(128,128,128,0.12) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
.img-skeleton.done {
  animation: none;
  background: none;
}

/* ---------- Lightbox ---------- */
.lightbox-overlay {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
}
.lightbox-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-content {
  transform: scale(0.95);
  transition: transform 0.3s ease-in-out;
}
.lightbox-overlay.active .lightbox-content {
  transform: scale(1);
}
.lightbox-content img {
  transition: opacity 0.25s ease;
}

/* ---------- Filter buttons ---------- */
.filter-btn {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}
.filter-btn:active {
  transform: scale(0.95);
}

/* ---------- Buttons / links generic feedback ---------- */
button, a {
  -webkit-tap-highlight-color: transparent;
}
button:active {
  transform: scale(0.97);
}

/* ---------- Toast notifications ---------- */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 22px;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: rgba(20,20,22,0.92);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  animation: toastIn 0.35s cubic-bezier(0.16,1,0.3,1) forwards;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.leaving {
  animation: toastOut 0.3s ease forwards;
}
@keyframes toastIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(10px) scale(0.95); }
}

/* ---------- Upload modal ---------- */
.modal-overlay {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}
.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

/* Dropzone drag state */
#dropzone.drag-over {
  border-color: var(--tw-border-opacity, #4646d4) !important;
  transform: scale(1.01);
}

/* ---------- Mobile nav ---------- */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
#mobile-menu.open {
  max-height: 400px;
}

/* ---------- Theme toggle icon swap ---------- */
#theme-toggle span {
  transition: transform 0.4s ease, opacity 0.3s ease;
}

/* ---------- Scroll reveal for hero / sections ---------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s cubic-bezier(0.16,1,0.3,1), transform 0.7s cubic-bezier(0.16,1,0.3,1);
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Auth pages ---------- */
.fade-in-up {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(20px);
}
@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}
.bg-pattern {
  background-image: radial-gradient(circle at 50% -20%, rgba(224, 224, 255, 0.1) 0%, transparent 60%);
}
.field-error {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.25s ease;
  opacity: 0;
}
.field-error.show {
  max-height: 40px;
  opacity: 1;
}
input.invalid {
  border-color: #ba1a1a !important;
  animation: shake 0.35s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ===========================================================
   后台（管理员 / 用户）通用样式
   =========================================================== */

/* 侧边栏导航 */
.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 0.5rem;
  font-size: 14px;
  font-weight: 600;
  color: #464554;
  transition: background-color 0.2s ease, color 0.2s ease;
  text-align: left;
}
.dark .admin-nav-link { color: #c8c5cd; }
.admin-nav-link:hover {
  background-color: #eceef0;
}
.dark .admin-nav-link:hover {
  background-color: #201f20;
}
.admin-nav-link.active {
  background-color: #e1e0ff;
  color: #2f2ebe;
}
.dark .admin-nav-link.active {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* 面板卡片 */
.panel {
  background-color: #ffffff;
  border: 1px solid rgba(71, 70, 77, 0.12);
  border-radius: 0.75rem;
  padding: 24px;
}
.dark .panel {
  background-color: #0e0e0f;
  border-color: rgba(71, 70, 77, 0.35);
}
.panel-title {
  font-family: "Syne", sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  color: #191c1e;
}
.dark .panel-title { color: #e5e2e3; }

/* 统计卡片 */
.stat-card {
  background-color: #ffffff;
  border: 1px solid rgba(71, 70, 77, 0.12);
  border-radius: 0.75rem;
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.dark .stat-card {
  background-color: #0e0e0f;
  border-color: rgba(71, 70, 77, 0.35);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
.stat-card .material-symbols-outlined {
  font-size: 32px;
  flex-shrink: 0;
}
.stat-value {
  font-family: "Syne", sans-serif;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  color: #191c1e;
}
.dark .stat-value { color: #e5e2e3; }
.stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #464554;
}
.dark .stat-label { color: #c8c5cd; }

/* 数据表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #464554;
  border-bottom: 1px solid rgba(71, 70, 77, 0.15);
  white-space: nowrap;
}
.dark .data-table th { color: #c8c5cd; border-color: rgba(71, 70, 77, 0.4); }
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(71, 70, 77, 0.08);
  vertical-align: middle;
}
.dark .data-table td { border-color: rgba(71, 70, 77, 0.25); }
.data-table tbody tr {
  transition: background-color 0.15s ease;
}
.data-table tbody tr:hover {
  background-color: rgba(70, 70, 212, 0.04);
}
.dark .data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

/* 徽章 */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  background-color: #e0e3e5;
  color: #38485d;
}
.dark .badge {
  background-color: #201f20;
  color: #c8c5cd;
}
.badge-admin {
  background-color: #e1e0ff;
  color: #2f2ebe;
}
.dark .badge-admin {
  background-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

/* 图标按钮 */
.icon-btn {
  padding: 8px;
  border-radius: 0.5rem;
  color: #464554;
  transition: background-color 0.2s ease, color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dark .icon-btn { color: #c8c5cd; }
.icon-btn:hover {
  background-color: #eceef0;
  color: #4646d4;
}
.dark .icon-btn:hover {
  background-color: #201f20;
  color: #ffffff;
}
.icon-btn.text-error:hover { color: #ba1a1a; }

/* 快捷操作按钮 */
.quick-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 0.5rem;
  font-size: 14px;
  font-weight: 600;
  color: #191c1e;
  background-color: #f2f4f6;
  transition: background-color 0.2s ease, color 0.2s ease;
  text-align: left;
}
.dark .quick-action {
  color: #e5e2e3;
  background-color: #1c1b1c;
}
.quick-action:hover {
  background-color: #e1e0ff;
  color: #2f2ebe;
}
.dark .quick-action:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* 开关（switch） */
.switch-input {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 24px;
  background: #c7c4d7;
  border-radius: 9999px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
  outline: none;
}
.dark .switch-input {
  background: #47464d;
}
.switch-input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}
.switch-input:checked {
  background: #4646d4;
}
.dark .switch-input:checked {
  background: #ffffff;
}
.dark .switch-input:checked::after {
  background: #2d2f46;
}
.switch-input:checked::after {
  transform: translateX(20px);
}

/* 上传入口禁用（无上传权限时隐藏） */
.upload-disabled {
  display: none !important;
}


/* ---------- 画廊分页 ---------- */
.gallery-page-btn,
.gallery-page-nav,
.gallery-page-size {
  min-height: 40px;
  border: 1px solid rgba(100, 116, 139, .22);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255,255,255,.72);
  color: inherit;
  transition: .18s ease;
}
.gallery-page-btn:hover:not(.active),
.gallery-page-nav:hover:not(:disabled),
.gallery-page-size:hover {
  transform: translateY(-1px);
  border-color: rgba(100, 116, 139, .45);
}
.gallery-page-btn.active {
  background: var(--color-primary, #4f46e5);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}
.gallery-page-nav:disabled {
  opacity: .38;
  cursor: not-allowed;
}
.gallery-page-size {
  min-height: 38px;
  padding: 0 32px 0 12px;
  cursor: pointer;
}
.dark .gallery-page-btn,
.dark .gallery-page-nav,
.dark .gallery-page-size {
  background: rgba(30, 41, 59, .72);
  border-color: rgba(148,163,184,.22);
}
@media (max-width: 640px) {
  .gallery-page-btn,
  .gallery-page-nav { min-width: 40px; padding: 0 10px; }
}


/* ---------- Modern upload / processing progress ---------- */
.upload-progress-card {
  background: #fff;
  color: #111;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 12px 35px rgba(0,0,0,.08);
  transition: background .28s ease, color .28s ease, border-color .28s ease, transform .28s ease;
}
.upload-progress-card.is-done {
  background: #111;
  color: #fff;
  border-color: #111;
  transform: translateY(-1px);
}
.upload-progress-head { display:flex; align-items:center; gap:12px; }
.upload-progress-icon { width:40px; height:40px; border-radius:13px; display:grid; place-items:center; background:#f3f3f3; color:#111; flex:none; }
.upload-progress-card.is-done .upload-progress-icon { background:#fff; color:#111; }
.upload-progress-title { font-size:13px; font-weight:700; line-height:1.35; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.upload-progress-subtitle { margin-top:3px; font-size:11px; color:#777; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.upload-progress-card.is-done .upload-progress-subtitle { color:#cfcfcf; }
.upload-progress-percent { font-size:14px; font-weight:800; font-variant-numeric:tabular-nums; }
.upload-progress-track { height:8px; margin-top:12px; border-radius:999px; overflow:hidden; background:#ececec; }
.upload-progress-fill { height:100%; width:0; border-radius:999px; background:#111; transition:width .18s ease; }
.upload-progress-card.is-done .upload-progress-track { background:#333; }
.upload-progress-card.is-done .upload-progress-fill { background:#fff; }
.upload-preview-card { position:relative; overflow:hidden; border-radius:14px; background:#f3f3f3; border:1px solid rgba(0,0,0,.06); }
.upload-preview-card > span { position:absolute; top:6px; left:6px; min-width:22px; height:22px; padding:0 6px; display:grid; place-items:center; border-radius:999px; background:#111; color:#fff; font-size:10px; font-weight:700; }
.photo-share-btn { box-shadow:0 8px 22px rgba(0,0,0,.18); }
.photo-share-btn:active { transform:scale(.94); }
.gallery-page-btn, .gallery-page-nav { min-width:40px; height:40px; padding:0 12px; border-radius:12px; border:1px solid rgba(0,0,0,.09); background:#fff; color:#111; font-size:13px; font-weight:700; transition:all .2s ease; }
.gallery-page-btn:hover, .gallery-page-nav:hover:not(:disabled) { background:#111; color:#fff; border-color:#111; transform:translateY(-1px); }
.gallery-page-btn.active { background:#111; color:#fff; border-color:#111; }
.gallery-page-nav:disabled { opacity:.35; cursor:not-allowed; }
.gallery-page-size { height:40px; border:1px solid rgba(0,0,0,.1); border-radius:12px; background:#fff; color:#111; padding:0 12px; font-weight:700; outline:none; }
.gallery-page-size:focus { border-color:#111; box-shadow:0 0 0 3px rgba(0,0,0,.08); }
@media (prefers-color-scheme: dark) {
  .upload-progress-card { background:#fff; color:#111; }
}


/* ---------- mpimg-inspired compact pagination ---------- */
.gallery-pagination-inner { display:flex; flex-direction:column; align-items:center; gap:12px; width:100%; padding:18px 12px 6px; }
.gallery-pagination-summary { color:#536579; font-size:14px; line-height:1.6; text-align:center; }
.gallery-pagination-summary strong { color:#25384d; font-weight:800; }
.gallery-pagination-controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:8px; max-width:100%; }
.gallery-page-btn, .gallery-page-nav { min-width:46px; height:42px; padding:0 14px; border:0; border-radius:12px; background:#edf5fc; color:#5c7891; font-size:14px; font-weight:600; transition:all .18s ease; box-shadow:none; }
.gallery-page-icon { min-width:42px; padding:0 11px; font-size:18px; }
.gallery-page-btn:hover, .gallery-page-nav:hover:not(:disabled) { background:#111; color:#fff; transform:translateY(-1px); }
.gallery-page-btn.active { background:#111; color:#fff; font-weight:800; box-shadow:0 6px 16px rgba(0,0,0,.12); }
.gallery-page-nav:disabled { opacity:.35; cursor:not-allowed; }
.gallery-page-ellipsis { min-width:20px; text-align:center; color:#8ca0b1; font-weight:700; }
.gallery-page-size-wrap { display:flex; align-items:center; gap:8px; color:#71869a; font-size:13px; }
.gallery-page-size { height:38px; min-width:92px; border:1px solid #dbe5ee; border-radius:11px; background:#fff; color:#25384d; padding:0 10px; font-weight:700; outline:none; }
.gallery-page-size:focus { border-color:#111; box-shadow:0 0 0 3px rgba(0,0,0,.06); }
@media (max-width:520px) {
  .gallery-pagination-inner { padding-left:4px; padding-right:4px; gap:10px; }
  .gallery-pagination-summary { font-size:12px; }
  .gallery-pagination-controls { gap:6px; }
  .gallery-page-btn, .gallery-page-nav { min-width:40px; height:38px; padding:0 10px; font-size:13px; border-radius:11px; }
  .gallery-page-icon { min-width:38px; }
  .gallery-page-size-wrap { font-size:12px; }
}

/* ---------- refined white -> black progress cards ---------- */
.upload-progress-card { position:relative; overflow:hidden; background:#fff; color:#111; border:1px solid #e9e9e9; border-radius:20px; padding:16px; box-shadow:0 16px 45px rgba(0,0,0,.08); }
.upload-progress-card::after { content:''; position:absolute; inset:0; pointer-events:none; background:linear-gradient(120deg,transparent 20%,rgba(255,255,255,.65) 48%,transparent 76%); transform:translateX(-120%); animation:progressSheen 2.2s ease-in-out infinite; }
.upload-progress-card.is-done { background:#111; color:#fff; border-color:#111; box-shadow:0 18px 42px rgba(0,0,0,.22); }
.upload-progress-card.is-done::after { display:none; }
@keyframes progressSheen { to { transform:translateX(120%); } }
.upload-progress-icon { width:44px; height:44px; border-radius:14px; background:#f4f4f4; color:#111; }
.upload-progress-card.is-done .upload-progress-icon { background:#fff; color:#111; }
.upload-progress-title { font-size:14px; font-weight:800; }
.upload-progress-subtitle { font-size:11px; margin-top:4px; color:#7a7a7a; }
.upload-progress-card.is-done .upload-progress-subtitle { color:#bdbdbd; }
.upload-progress-percent { font-size:16px; font-weight:900; }
.upload-progress-track { height:9px; margin-top:14px; background:#ededed; border-radius:999px; }
.upload-progress-fill { background:#111; }
.upload-progress-card.is-done .upload-progress-track { background:#333; }
.upload-progress-card.is-done .upload-progress-fill { background:#fff; }
