/* ─── UTILITIES ──────────────────────────────────────── */
.hidden { display: none !important; }
.view   { display: none; }
.view.active { display: block; }
#view-login.active {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 60px);
}

/* shimmer — referenced by inline style in media.js */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── AVATAR ─────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ─── APP HEADER (navbar — fixed, không trôi khi cuộn) ─ */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  background: var(--surface);
  padding-top: var(--safe-t);
  height: var(--stack-top);
  border-bottom: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  display: flex; align-items: center;
}
body.media-page { padding-top: var(--stack-top); }
body.media-page.in-event { padding-top: var(--stack-top-event); }
.app-header > .inner {
  display: flex; align-items: center; gap: .6rem;
  width: 100%; padding: 0 1rem; min-width: 0;
}
#brand-label {
  font-size: 1rem; font-weight: 700; color: var(--primary);
  white-space: nowrap; flex-shrink: 0;
}
.header-search {
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface-2); border-radius: 10px;
  padding: .35rem .75rem; flex: 1; max-width: 280px;
}
.header-search input {
  border: none; background: none; font-size: .875rem; flex: 1;
  font-family: inherit; min-width: 0; color: var(--text);
}
.header-search input:focus { outline: none; }
.header-search .icon { font-size: .85rem; color: var(--muted-2); }
#header-user {
  display: flex; align-items: center; gap: .5rem; flex-shrink: 0;
}
#user-avatar {
  width: 36px; height: 36px; font-size: .9rem; cursor: pointer;
}
#user-name-label {
  font-size: .84rem; font-weight: 600; white-space: nowrap;
  display: none;
}
@media (min-width: 640px) { #user-name-label { display: inline; } }
#btn-notif {
  background: none; border: 1.5px solid var(--border-input); border-radius: 8px;
  padding: .2rem .45rem; font-size: .9rem; cursor: pointer;
  transition: all .15s; line-height: 1;
}
#btn-notif.on { border-color: var(--primary); background: var(--primary-l); }
#btn-logout {
  font-size: .8rem; font-weight: 500; color: var(--muted);
  background: var(--surface-2); border: none; border-radius: 8px;
  padding: .3rem .7rem; cursor: pointer; white-space: nowrap;
  transition: all .15s;
}
#btn-logout:hover { background: var(--danger-l); color: var(--danger); }
.nav-btn {
  font-size: .84rem; font-weight: 600; color: var(--muted);
  background: none; border: 1.5px solid var(--border-input); border-radius: 8px;
  padding: .28rem .7rem; cursor: pointer; white-space: nowrap;
  transition: all .15s;
}
.nav-btn:hover, .nav-btn.active {
  background: var(--primary-l); border-color: var(--primary); color: var(--primary);
}

