@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&family=Playfair+Display:ital,wght@0,600;1,500;1,600&display=swap');

:root {
  --blue:      #3db8d9;
  --blue-soft: #e3f4fa;
  --blue-deep: #1a88ae;
  --bg:        #f2f2ef;
  --surface:   #ffffff;
  --ink:       #1c1c2e;
  --muted:     #6b7280;
  --line:      #e8e8e4;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 20px rgba(0,0,0,.09);
  --radius:    14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--blue-deep); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -.2px;
  color: var(--ink);
}
.brand small {
  display: block;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: .1px;
  color: var(--muted);
  margin-top: 1px;
  text-align: center;
}

.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-logo { display: block; height: 34px; width: auto; border-radius: 8px; }

/* ---------- Layout ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 18px; }

/* ---------- Intro ---------- */
.intro { text-align: center; padding: 32px 14px 20px; }

.quote-head {
  margin: 0 0 6px;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
  font-size: 38px;
  line-height: 1.2;
  color: var(--ink);
  text-wrap: pretty;
}
.quote-head .qh-em {
  font-style: italic;
  font-weight: 500;
  color: var(--blue-deep);
}
.quote-head .qh-heart {
  color: var(--blue);
  font-size: .55em;
  vertical-align: middle;
  padding: 0 6px;
}
@media (max-width: 600px) { .quote-head { font-size: 26px; } }

.footer-quote {
  text-align: center;
  margin: 44px auto 12px;
  max-width: 600px;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 15.5px;
  color: var(--muted);
  line-height: 1.6;
}
.footer-quote .fq-mark {
  color: var(--blue);
  font-size: 20px;
  font-style: normal;
  margin: 0 4px;
  vertical-align: -2px;
}

/* ---------- Password bar (slim, replaces big alert) ---------- */
.pw-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 6px 6px 16px;
  width: fit-content;
  max-width: 92vw;
  margin: 0 auto 14px;
  transition: border-color .15s, box-shadow .15s;
}
.pw-bar:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.pw-bar-icon { font-size: 13px; flex: none; }
.pw-input {
  border: none; outline: none; background: none;
  font-family: inherit; font-size: 13.5px; font-weight: 700;
  color: var(--ink);
  width: 195px; max-width: 50vw;
  padding: 8px 0;
}
.pw-input::placeholder { color: var(--muted); font-weight: 600; }
@keyframes pwShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.pw-input.err { animation: pwShake .35s ease; color: #c0392b; }
.pw-bar-btn { flex: none; white-space: nowrap; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
}
.chip:hover {
  border-color: var(--blue);
  color: var(--blue-deep);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.chip.active {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue-deep);
}

/* ---------- Grid masonry ---------- */
.grid { display: flex; gap: 10px; align-items: flex-start; }
.col  { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--blue-soft);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
  background: var(--blue-soft);
}

.card .name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  padding: 22px 10px 7px;
  background: linear-gradient(transparent, rgba(0,0,0,.38));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* ---------- Nút tim ---------- */
.heart {
  position: absolute;
  top: 8px; right: 8px;
  width: 38px; height: 38px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 19px; line-height: 1;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,.16);
  transition: transform .15s ease, background .15s;
}
.heart:hover  { transform: scale(1.1); }
.heart:active { transform: scale(.85); }
.heart .on    { display: none; }
.heart.liked .on  { display: inline; }
.heart.liked .off { display: none; }
.heart.liked  { background: #fff; }
.heart.locked { font-size: 15px; }

@keyframes pop {
  0%  { transform: scale(1); }
  40% { transform: scale(1.38); }
  100%{ transform: scale(1); }
}
.heart.pop { animation: pop .28s ease; }

/* Nút tải ảnh từng tấm */
.dl {
  position: absolute;
  top: 8px; left: 8px;
  width: 34px; height: 34px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 15px; line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,.16);
  color: var(--ink);
  transition: transform .15s;
}
.dl:hover  { transform: scale(1.08); }
.dl:active { transform: scale(.85); }
.dl:disabled { opacity: .5; }

