/* ===== Vision Macau 全站樣式（前台 + 後台）===== */

:root {
  --bg: #0a0a0a;
  --bg-soft: #121212;
  --bg-card: #171717;
  --gold: #d4af37;
  --gold-dim: #b8962e;
  --text: #f2f0ea;
  --text-dim: #a9a49a;
  --line: #2a2a2a;
  --danger: #c96a5b;
  --ok: #7fb069;
  --serif: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
  --sans: "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ===== 防右鍵儲存相片：禁拖曳／長按選單 ===== */
img { -webkit-user-drag: none; -webkit-touch-callout: none; }
.gallery img, .gallery-item img, .lightbox img { user-select: none; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

button { font-family: inherit; cursor: pointer; }

/* ===== 前台 ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1240px; margin: 0 auto; padding: 14px 28px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
}
.logo img { height: 48px; width: auto; }
.logo .logo-suffix { font-size: 16px; letter-spacing: 0.1em; color: var(--text-dim); }
.site-nav { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.site-nav a, .site-nav .nav-label {
  padding: 8px 12px; font-size: 12px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-dim);
  transition: color 0.2s;
}
.site-nav a:hover, .site-nav a.active { color: var(--gold); }

/* 第二／第三導航收納盒（喺 header 內，第一導航下方）——grid 高度自動過渡，唔使量高度唔會跳 */
.nav-drop {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 1s ease;
  width: 100%;
}
.nav-drop.open { grid-template-rows: 1fr; }
.nav-drop-inner {
  overflow: hidden; min-height: 0;
  display: flex; flex-direction: column; align-items: center;
}

/* 第二導航（頂層相簿名）——喺 header 內要縮細間距 */
.nav-drop .filter-bar {
  margin: 2px 0 8px; padding: 0;
  opacity: 0; transition: opacity 1s ease;
}
.nav-drop.open .filter-bar { opacity: 1; }

/* 第三導航（子相簿）——貼住第二導航 */
.nav-drop + .nav-drop { margin-top: -4px; }
.nav-drop .filter-bar-2 { margin: 0 0 8px; padding: 0; }
.nav-drop .filter-bar-2 button { font-size: 11px; color: #777; }

/* Hero —— 🔇 暫時整段隱藏（要恢復就刪下面嗰行 display:none） */
.hero {
  display: none;
  position: relative; min-height: 82vh;
  align-items: flex-end; overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: brightness(0.72);
  transform: scale(1.02);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,10,10,0.1) 0%, rgba(10,10,10,0.55) 60%, rgba(10,10,10,0.92) 100%);
}
.hero-content {
  position: relative; max-width: 1240px; margin: 0 auto; padding: 60px 28px 90px;
  width: 100%;
}
.hero-kicker {
  font-size: 12px; letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 18px;
}
.hero-slogan {
  font-family: var(--serif); font-size: clamp(30px, 5vw, 58px);
  line-height: 1.2; font-weight: 400; max-width: 15em;
}
.hero-sub {
  margin-top: 20px; max-width: 560px; color: var(--text-dim); font-size: 15px;
}
.hero-meta {
  margin-top: 34px; font-size: 12px; letter-spacing: 0.2em; color: var(--text-dim);
  text-transform: uppercase;
}

/* 作品區塊 */
/* 🔇 暫時隱藏 Portfolio 標題 + 副標題（要恢復就刪下面嗰行） */
#portfolio .section-title, #portfolio .section-sub { display: none; }
/* 🔇 暫時隱藏 Albums 成個區（要恢復就刪下面嗰行） */
#albums { display: none; }
.section { max-width: 1240px; margin: 0 auto; padding: 64px 28px; }
/* 作品區用盡網頁全寬 */
#portfolio { max-width: none; padding: 48px 28px; }
.section-title {
  font-family: var(--serif); font-size: 30px; margin-bottom: 10px; font-weight: 400;
}
.section-sub { color: var(--text-dim); font-size: 14px; letter-spacing: 0.1em; margin-bottom: 34px; }

.filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin: 0; padding: 0;
}
.filter-bar button {
  background: none; border: none; color: var(--text-dim);
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 6px 12px; transition: color 0.2s;
}
.filter-bar button:hover { color: var(--text); }
.filter-bar button.active { color: var(--gold); }