/* ─── EVENT SUBNAV (thanh trái/phụ — fixed dưới navbar) ─ */
#event-subnav {
  background: var(--surface); border-bottom: 1px solid rgba(0,0,0,.07);
  position: fixed; top: var(--stack-top); left: 0; right: 0; z-index: 800;
  min-height: var(--subnav-h);
}
.subnav-inner {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .5rem 1rem; max-width: 1200px; margin: 0 auto;
}
.subnav-back {
  font-size: .8rem; color: var(--text-3); background: var(--surface-2);
  border: none; border-radius: 8px; padding: .3rem .7rem;
  cursor: pointer; white-space: nowrap; transition: background .15s;
  flex-shrink: 0;
}
.subnav-back:hover { background: var(--border-input); }
.subnav-name {
  font-weight: 700; font-size: .88rem; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.subnav-tab {
  font-size: .82rem; font-weight: 600; color: var(--muted);
  background: none; border: 1.5px solid var(--border-input); border-radius: 8px;
  padding: .28rem .7rem; cursor: pointer; transition: all .15s;
}
.subnav-tab.active, .subnav-tab:hover {
  background: var(--primary-l); border-color: var(--primary); color: var(--primary);
}
.subnav-upload {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  transition: opacity .15s; flex-shrink: 0;
}
.subnav-upload:hover { opacity: .85; }

/* ─── PAGE ───────────────────────────────────────────── */
body { background: var(--bg); }
.page { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.section-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.section-title { font-size: 1.15rem; font-weight: 700; }
.section-sub   { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.btn-new {
  font-size: .84rem; font-weight: 600; color: var(--primary);
  background: var(--primary-l); border: 1.5px solid var(--primary-m); border-radius: 8px;
  padding: .35rem .85rem; cursor: pointer; white-space: nowrap;
  transition: all .15s; flex-shrink: 0;
}
.btn-new:hover { background: #e0e7ff; }

/* ─── LOGIN CARD (embedded view) ─────────────────────── */
.login-card {
  background: var(--surface); border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,.12);
  max-width: 400px; width: 90%; overflow: hidden;
}
.login-hero {
  background: linear-gradient(135deg, var(--primary), var(--purple));
  padding: 2rem; text-align: center; color: #fff;
}
.login-hero h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: .4rem; }
.login-hero p  { font-size: .88rem; opacity: .85; margin: 0; }
.auth-tabs { display: flex; border-bottom: 1px solid rgba(0,0,0,.07); }
.auth-tab {
  flex: 1; padding: .7rem; background: none; border: none;
  font-size: .88rem; font-weight: 600; color: var(--muted-2); cursor: pointer;
  border-bottom: 2.5px solid transparent; transition: all .15s;
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.login-body { padding: 1.5rem; }
.field { margin-bottom: .9rem; }
.field label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .3rem; color: var(--text-2); }
.field input {
  width: 100%; padding: .52rem .8rem;
  border: 1.5px solid var(--border-input); border-radius: 10px;
  font-size: .9rem; font-family: inherit; transition: border-color .15s;
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.pw-row { position: relative; display: flex; }
.pw-row input { flex: 1; padding-right: 2.5rem; }
.pw-toggle {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1rem; padding: 0;
}
.btn-primary {
  display: block; width: 100%; padding: .58rem;
  background: var(--primary); color: #fff; border: none; border-radius: 10px;
  font-size: .92rem; font-weight: 600; cursor: pointer;
  transition: opacity .15s; margin-top: .4rem;
}
.btn-primary:hover { opacity: .88; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

/* ─── FILTER BAR ─────────────────────────────────────── */
.filter-bar {
  display: flex; gap: .75rem; align-items: center;
  flex-wrap: wrap; margin-bottom: 1.25rem;
}
.search-box {
  display: flex; align-items: center; gap: .4rem;
  background: var(--surface); border: 1.5px solid var(--border-input); border-radius: 10px;
  padding: .38rem .75rem; flex: 1; min-width: 180px;
}
.search-box .icon { color: var(--muted-2); font-size: .88rem; }
.search-box input {
  border: none; background: none; font-size: .88rem; flex: 1;
  font-family: inherit; min-width: 0;
}
.search-box input:focus { outline: none; }
.filter-select {
  padding: .38rem .7rem; border: 1.5px solid var(--border-input);
  border-radius: 10px; font-size: .875rem; background: var(--surface);
  font-family: inherit; cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--primary); }

/* ─── EVENTS GRID ────────────────────────────────────── */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
}
.event-card {
  background: var(--surface); border-radius: 14px; padding: 1.1rem;
  cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.07);
  transition: transform .15s, box-shadow .15s; position: relative;
}
.event-card:hover { transform: translateY(-2px); box-shadow: 0 4px 18px rgba(0,0,0,.1); }
.event-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: .4rem; color: var(--text); }
.event-card p  { font-size: .85rem; color: var(--muted); margin: 0 0 .25rem; }
.event-dates   { font-size: .8rem; color: var(--muted-2); }

/* ─── ALBUM GRID & CARD ──────────────────────────────── */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
}
.album-card {
  background: var(--surface); border-radius: 14px; overflow: hidden; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.07); transition: transform .15s, box-shadow .15s;
}
.album-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.album-thumb {
  position: relative; height: 165px;
  background: linear-gradient(135deg, var(--primary-l), #f5f3ff); overflow: hidden;
}
.album-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.album-card:hover .album-thumb img { transform: scale(1.04); }
.album-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center; font-size: 2.5rem;
}
.album-badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: .7rem; padding: 2px 8px; border-radius: 999px;
}
.album-info { padding: .75rem; }
.album-title {
  font-weight: 600; font-size: .9rem; margin-bottom: .3rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.album-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .76rem; color: var(--muted);
  flex-wrap: wrap; gap: .3rem;
}
.like-chip { color: var(--muted-2); font-size: .76rem; }