/* Dấu ghi chú trên thẻ */
.cmt-badge {
  position: absolute; left: 8px; bottom: 8px;
  border: none; border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: var(--ink);
  font-size: 11.5px; font-weight: 700;
  padding: 4px 9px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
  font-family: inherit;
}

/* ---------- Thư mục con + đường dẫn ---------- */
.section-title {
  font-weight: 800;
  font-size: 14px;
  margin: 6px 2px 10px;
  color: var(--ink);
  letter-spacing: .1px;
}

.folders {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}
.folder-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 13px 14px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.folder-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.folder-card:active { transform: scale(.97); }

.folder-ic   { font-size: 22px; }
.folder-name {
  font-weight: 700;
  font-size: 13.5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-bottom: 14px;
  font-size: 13px;
}
.bc-seg {
  border: none; background: none;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 5px;
  font-size: 13px;
  font-family: inherit;
  border-radius: 6px;
  transition: color .12s, background .12s;
  letter-spacing: .1px;
}
.bc-seg:hover { color: var(--blue-deep); background: var(--blue-soft); }
.bc-seg.cur   { color: var(--ink); font-weight: 700; cursor: default; }
.bc-seg.cur:hover { background: none; color: var(--ink); }
.bc-sep {
  color: var(--line);
  font-size: 14px;
  font-weight: 400;
  padding: 0 2px;
  user-select: none;
}

/* ---------- Trạng thái ---------- */
.state { text-align: center; padding: 64px 20px; color: var(--muted); font-weight: 600; }
.spinner {
  width: 32px; height: 32px;
  margin: 0 auto 14px;
  border: 2.5px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(16, 14, 20, .94);
  display: none; align-items: center; justify-content: center;
  padding: 20px; touch-action: none;
}
.lightbox.show { display: flex; }

.lightbox img {
  max-width: 100%; max-height: 80vh;
  border-radius: 10px;
  transition: transform .12s ease;
  transform-origin: center center;
  will-change: transform;
}
.lightbox img.zoomed { cursor: grab; border-radius: 0; }

.lightbox .x {
  position: absolute; top: 16px; right: 18px; z-index: 2;
  color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.22);
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  transition: background .15s, transform .15s;
}
.lightbox .x:hover { background: rgba(255,255,255,.26); }
.lightbox .x:active { transform: scale(.92); }

.lb-count, .lb-name {
  position: absolute; top: 18px; z-index: 2;
  color: rgba(255,255,255,.9);
  font-size: 12.5px; font-weight: 700;
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(8px);
  padding: 5px 12px; border-radius: 999px;
}
.lb-count { left: 18px; }
.lb-name {
  left: 50%; transform: translateX(-50%);
  max-width: 55vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.lb-bar {
  position: absolute; left: 0; right: 0; bottom: 22px; z-index: 2;
  display: flex; gap: 8px;
  justify-content: center; align-items: center;
  padding: 0 14px;
}
.lb-btn {
  background: rgba(255,255,255,.95);
  border: none; border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px; font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  font-family: inherit;
  transition: transform .12s, background .12s;
}
.lb-btn span:not(.on):not(.off) { overflow: hidden; text-overflow: ellipsis; }
.lb-btn:hover  { background: #fff; }
.lb-btn:active { transform: scale(.93); }
.lb-btn .on    { display: none; }
.lb-btn.liked .on  { display: inline; }
.lb-btn.liked .off { display: none; }
.lb-btn.liked  { color: var(--blue-deep); }

/* ----- Nav, zoom, close: kính mờ tinh tế thay vì khối tròn trắng đặc ----- */
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 36px; height: 36px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 19px; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
  box-shadow: none;
  transition: background .12s, transform .12s;
}
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }
.lb-nav:hover  { background: rgba(255,255,255,.26); }
.lb-nav:active { transform: translateY(-50%) scale(.9); }

.lb-zoom {
  position: absolute; left: 16px; bottom: 88px; z-index: 2;
  display: flex; align-items: center;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
}
.lb-zoom button {
  width: 36px; height: 36px;
  border: none;
  background: none;
  color: #fff;
  font-size: 17px; font-weight: 700; line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: background .12s;
}
.lb-zoom button:first-child { border-right: 1px solid rgba(255,255,255,.2); }
.lb-zoom button:hover  { background: rgba(255,255,255,.18); }
.lb-zoom button:active { background: rgba(255,255,255,.28); }