.gallery {
  columns: 3; column-gap: var(--pgap, 16px);
}
.gallery.cols-1 { columns: 1; }
.gallery.cols-2 { columns: 2; }
.gallery.cols-3 { columns: 3; }
.gallery.cols-4 { columns: 4; }
.gallery.cols-5 { columns: 5; }
.gallery.cols-6 { columns: 6; }
/* 手機（≤767px）：橫向 2 欄、直向 1 欄；iPad（768+）同電腦用返後台設定嘅格數 */
@media (max-width: 767px) and (orientation: landscape) {
  .gallery, .gallery.cols-3, .gallery.cols-4, .gallery.cols-5, .gallery.cols-6 { columns: 2; }
}
@media (max-width: 767px) and (orientation: portrait) {
  .gallery, .gallery.cols-2, .gallery.cols-3, .gallery.cols-4, .gallery.cols-5, .gallery.cols-6 { columns: 1; }
}

.gallery-item {
  break-inside: avoid; margin-bottom: var(--pgap, 16px); position: relative; overflow: hidden;
  background: var(--bg-card); cursor: pointer;
}
.gallery-item img {
  width: 100%; transition: transform 0.45s ease, opacity 0.3s;
}
.gallery-item:hover img { transform: scale(1.045); }
.gallery-item .item-info {
  position: absolute; inset: auto 0 0 0; padding: 40px 16px 14px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.78));
  opacity: 0; transition: opacity 0.3s;
}
.gallery-item:hover .item-info { opacity: 1; }
.item-info .item-title { font-family: var(--sans); font-size: 14px; letter-spacing: 0.06em; }
.item-info .item-cat {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold);
  margin-top: 4px;
}
/* 子目錄代表相——撳入子目錄嘅提示 */
.gallery-item.album-link::after {
  content: "↪ 入相簿"; position: absolute; top: 10px; right: 10px; z-index: 3;
  font-size: 10px; letter-spacing: 0.14em; color: #fff;
  background: rgba(0,0,0,0.55); border-radius: 4px; padding: 4px 8px;
  opacity: 0; transition: opacity 0.25s;
}
.gallery-item.album-link:hover::after { opacity: 1; }

.gallery-empty {
  padding: 60px 0; text-align: center; color: var(--text-dim);
  font-size: 14px; letter-spacing: 0.1em;
}

/* ===== 排法一：Masonry 瀑布流（直排：先填滿第一欄，再第二欄，原比例唔裁剪）===== */
.gallery.layout-masonry { columns: 3; column-gap: var(--pgap, 16px); }
.gallery.layout-masonry.cols-1 { columns: 1; }
.gallery.layout-masonry.cols-2 { columns: 2; }
.gallery.layout-masonry.cols-3 { columns: 3; }
.gallery.layout-masonry.cols-4 { columns: 4; }
.gallery.layout-masonry.cols-5 { columns: 5; }
.gallery.layout-masonry.cols-6 { columns: 6; }
.gallery.layout-masonry .gallery-item { display: inline-block; width: 100%; break-inside: avoid; margin-bottom: var(--pgap, 16px); }
.gallery.layout-masonry .gallery-item img { height: auto; }
@media (max-width: 767px) and (orientation: landscape) {
  .gallery.layout-masonry, .gallery.layout-masonry.cols-3, .gallery.layout-masonry.cols-4,
  .gallery.layout-masonry.cols-5, .gallery.layout-masonry.cols-6 { columns: 2; }
}
@media (max-width: 767px) and (orientation: portrait) {
  .gallery.layout-masonry, .gallery.layout-masonry.cols-2, .gallery.layout-masonry.cols-3,
  .gallery.layout-masonry.cols-4, .gallery.layout-masonry.cols-5, .gallery.layout-masonry.cols-6 { columns: 1; }
}

/* ===== 排法二：Grid 等寬網格（相片裁成方形）===== */
.gallery.layout-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); column-gap: var(--pgap, 16px); row-gap: var(--pgap, 16px);
}
.gallery.layout-grid.cols-1 { grid-template-columns: repeat(1, 1fr); }
.gallery.layout-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.gallery.layout-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.gallery.layout-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.gallery.layout-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.gallery.layout-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
.gallery.layout-grid .gallery-item { margin-bottom: 0; }
.gallery.layout-grid .gallery-item img { aspect-ratio: 1 / 1; object-fit: cover; height: auto; }
@media (max-width: 767px) and (orientation: landscape) {
  .gallery.layout-grid, .gallery.layout-grid.cols-3, .gallery.layout-grid.cols-4,
  .gallery.layout-grid.cols-5, .gallery.layout-grid.cols-6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) and (orientation: portrait) {
  .gallery.layout-grid, .gallery.layout-grid.cols-2, .gallery.layout-grid.cols-3,
  .gallery.layout-grid.cols-4, .gallery.layout-grid.cols-5, .gallery.layout-grid.cols-6 { grid-template-columns: 1fr; }
}