/* ─── MASONRY ────────────────────────────────────────── */
.masonry { columns: 3; column-gap: .75rem; }
@media (max-width: 900px) { .masonry { columns: 2; } }
@media (max-width: 480px) { .masonry { columns: 1; } }
.masonry-item {
  break-inside: avoid; margin-bottom: .75rem;
  border-radius: 10px; overflow: hidden; position: relative;
  cursor: pointer; background: var(--surface-2);
}
.masonry-item img { width: 100%; display: block; transition: transform .3s; }
.masonry-item:hover img { transform: scale(1.03); }
.photo-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.55) 0%, transparent 60%);
  opacity: 0; transition: opacity .2s;
  display: flex; flex-direction: column; justify-content: flex-end; padding: .5rem;
}
.masonry-item:hover .photo-overlay { opacity: 1; }
.photo-actions { display: flex; gap: .3rem; justify-content: flex-end; margin-bottom: .25rem; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.9); border: none; cursor: pointer;
  font-size: .8rem; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.icon-btn:hover { background: var(--surface); }
.photo-author { font-size: .74rem; color: rgba(255,255,255,.9); font-weight: 500; }

/* ─── DETAIL HEADER ──────────────────────────────────── */
.detail-header {
  display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
  margin-bottom: 1.25rem; padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0,0,0,.07);
}
.btn-back {
  background: var(--surface-2); border: none; border-radius: 8px;
  padding: .32rem .8rem; font-size: .84rem; cursor: pointer;
  color: var(--text-3); font-weight: 500; white-space: nowrap;
  transition: background .15s; flex-shrink: 0;
}
.btn-back:hover { background: var(--border-input); }
.detail-title {
  font-size: 1.05rem; font-weight: 700; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-like-album {
  background: var(--surface-2); border: 1.5px solid var(--border-input); border-radius: 8px;
  padding: .32rem .8rem; font-size: .84rem; cursor: pointer;
  color: var(--text-3); font-weight: 500; white-space: nowrap;
  transition: all .15s; flex-shrink: 0;
}
.btn-like-album.liked,
.btn-like-album:hover { background: var(--primary-l); border-color: var(--primary); color: var(--primary); }
.btn-upload {
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: .32rem .8rem; font-size: .84rem; cursor: pointer;
  font-weight: 500; white-space: nowrap; transition: opacity .15s; flex-shrink: 0;
}
.btn-upload:hover { opacity: .88; }

/* ─── UPLOAD ZONE ────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--primary-m); border-radius: 14px;
  padding: 2.5rem 1.5rem; text-align: center; cursor: pointer;
  background: var(--primary-l); transition: all .2s; margin-bottom: .75rem;
}
.upload-zone:hover, .upload-zone.drag-over {
  background: var(--primary-l); border-color: var(--primary);
}
.upload-zone .icon { font-size: 2.2rem; margin-bottom: .6rem; }
.upload-zone p   { color: var(--muted); margin: 0 0 .25rem; font-size: .9rem; }
.upload-zone small { font-size: .78rem; color: var(--muted-2); }

/* ─── PROGRESS ITEMS ─────────────────────────────────── */
.progress-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.progress-item {
  display: flex; align-items: center; gap: .65rem;
  background: var(--surface); border-radius: 10px; padding: .55rem .75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.progress-name {
  flex: 1; font-size: .83rem; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.progress-track { flex: 0 0 110px; height: 5px; background: var(--border-input); border-radius: 999px; overflow: hidden; }
.progress-fill  { height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }
.progress-icon  { font-size: .95rem; flex-shrink: 0; }
.progress-item.done .progress-fill { background: var(--success); }
.progress-item.err  .progress-fill { background: var(--danger); }

/* ─── LOAD MORE ──────────────────────────────────────── */
.load-more-indicator {
  text-align: center; padding: 1.5rem; color: var(--muted-2);
  font-size: .875rem; display: none;
  align-items: center; justify-content: center; gap: .5rem;
}
.load-more-indicator.active { display: flex; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--border-input); border-top-color: var(--primary);
  animation: spin .7s linear infinite; display: inline-block; flex-shrink: 0;
}

/* ─── EMPTY STATE ────────────────────────────────────── */
.empty { text-align: center; padding: 4rem 1rem; color: var(--muted-2); }
.empty .icon { font-size: 3rem; margin-bottom: 1rem; line-height: 1; }
.empty .icon i { font-size: 3rem; }
.empty p { font-size: .95rem; }

/* ─── SKELETON ───────────────────────────────────────── */
.skeleton-album, .skeleton-item {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border-input) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 14px; overflow: hidden;
}
.skeleton-cover { height: 155px; }
.skeleton-body  { padding: .75rem; }
.skeleton-line  { height: 11px; background: rgba(0,0,0,.08); border-radius: 4px; margin-bottom: .4rem; }
.skeleton-line.short { width: 55%; }
.skeleton-thumb { width: 100%; min-height: 120px; background: rgba(0,0,0,.05); }

/* ─── ADMIN BUTTONS ON CARDS ─────────────────────────── */
.del-small-btn, .edit-small-btn {
  position: absolute; width: 28px; height: 28px; border-radius: 50%;
  border: none; cursor: pointer; font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; z-index: 1;
}
.del-small-btn  { background: rgba(220,38,38,.85); color: #fff; top: 8px; right: 8px; }
.edit-small-btn { background: rgba(79,70,229,.85); color: #fff; top: 8px; right: 42px; }
.del-small-btn:hover  { background: var(--danger); transform: scale(1.1); }
.edit-small-btn:hover { background: var(--primary); transform: scale(1.1); }

/* ─── LIGHTBOX ───────────────────────────────────────── */
#lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.96);
  z-index: 2000; display: none; flex-direction: column;
}
#lightbox.open { display: flex; }
.lb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.25rem; flex-shrink: 0;
}
.lb-close {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: none; color: #fff;
  font-size: 1.1rem; cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: background .15s;
}
.lb-close:hover { background: rgba(255,255,255,.22); }
.lb-actions { display: flex; gap: .5rem; }
.lb-btn {
  background: rgba(255,255,255,.12); border: none; color: #fff;
  padding: .32rem .9rem; border-radius: 999px; cursor: pointer;
  font-size: .84rem; transition: background .15s;
}
.lb-btn:hover { background: rgba(255,255,255,.22); }
.lb-btn.liked { background: rgba(79,70,229,.55); }
.lb-body {
  flex: 1; display: flex; align-items: center; position: relative; overflow: hidden;
  min-height: 0;
}
#lb-img {
  max-width: 100%; max-height: 100%; object-fit: contain; margin: 0 auto;
  display: block; transition: opacity .2s;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.13); border: none; color: #fff;
  font-size: 1.15rem; cursor: pointer; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.lb-nav:hover { background: rgba(255,255,255,.25); }