@media (max-width: 480px) {
  .lb-nav { width: 32px; height: 32px; font-size: 17px; }
  .lb-nav.prev { left: 6px; }
  .lb-nav.next { right: 6px; }
  .lb-btn { padding: 9px 13px; font-size: 12.5px; }
}

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: var(--radius-sm);
  background: var(--blue); color: #fff;
  padding: 11px 18px;
  font-size: 14.5px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(61,184,217,.28);
  font-family: inherit;
  transition: background .15s, box-shadow .15s, transform .12s;
}
.btn:hover  { background: var(--blue-deep); box-shadow: 0 4px 16px rgba(61,184,217,.35); }
.btn:active { transform: scale(.96); }
.btn.ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--line);
  box-shadow: none;
}
.btn.ghost:hover { border-color: var(--blue); color: var(--blue-deep); box-shadow: none; }
.btn.sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }

/* ---------- Fields ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 6px; color: var(--ink); }
.field input, .field textarea {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14.5px; font-family: inherit;
  background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.field input:focus, .field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.field input[readonly] { background: var(--bg); color: var(--muted); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.45; }

/* ---------- Panel ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.panel h2 { margin: 0 0 14px; font-size: 17px; font-weight: 800; }

.collapse-head {
  display: flex; align-items: center;
  justify-content: space-between;
  cursor: pointer; user-select: none;
}
.collapse-arrow { color: var(--muted); font-size: 15px; }

/* ---------- Gallery row (admin) ---------- */
.gallery-row {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.gallery-row:last-child { border-bottom: none; }
.gallery-row .info { min-width: 0; }
.gallery-row .info b { font-size: 14.5px; font-weight: 800; }
.gallery-row .info .link { font-size: 12px; color: var(--muted); word-break: break-all; }
.gallery-row .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Badge ---------- */
.badge {
  display: inline-block;
  background: var(--blue-soft); color: var(--blue-deep);
  border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 700;
}

/* ---------- Alert ---------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13.5px; font-weight: 600;
  margin-bottom: 14px;
}
.alert.err  { background: #fdeaea; color: #b3261e; }
.alert.ok   { background: #e9f7ef; color: #1a7a4a; }
.alert.warn { background: #fff6e5; color: #8a5f00; }

.center-card { max-width: 380px; margin: 60px auto; }
.muted { color: var(--muted); }
.row   { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16,14,20,.55);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal.show { display: flex; }

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.modal-card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 800; }

.modal-input {
  width: 100%; padding: 11px 14px;
  font-size: 15px; font-family: inherit;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.modal-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 70;
  transform: translate(-50%, 16px);
  background: var(--ink); color: #fff;
  padding: 11px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 700;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  opacity: 0; transition: opacity .2s ease, transform .2s ease;
  max-width: 90vw; text-align: center;
  font-family: inherit;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Comments ---------- */
.cmt-list { max-height: 230px; overflow-y: auto; margin-bottom: 12px; }
.cmt-item {
  background: var(--blue-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 8px;
}
.cmt-body  { font-size: 14px; color: var(--ink); white-space: pre-wrap; word-break: break-word; font-weight: 500; }
.cmt-time  { font-size: 11px; color: var(--muted); margin-top: 4px; }
.cmt-input {
  width: 100%; padding: 10px 12px;
  font-size: 15px; font-family: inherit;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  resize: vertical; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.cmt-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

/* ---------- Admin grid ---------- */
.admin-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.admin-grid .card { aspect-ratio: 3 / 4; }
.admin-grid .card img { width: 100%; height: 100%; object-fit: cover; }

.cmt-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.cmt-thumb {
  width: 54px; height: 54px; object-fit: cover;
  border-radius: 10px; cursor: zoom-in; flex: none;
}
.cmt-row-name { font-weight: 800; font-size: 13px; margin-bottom: 2px; }

/* ---------- hint (admin shared) ---------- */
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