/* ===== 排法三：Rows 等高橫列（每張大相統一高度）===== */
.gallery.layout-rows { display: flex; flex-direction: column; gap: var(--pgap, 16px); }
.gallery.layout-rows .gallery-item { width: 100%; margin-bottom: 0; }
.gallery.layout-rows .gallery-item img { height: min(72vh, 620px); object-fit: cover; }

/* ===== 排法四：Mosaic 拼貼（大細格混排）===== */
.gallery.layout-mosaic {
  display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 24vh;
  gap: var(--pgap, 16px);
}
.gallery.layout-mosaic .gallery-item { margin-bottom: 0; }
.gallery.layout-mosaic .gallery-item img { width: 100%; height: 100%; object-fit: cover; }
/* 每 8 張一循環：第 1、4 張做大格（橫 2 直 2） */
.gallery.layout-mosaic .gallery-item:nth-child(8n+1),
.gallery.layout-mosaic .gallery-item:nth-child(8n+4) { grid-column: span 2; grid-row: span 2; }
@media (max-width: 767px) {
  .gallery.layout-mosaic { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 22vh; }
  .gallery.layout-mosaic .gallery-item:nth-child(8n+1),
  .gallery.layout-mosaic .gallery-item:nth-child(8n+4) { grid-column: span 2; grid-row: span 2; }
}

/* ===== 相簿瀏覽（前台） ===== */
#albums { border-top: 1px solid var(--line); }
.album-breadcrumb {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  font-size: 13px; color: var(--text-dim); margin-bottom: 22px;
}
.album-breadcrumb .crumb-item { cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.album-breadcrumb .crumb-item:hover { color: var(--gold); background: var(--bg-card); }
.album-breadcrumb .crumb-sep { color: #555; }
.album-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.album-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; cursor: pointer; transition: border-color 0.25s, transform 0.25s;
}
.gallery .album-card { break-inside: avoid; margin-bottom: var(--pgap, 16px); }
.album-card:hover { border-color: var(--gold-dim); transform: translateY(-3px); }
.album-cover {
  height: 170px; background-size: cover; background-position: center;
  position: relative; display: flex; align-items: center; justify-content: center;
  background-color: #1a1a1a;
}
.album-cover-fallback { font-size: 52px; opacity: 0.55; }
.album-cover-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.45); opacity: 0; transition: opacity 0.25s;
  color: var(--gold); font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase;
}
.album-card:hover .album-cover-overlay { opacity: 1; }
.album-card-name {
  padding: 12px 14px; font-family: var(--serif); font-size: 15px; color: var(--text);
}
.album-photo-gallery { columns: 3; column-gap: 16px; }
@media (max-width: 900px) { .album-photo-gallery { columns: 2; } }
@media (max-width: 560px) { .album-photo-gallery { columns: 1; } }
.album-photo-item { break-inside: avoid; margin-bottom: 16px; position: relative; overflow: hidden; background: var(--bg-card); cursor: pointer; }
.album-photo-item img { width: 100%; transition: transform 0.45s ease; }
.album-photo-item:hover img { transform: scale(1.045); }
.album-photo-item .item-info {
  position: absolute; inset: auto 0 0 0; padding: 40px 16px 14px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.78));
  opacity: 0; transition: opacity 0.3s;
}
.album-photo-item:hover .item-info { opacity: 1; }

/* 關於 */
.about { border-top: 1px solid var(--line); text-align: center; }
#contact { text-align: center; }
.about-text { max-width: 760px; margin: 0 auto; color: var(--text-dim); font-size: 15px; }