.lb-prev { left: 1rem; }
.lb-next { right: 1rem; }
.lb-footer {
  padding: .7rem 1.25rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
}
.lb-meta, .lb-counter { font-size: .82rem; color: rgba(255,255,255,.65); }

/* ─── MODAL OVERLAY ──────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 1050; display: none; align-items: center;
  justify-content: center; padding: 1rem;
  backdrop-filter: blur(4px);
}
.overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 16px; max-width: 480px;
  width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: modal-in .2s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1.4rem; border-bottom: 1px solid rgba(0,0,0,.07);
}
.modal-head h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-2); border: none; cursor: pointer; font-size: .9rem;
  color: var(--muted); font-weight: 700;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.modal-close:hover { background: var(--border-input); }
.modal-body { padding: 1.4rem; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: .65rem;
  padding: 1rem 1.4rem; border-top: 1px solid rgba(0,0,0,.07);
}

/* Modal form elements */
.form-field { margin-bottom: 1rem; }
.form-field label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .3rem; color: var(--text-2); }
.form-field input, .form-field select {
  width: 100%; padding: .5rem .75rem;
  border: 1.5px solid var(--border-input); border-radius: 10px;
  font-size: .88rem; font-family: inherit; background: var(--surface);
  transition: border-color .15s;
}
.form-field input:focus, .form-field select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.toggle-row { display: flex; align-items: center; gap: .55rem; font-size: .88rem; }
.toggle-row input[type="checkbox"] { width: 17px; height: 17px; cursor: pointer; accent-color: var(--primary); }
.cover-preview-box {
  width: 100%; height: 155px; border-radius: 10px;
  border: 2px dashed var(--border-input); cursor: pointer; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); transition: border-color .15s; margin-bottom: .5rem;
}
.cover-preview-box:hover { border-color: var(--primary); }
.cover-preview-box img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview-placeholder { color: var(--muted-2); font-size: .84rem; text-align: center; }

