/* ===========================================================
   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;
}