/* 頁腳 */
.site-footer {
  border-top: 1px solid var(--line); padding: 34px 28px 40px; text-align: center;
  color: var(--text-dim); font-size: 13px; letter-spacing: 0.08em;
}
.site-footer .admin-link { color: var(--text-dim); font-size: 11px; opacity: 0.7; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.94);
  display: none; align-items: center; justify-content: center; padding: 40px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 94vw; max-height: 84vh; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.lightbox .lb-caption {
  position: absolute; bottom: 26px; left: 0; right: 0; text-align: center;
  color: var(--text-dim); font-size: 13px; letter-spacing: 0.08em;
}
.lightbox .lb-close {
  position: absolute; top: 20px; right: 28px; background: none; border: none;
  color: var(--text); font-size: 30px; line-height: 1;
}

/* Contact 彈頁（關於 + 聯絡） */
.contact-modal-mask {
  position: fixed; inset: 0; z-index: 110; background: rgba(0,0,0,0.92);
  display: none; align-items: center; justify-content: center; padding: 24px;
  overflow: auto;
}
.contact-modal-mask.open { display: flex; }
.contact-modal {
  position: relative; background: #111; border: 1px solid var(--line);
  border-radius: 10px; max-width: 460px; width: 100%; padding: 44px 40px 38px;
  max-height: 90vh; overflow: auto;
}
.contact-modal .cm-close {
  position: absolute; top: 12px; right: 16px; background: none; border: none;
  color: var(--text-dim); font-size: 26px; line-height: 1; cursor: pointer;
}
.contact-modal .cm-block { text-align: center; }
.contact-modal .cm-heading {
  font-family: var(--sans); font-size: 15px; letter-spacing: 0.18em; font-weight: 600;
  color: var(--gold); margin-bottom: 16px;
}
.contact-modal .cm-lead {
  font-family: var(--sans); font-size: 14px; line-height: 1.8; color: var(--text);
  letter-spacing: 0.05em; margin: 0 0 12px;
}
.contact-modal .cm-text {
  font-family: var(--sans); font-size: 14px; line-height: 1.8; color: var(--text);
  letter-spacing: 0.05em; margin: 0 0 16px;
}
.contact-modal .cm-name {
  font-family: var(--sans); font-size: 13px; color: var(--text-dim);
  letter-spacing: 0.08em; margin: 0;
}
.contact-modal .cm-divider {
  height: 1px; background: var(--line); margin: 28px 0 26px;
}
.contact-modal .cm-line {
  font-family: var(--sans); font-size: 14px; color: var(--text);
  letter-spacing: 0.04em; margin: 10px 0; line-height: 1.6;
}
.contact-modal .cm-line a { color: var(--gold); text-decoration: none; }
.contact-modal .cm-line a:hover { text-decoration: underline; }
.contact-modal .cm-qrs {
  display: flex; justify-content: center; gap: 26px; margin-top: 26px; flex-wrap: wrap;
}
.contact-modal .cm-qr { text-align: center; }
.contact-modal .cm-qr img {
  width: 128px; height: 128px; object-fit: contain; display: block;
  background: #fff; border-radius: 8px; padding: 8px; margin-bottom: 8px;
}
.contact-modal .cm-qr span {
  font-family: var(--sans); font-size: 12px; color: var(--text-dim); letter-spacing: 0.08em;
}

/* ===== 後台 ===== */
.admin-body { background: #0e0e10; }
.admin-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--line);
  background: #0a0a0a;
}
.admin-top .logo { font-size: 20px; }
.admin-actions { display: flex; gap: 12px; align-items: center; }
.admin-actions .user-chip { color: var(--text-dim); font-size: 13px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--gold); color: #0a0a0a; border: none;
  padding: 9px 16px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  border-radius: 4px; transition: background 0.2s;
}
.btn:hover { background: var(--gold-dim); }
.btn-ghost {
  background: none; color: var(--text-dim); border: 1px solid var(--line);
  padding: 8px 14px; font-size: 13px; border-radius: 4px;
}
.btn-ghost:hover { color: var(--text); border-color: #444; }
.btn-danger { background: none; color: var(--danger); border: 1px solid #5a3a35; }
.btn-danger:hover { background: rgba(201,106,91,0.08); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 2px 6px; font-size: 12px; }

.admin-main { max-width: 1080px; margin: 0 auto; padding: 30px 24px 60px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.tabs button {
  background: none; border: none; color: var(--text-dim); padding: 12px 20px;
  font-size: 14px; letter-spacing: 0.06em; border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--gold); border-bottom-color: var(--gold); }

/* 登入 */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 8px; padding: 40px 34px;
}
.login-card h1 {
  font-family: var(--serif); font-size: 24px; text-align: center;
  letter-spacing: 0.14em; margin-bottom: 6px;
}
.login-card .login-sub {
  text-align: center; color: var(--text-dim); font-size: 12px;
  letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 30px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12px; letter-spacing: 0.08em;
  color: var(--text-dim); margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 10px 12px; font-size: 14px; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold-dim);
}
.field textarea { resize: vertical; min-height: 90px; }
.field .hint { font-size: 11px; color: var(--text-dim); margin-top: 5px; }
.form-error {
  color: var(--danger); font-size: 13px; margin: 10px 0; min-height: 18px;
}