/* Modal buttons */
.btn-cancel {
  background: var(--surface-2); border: none; border-radius: 8px;
  padding: .48rem 1.15rem; font-size: .88rem; cursor: pointer;
  font-weight: 500; color: var(--muted); transition: background .15s;
}
.btn-cancel:hover { background: var(--border-input); }
.btn-confirm {
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: .48rem 1.15rem; font-size: .88rem; cursor: pointer;
  font-weight: 600; transition: opacity .15s;
}
.btn-confirm:disabled { opacity: .5; cursor: not-allowed; }
.btn-confirm:hover:not(:disabled) { opacity: .88; }

/* ─── UPLOAD FAB ─────────────────────────────────────── */
#upload-fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none;
  font-size: 1.5rem; cursor: pointer;
  box-shadow: 0 4px 20px rgba(79,70,229,.4); z-index: 900;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s;
}
#upload-fab:hover { transform: scale(1.08); box-shadow: 0 6px 26px rgba(79,70,229,.5); }

/* ─── TOASTS ─────────────────────────────────────────── */
#toasts {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column-reverse; gap: .4rem;
  z-index: 2100; max-width: 320px; pointer-events: none;
}
/* Override Bootstrap's .toast:not(.show) { display:none } with higher specificity */
#toasts .toast {
  display: block; opacity: 1;
  padding: .6rem 1.1rem; border-radius: 10px;
  font-size: .875rem; font-weight: 500; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.2); width: auto;
  border: none; pointer-events: auto; max-width: 100%;
}
#toasts .toast.ok  { background: #1e293b; }
#toasts .toast.err { background: var(--danger); }

#profile-avatar-wrap {
  width: 80px; height: 80px; border-radius: 50%; overflow: hidden;
  margin: 0 auto .5rem; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), #ec4899);
}
#profile-avatar-inner {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.8rem; font-weight: 700;
}

/* ─── LAYOUT UTILITIES ───────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: .5rem; }
.ms-auto { margin-left: auto; }
.icon-inline { font-size: 1rem; line-height: 1; vertical-align: middle; }

/* ─── HEADER ENHANCEMENTS ────────────────────────────── */
#btn-chat-header {
  position: relative;
  background: none;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-s);
  padding: .28rem .55rem;
  font-size: 1rem;
  color: var(--muted);
  transition: all var(--dur) var(--ease);
  line-height: 1;
}
#btn-chat-header:hover, #btn-chat-header.active {
  background: var(--primary-l);
  border-color: var(--primary);
  color: var(--primary);
}
#btn-chat-header .chat-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
}
#btn-chat-header .chat-badge.show { display: flex; }

.event-card-new {
  padding: 1.1rem !important;
  border: 2px dashed var(--primary-m);
  background: var(--primary-l);
  color: var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 100px;
  font-size: 2rem;
}
.event-card-new:hover { background: #e0e7ff; border-color: var(--primary); }

/* ─── EVENT CARD COVER ───────────────────────────────── */
.event-card { padding: 0; overflow: hidden; }
.event-card-body { padding: 1rem 1.1rem 1.1rem; }
.event-card-cover {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.75rem;
}
.event-card-cover i { font-size: 1.75rem; opacity: .92; }

/* ─── MOBILE PHOTO ACTIONS ───────────────────────────── */
@media (hover: none), (pointer: coarse) {
  .masonry-item .photo-overlay {
    opacity: 1;
    background: linear-gradient(to top, rgba(0,0,0,.65) 0%, transparent 55%);
  }
}
.masonry-item.actions-open .photo-overlay { opacity: 1; }

/* ─── EMPTY STATE CTA ────────────────────────────────── */
.empty-cta {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: 1rem;
  padding: .45rem 1rem;
  background: var(--primary-l);
  border: 1.5px solid var(--primary-m);
  border-radius: var(--radius-s);
  color: var(--primary);
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur);
}
.empty-cta:hover { background: #e0e7ff; }

/* ─── CONFIRM DIALOG ─────────────────────────────────── */
#modal-confirm .modal-body p {
  font-size: .9rem;
  color: var(--text-3);
  line-height: 1.5;
  margin: 0;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-s);
  padding: .48rem 1.15rem;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { opacity: .9; }