/* 作品列表 */
.photo-list { display: flex; flex-direction: column; gap: 12px; }
.photo-row {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 16px; align-items: center;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 6px; padding: 12px;
}
.photo-row .thumb {
  width: 92px; height: 66px; object-fit: cover; border-radius: 4px; background: #000;
}
.photo-row .p-title { font-size: 15px; font-weight: 600; }
.photo-row .p-meta { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.photo-row .p-meta .tag {
  display: inline-block; background: rgba(212,175,55,0.14); color: var(--gold);
  padding: 1px 8px; border-radius: 3px; font-size: 10px; letter-spacing: 0.12em;
  margin-left: 6px; text-transform: uppercase;
}
.photo-row .p-meta .cover-tag {
  background: rgba(127,176,105,0.16); color: var(--ok);
}
.photo-row .row-actions { display: flex; gap: 6px; align-items: center; }

/* 模態框 */
.modal-mask {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.7);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.open { display: flex; }
.modal {
  width: 100%; max-width: 520px; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 8px; padding: 28px;
  max-height: 90vh; overflow: auto;
}
.modal h2 { font-family: var(--serif); font-size: 20px; margin-bottom: 18px; }
.modal .modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.upload-preview {
  margin-top: 10px; width: 100%; max-height: 220px; object-fit: contain;
  border-radius: 4px; background: #000; display: none;
}
.upload-preview.show { display: block; }

/* 內容管理表單 */
.content-form .field textarea { min-height: 110px; }
.form-msg { min-height: 20px; font-size: 13px; margin-top: 6px; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--danger); }

.loading, .error-line { padding: 40px 0; text-align: center; color: var(--text-dim); }
.error-line { color: var(--danger); }

/* ===== 媒體庫 / 相簿 ===== */
.media-folders h3, #mediaTitle, #albumTree h3 { font-size: 14px; color: var(--text-dim); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 10px; }
.folder-row { padding: 8px 10px; cursor: pointer; border-radius: 6px; font-size: 14px; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.folder-row:hover { background: var(--bg-card); }
.folder-row.active { background: var(--bg-card); color: var(--gold); }
.folder-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s; }
.folder-row:hover .folder-actions { opacity: 1; }
.folder-actions .btn-ghost { padding: 2px 7px; font-size: 13px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
/* 拖放上傳 */
.drop-hint {
  border: 1.5px dashed var(--line); border-radius: 8px; padding: 14px 16px;
  text-align: center; color: var(--text-dim); font-size: 13px; letter-spacing: 0.04em;
  margin-bottom: 12px; transition: border-color .2s, color .2s, background .2s;
}
#mediaDropZone.dragging .drop-hint {
  border-color: var(--gold); color: var(--gold);
  background: rgba(212, 175, 55, 0.07);
}
#mediaDropZone.dragging .media-grid { opacity: 0.45; }