/* ─── BOTTOM NAV (mobile, in-event — fixed dưới cùng) ── */
#bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 880;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}
#bottom-nav.visible { display: flex; }
#bottom-nav .bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: .45rem .25rem;
  font-size: .65rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
}
#bottom-nav .bn-item i { font-size: 1.15rem; }
#bottom-nav .bn-item.active { color: var(--primary); }
#bottom-nav .bn-item .chat-badge {
  position: absolute;
  top: 4px; right: calc(50% - 22px);
  min-width: 14px; height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: .58rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
}
#bottom-nav .bn-item .chat-badge.show { display: flex; }

body.in-event .page {
  padding-bottom: calc(4rem + var(--bottom-nav-h) + var(--safe-b));
}
body.in-event #upload-fab {
  bottom: calc(1.5rem + var(--bottom-nav-h) + var(--safe-b));
}
body.in-event #toasts {
  bottom: calc(1.5rem + var(--bottom-nav-h) + var(--safe-b));
}

/* ─── LIGHTBOX SAFE AREA ─────────────────────────────── */
#lightbox .lb-header { padding-top: calc(.9rem + var(--safe-t)); }
#lightbox .lb-footer { padding-bottom: calc(.7rem + var(--safe-b)); }

/* ─── FOCUS VISIBLE ──────────────────────────────────── */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .header-search { max-width: 140px; }
  .nav-btn span.lbl { display: none; }
  .two-col { grid-template-columns: 1fr; }
}

/* ─── FEATURED MANAGEMENT VIEW ───────────────────────── */
.featured-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 768px) {
  .featured-layout { grid-template-columns: 1fr; }
}
.featured-pinned-panel,
.featured-browse-panel {
  background: var(--surface);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.featured-pinned-panel {
  position: sticky;
  top: calc(var(--stack-top) + 1rem);
  max-height: calc(100vh - var(--stack-top) - 2rem);
  overflow-y: auto;
}
@media (max-width: 768px) {
  .featured-pinned-panel { position: static; max-height: none; overflow-y: visible; }
}
.featured-browse-panel {
  max-height: calc(100vh - var(--stack-top) - 2rem);
  overflow-y: auto;
  min-height: 300px;
}
@media (max-width: 768px) {
  .featured-browse-panel { max-height: none; overflow-y: visible; }
}
.featured-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .75rem; padding-bottom: .6rem;
  border-bottom: 1px solid rgba(0,0,0,.07);
}
.featured-panel-title { font-weight: 700; font-size: .9rem; }
.featured-panel-hint  { font-size: .72rem; color: var(--muted-2); }
.featured-list { display: flex; flex-direction: column; gap: .45rem; min-height: 40px; }
.featured-item {
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface-2); border-radius: 10px;
  padding: .45rem .55rem;
  border: 1.5px solid transparent; transition: border-color .15s, background .15s;
}
.featured-item.drag-over { border-color: var(--primary); background: var(--primary-l); }
.featured-item[draggable="true"] { cursor: grab; }
.featured-item[draggable="true"]:active { cursor: grabbing; }
.featured-drag-handle {
  color: var(--muted-2); font-size: 1rem; flex-shrink: 0; line-height: 1;
}
.featured-item-thumb {
  width: 48px; height: 48px; border-radius: 7px;
  object-fit: cover; flex-shrink: 0; background: var(--border-input);
}
.featured-item-info { flex: 1; min-width: 0; }
.featured-item-order { font-size: .68rem; color: var(--muted-2); font-weight: 700; line-height: 1.3; }
.featured-item-name  {
  font-size: .82rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.featured-item-meta  {
  font-size: .72rem; color: var(--muted-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.featured-item-remove {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: transparent; border: none; color: var(--muted-2);
  cursor: pointer; font-size: .75rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.featured-item-remove:hover { background: rgba(220,38,38,.1); color: var(--danger); }

/* Star badge on featured browse masonry items */
.masonry-item.is-featured::after {
  content: '★';
  position: absolute; top: 5px; left: 7px;
  color: #f59e0b; font-size: 1rem; line-height: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
  pointer-events: none;
}
.icon-btn.btn-star { transition: color .15s; }
.icon-btn.btn-star.pinned { color: #f59e0b; }

/* Lightbox pin button */
#lb-pin.pinned { background: rgba(245,158,11,.35); }
#lb-pin.pinned:hover { background: rgba(245,158,11,.5); }