/* 作品列表：網格卡片 + 拖放排序 */
.drag-hint { color: var(--text-dim); font-size: 12px; letter-spacing: 0.04em; margin-bottom: 12px; }
.cols-picker { display: flex; align-items: center; }
.cols-btn { min-width: 34px; height: 30px; padding: 0 8px; margin: 0 3px; background: var(--bg-card); border: 1px solid var(--line); color: var(--text); border-radius: 6px; cursor: pointer; font-size: 14px; }
.cols-btn.active { background: var(--gold); border-color: var(--gold); color: #111; font-weight: 700; }
.photo-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.photo-grid.cols-1 { grid-template-columns: 1fr; }
.photo-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.photo-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.photo-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.photo-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.photo-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
.photo-card { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg-card); cursor: grab; transition: border-color .2s, opacity .2s, transform .15s; }
.photo-card.dragging { opacity: 0.45; border-style: dashed; }
.photo-card.drop-target { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,175,55,.35); }
.photo-card .card-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.photo-card .drag-handle { position: absolute; top: 8px; left: 8px; z-index: 3; color: #fff; font-size: 16px; line-height: 1; background: rgba(0,0,0,.45); border-radius: 5px; padding: 4px 6px; cursor: grab; user-select: none; }
.photo-card .card-overlay { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px; background: linear-gradient(transparent, rgba(0,0,0,.78)); pointer-events: none; }
.photo-card .card-title { color: #fff; font-size: 13px; font-weight: 600; line-height: 1.35; }
.photo-card .card-cat { color: rgba(255,255,255,.72); font-size: 11px; letter-spacing: .05em; margin-top: 2px; }
.photo-card .card-actions { position: absolute; top: 8px; right: 8px; z-index: 3; display: flex; gap: 5px; opacity: 0; transition: opacity .18s; }
.photo-card:hover .card-actions, .photo-card.tapped .card-actions { opacity: 1; }
.photo-card .cover-badge {
  position: absolute; top: 8px; right: 8px; z-index: 3; background: var(--gold);
  color: #0a0a0a; border-radius: 4px; padding: 2px 6px; font-size: 11px; font-weight: 700;
  letter-spacing: .04em;
}
.photo-card .cover-badge + .card-actions { right: 64px; }
.sub-album-card { cursor: pointer; }
.sub-album-card .card-overlay { background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.album-photo .cover-badge {
  position: absolute; top: 38px; left: 8px; z-index: 3; background: var(--gold);
  color: #0a0a0a; border-radius: 4px; padding: 2px 6px; font-size: 11px; font-weight: 700;
  letter-spacing: .04em;
}
.album-photo.is-cover { border-color: var(--gold); }
.album-photo .album-photo-actions .cover-active { background: var(--gold); border-color: var(--gold); color: #0a0a0a; font-weight: 700; }
.photo-card .card-actions .btn-ghost { background: rgba(0,0,0,.6); border-color: rgba(255,255,255,.35); color: #fff; }
.photo-card .card-actions .btn-danger { background: rgba(180,30,30,.75); border-color: rgba(255,255,255,.35); }
@media (max-width: 900px) { .photo-grid.cols-5 { grid-template-columns: repeat(3, 1fr); } .photo-grid.cols-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) {
  .photo-grid.cols-3, .photo-grid.cols-4, .photo-grid.cols-5, .photo-grid.cols-6 { grid-template-columns: repeat(2, 1fr); }
  .photo-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .photo-grid.cols-1 { grid-template-columns: 1fr; }
}
.media-item { background: var(--bg-card); border-radius: 8px; overflow: hidden; position: relative; }
.media-item img { width: 100%; height: 140px; object-fit: cover; display: block; }
.media-meta { padding: 8px 10px; }
.media-title { font-size: 13px; color: var(--text); }
.media-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-actions {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.62); display: flex; gap: 8px;
  align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.media-item:hover .media-actions { opacity: 1; }
@media (hover: none) {
  .media-actions { opacity: 1; background: linear-gradient(180deg, rgba(0,0,0,0.55), transparent 55%); align-items: flex-start; padding-top: 10px; }
}
.album-row { padding: 8px 10px; cursor: pointer; border-radius: 6px; font-size: 14px; color: var(--text); }
.album-row .album-arrows {
  float: right; opacity: 0.35; transition: opacity 0.2s;
}
.album-row:hover .album-arrows { opacity: 1; }
.album-row .arr-btn {
  background: none; border: 1px solid var(--line); color: var(--text);
  width: 22px; height: 22px; line-height: 1; border-radius: 4px;
  cursor: pointer; font-size: 11px; margin-left: 3px;
}
.album-row .arr-btn:hover { color: var(--gold); border-color: var(--gold-dim); }
.album-row.dragging { opacity: 0.45; }
.album-row.drag-over { outline: 1px dashed var(--gold); }
.album-cat-tag {
  margin-left: 8px; font-size: 9px; letter-spacing: 0.08em; padding: 1px 5px;
  border: 1px solid var(--line); border-radius: 4px; color: var(--text-dim);
}
.album-row:hover { background: var(--bg-card); }
.album-row.active { background: var(--bg-card); color: var(--gold); }
.album-tree { max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.album-empty {
  color: var(--text-dim); font-size: 14px; text-align: center;
  padding: 60px 20px; border: 1px dashed var(--line); border-radius: 8px;
}
.album-detail-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.album-detail-head h3 { font-size: 17px; margin: 0; }
.album-children { margin-bottom: 18px; }
.sub-label {
  font-size: 11px; color: var(--text-dim); letter-spacing: 0.12em;
  text-transform: uppercase; margin-bottom: 8px;
}
.child-album {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.child-album:hover { border-color: var(--gold-dim); color: var(--gold); }
.album-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.album-photo { background: var(--bg-card); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; position: relative; cursor: grab; transition: border-color .2s, opacity .2s; }
.album-photo.dragging { opacity: 0.45; border-style: dashed; }
.album-photo.drop-target { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,175,55,.35); }
.album-photo .drag-handle { position: absolute; top: 8px; left: 8px; z-index: 3; color: #fff; font-size: 16px; line-height: 1; background: rgba(0,0,0,.45); border-radius: 5px; padding: 4px 6px; cursor: grab; user-select: none; }
.album-photo img { width: 100%; height: 130px; object-fit: cover; display: block; }
.album-photo-meta { padding: 8px 10px; }
.album-photo-actions { display: flex; gap: 6px; padding: 0 10px 10px; }
/* 後台相簿管理：相片縮圖排法跟相簿設定（即時反映前端） */
.album-photos.ap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.album-photos.ap-grid.cols-1 { grid-template-columns: repeat(1, 1fr); }
.album-photos.ap-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.album-photos.ap-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.album-photos.ap-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.album-photos.ap-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.album-photos.ap-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
.album-photos.ap-masonry { display: grid; grid-auto-flow: column; grid-auto-rows: auto; gap: 12px; }
.album-photos.ap-masonry.cols-1 { grid-template-columns: repeat(1, 1fr); }
.album-photos.ap-masonry.cols-2 { grid-template-columns: repeat(2, 1fr); }
.album-photos.ap-masonry.cols-3 { grid-template-columns: repeat(3, 1fr); }
.album-photos.ap-masonry.cols-4 { grid-template-columns: repeat(4, 1fr); }
.album-photos.ap-masonry.cols-5 { grid-template-columns: repeat(5, 1fr); }
.album-photos.ap-masonry.cols-6 { grid-template-columns: repeat(6, 1fr); }
.album-photos.ap-masonry .album-photo { display: block; width: auto; margin-bottom: 0; }
.album-photos.ap-masonry .album-photo img { height: auto; }
.album-photos.ap-rows { display: flex; flex-direction: column; gap: 12px; }
.album-photos.ap-rows .album-photo { width: 100%; }
.album-photos.ap-mosaic { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-flow: row dense; gap: 12px; }
.album-photos.ap-mosaic .album-photo:nth-child(4n+1),
.album-photos.ap-mosaic .album-photo:nth-child(4n+4) { grid-column: span 2; }
/* 後台安全監察：登入 / 訪客記錄表 */
.log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.log-table th { text-align: left; padding: 8px 10px; color: var(--text-dim); font-weight: 500; border-bottom: 1px solid var(--line); white-space: nowrap; }
.log-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.05); }
.log-table tr:hover td { background: rgba(255,255,255,.03); }
.pick-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.pick-toolbar select {
  height: 30px; background: var(--bg-card); border: 1px solid var(--line);
  color: var(--text); border-radius: 6px; padding: 0 8px; min-width: 180px;
}
.pick-count { font-size: 12px; color: var(--text-dim); margin-left: auto; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: 55vh; overflow: auto; }
.pick-item {
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  cursor: pointer; background: var(--bg-card); position: relative;
}
.pick-item img { width: 100%; height: 100px; object-fit: cover; display: block; }
.pick-item .pick-name {
  padding: 6px 8px; font-size: 12px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pick-item.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.pick-item.selected::after {
  content: '✓'; position: absolute; top: 6px; right: 6px;
  background: var(--gold); color: #0a0a0a; width: 20px; height: 20px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.modal-lg { max-width: 760px; }
.modal .loading, .modal .error-line { padding: 20px 0; }

/* 響應式 */
@media (max-width: 700px) {
  .header-inner { padding: 14px 18px; }
  .photo-row { grid-template-columns: 72px 1fr; }
  .photo-row .row-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .section { padding: 44px 18px; }
}
