/* ==========================================================================
   app.css (REWRITE) — Stella Blazor UI
   Goals:
   - Calm, editorial Stella theme with warm neutral surfaces
   - Responsive grids (albums/media) for phones/tablets/desktop
   - Responsive tables and accessible controls
   - Keep existing legacy class names so components don’t break
   ========================================================================== */

/* -----------------------------
   0) Reset + base typography
   ----------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  background: #f6f5ef;
  color: #25352e;
}

/* Stella uses a warm paper-like surface throughout the shell. */
.page, main, .page main > article.content {
  background: #f6f5ef;
}

/* Links */
a { color: inherit; }
a:hover { text-decoration: underline; }

/* Common focus ring */
:focus-visible{
  outline: none;
  box-shadow: 0 0 0 2px rgba(246,245,239,.95), 0 0 0 4px rgba(49,90,75,.42);
  border-radius: 10px;
}

/* Utility */
.ml-auto { margin-left: auto; }


/* -----------------------------
   1) Detail page header + back
   ----------------------------- */
.fd-header{
  display:flex;
  align-items:center;
  gap:.75rem;
  margin:.5rem 0 1rem;
}

.btn-back{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:.55rem .9rem;
  font-weight:800;
  font-size:1rem;
  color:#0ea5e9;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  border-radius:12px;
  cursor:pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
  transition: transform .12s ease, filter .2s ease, background .2s ease;
}
.btn-back:hover{ transform: translateY(-1px); filter: brightness(1.06); }
.btn-back:active{ transform: translateY(1px); }

.fd-title{
  margin:0;
  font-size:1.25rem;
  font-weight:900;
  color:#e8ecf6;
}

/* Make back button never get clipped */
.btn-row, .btn-row * { overflow: visible; }


/* ==========================================================================
   2) Memories (Home/Years/Albums) — container uses .memories-root
   ========================================================================== */

.memories-root{
  /* Theme tokens */
  --fm-bg0:#070a14;
  --fm-bg1:#0b1022;
  --fm-card: rgba(255,255,255,.06);
  --fm-stroke: rgba(255,255,255,.10);
  --fm-stroke-2: rgba(255,255,255,.16);
  --fm-pill: rgba(255,255,255,.07);
  --fm-text:#eaf0ff;
  --fm-muted:#a9b4c7;

  --fm-glow-a: rgba(145, 90, 255, .35);
  --fm-glow-b: rgba( 60,200, 255, .22);
  --fm-glow-c: rgba(255,120, 200, .18);

  display:block;
  width:100%;
  min-height: 100vh;
  color: var(--fm-text);

  background:
    radial-gradient(900px 520px at 10% -10%, var(--fm-glow-a), transparent 60%),
    radial-gradient(900px 520px at 90%   0%, var(--fm-glow-b), transparent 55%),
    radial-gradient(900px 520px at 60% 110%, var(--fm-glow-c), transparent 60%),
    linear-gradient(180deg, var(--fm-bg0), var(--fm-bg1));
}

/* Optional header text area */
.memories-root .fm-header h1{ margin:0 0 .25rem; color:#fff; font-weight: 1000; }
.memories-root .fm-header p{ margin:0 0 1rem; color:var(--fm-muted); }

/* Constrain width but keep background full-bleed */
.memories-root .fm-container{
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 10px 28px;
}

/* -----------------------------
   2.1) Age tabs (pills)
   ----------------------------- */
.memories-root .fm-age-tabs{
  display:flex;
  gap:.6rem;
  flex-wrap:wrap;
  margin: .4rem 0 1rem;
  padding: .55rem .6rem;
  border-radius: 16px;
  background: rgba(10, 14, 28, .55);
  border: 1px solid rgba(255,255,255,.07);
  box-shadow:
    0 14px 34px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(10px);
}

.memories-root .fm-age-tabs .age-tab{
  all: unset;
  cursor:pointer;
  user-select:none;
  padding: .55rem 1rem;
  border-radius:999px;
  font-weight:900;
  letter-spacing:.15px;
  color: rgba(255,255,255,.90);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 10px 20px rgba(0,0,0,.22);
  transition: transform .14s ease, filter .18s ease;
}

.memories-root .fm-age-tabs .age-tab:hover{
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.memories-root .fm-age-tabs .age-tab.active{
  background: linear-gradient(135deg, rgba(120,110,255,.95), rgba(226, 92, 200, .92));
  border: 1px solid rgba(255,255,255,.14);
  box-shadow:
    0 10px 26px rgba(160,120,255,.22),
    0 6px 18px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.18);
}

/* Mobile sticky tabs under your top bar (uses --hdr from layout if present) */
@media (max-width: 640.98px){
  .memories-root .fm-age-tabs{
    position: sticky;
    top: calc(var(--hdr, 56px) + env(safe-area-inset-top, 0px));
    z-index: 6;
    margin: .25rem 0 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .memories-root .fm-age-tabs::-webkit-scrollbar{ display:none; }
  .memories-root .fm-age-tabs{ scroll-margin-top: calc(var(--hdr, 56px) + 12px); }
}

/* -----------------------------
   2.2) Album cards grid
   ----------------------------- */
.memories-root .album-grid{
  display:grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(clamp(170px, 28vw, 240px), 1fr));
}

/* phone: 2 columns, square covers */
@media (max-width: 520px){
  .memories-root .album-grid{
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 10px;
  }
}

/* tablet: 3–4 columns */
@media (min-width: 521px) and (max-width: 900px){
  .memories-root .album-grid{
    grid-template-columns: repeat(3, minmax(0,1fr));
  }
}

.memories-root .album-card{
  all: unset;
  display:block;
  cursor:pointer;
  position:relative;
  border-radius: 18px;
  overflow:hidden;
  background: var(--fm-card);
  border: 1px solid var(--fm-stroke);
  box-shadow: 0 18px 46px rgba(0,0,0,.40);
  backdrop-filter: blur(14px);
  transform: translateZ(0);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease, border-color .18s ease;
}

.memories-root .album-card::before{
  content:"";
  position:absolute;
  inset:-1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg,
      rgba(150,110,255,.55),
      rgba( 70,205,255,.28),
      rgba(255,130,205,.22)
  );
  -webkit-mask:
     linear-gradient(#000 0 0) content-box,
     linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .55;
  pointer-events:none;
}

.memories-root .album-card:hover{
  transform: translateY(-4px);
  box-shadow: 0 24px 60px rgba(0,0,0,.52);
  border-color: var(--fm-stroke-2);
  filter: brightness(1.03);
}

.memories-root .album-cover{
  position:relative;
  aspect-ratio: 16/10;
  background:
    radial-gradient(600px 240px at 20% 0%, rgba(255,255,255,.16), transparent 55%),
    linear-gradient(135deg, rgba(18,24,45,.95), rgba(10,14,28,.95));
}

@media (max-width: 520px){
  .memories-root .album-cover{ aspect-ratio: 1/1; }
}

.memories-root .album-cover::before{
  content:"";
  position:absolute;
  inset:0;
  z-index: 1;
  background:
    radial-gradient(600px 240px at 20% 0%, rgba(255,255,255,.14), transparent 55%),
    linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.22));
  pointer-events:none;
}

.memories-root .album-cover img{
  position:relative;
  z-index: 0;
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  transform: scale(1.02);
  transition: transform .35s ease, filter .35s ease;
}
.memories-root .album-card:hover .album-cover img{
  transform: scale(1.07);
  filter: saturate(1.06);
}

/* Placeholder */
.memories-root .album-placeholder{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  color: rgba(234,240,255,.72);
  font-weight: 900;
  letter-spacing: .2px;
}

/* ----- Overlay system (supports your current markup) ----- */
/* Old combined overlay (kept for compatibility) */
.memories-root .album-overlay{
  position:absolute;
  inset:auto 0 0;
  padding: .7rem .75rem .75rem;
  display:grid;
  grid-template-columns: 1fr auto;
  align-items:end;
  gap:.5rem;
  background: linear-gradient(to top, rgba(0,0,0,.68), rgba(0,0,0,0));
  z-index: 2;
  pointer-events:none;
}

/* Split overlays (preferred) */
.album-overlay-top{
  position:absolute;
  left:0; right:0; top:0;
  padding:.55rem .6rem;
  background: linear-gradient(to bottom, rgba(0,0,0,.62), rgba(0,0,0,0));
  z-index: 3;
  pointer-events:none;
}

.album-overlay-bottom{
  position:absolute;
  left:0; right:0; bottom:0;
  padding:.58rem .6rem;
  display:flex;
  justify-content:flex-end;
  align-items:flex-end;
  gap:.5rem;
  background: linear-gradient(to top, rgba(0,0,0,.70), rgba(0,0,0,0));
  z-index: 3;
  pointer-events:none;
}

.memories-root .album-title,
.album-title{
  font-weight: 1000;
  letter-spacing: .15px;
  color:#fff;
  text-shadow: 0 10px 26px rgba(0,0,0,.55);
  max-width: 92%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Count pill (works for both old and split overlay) */
.memories-root .album-count,
.album-count{
  font-size:.84rem;
  font-weight: 900;
  letter-spacing: .12px;
  padding:.24rem .6rem;
  border-radius: 999px;
  color:#fff !important;
  background: rgba(12, 16, 34, .55);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow:
    0 10px 24px rgba(0,0,0,.25),
    inset 0 1px 0 rgba(255,255,255,.10);
  backdrop-filter: blur(10px);
  white-space: nowrap;
}

/* If you output multiple pills later */
.album-counts{ display:flex; gap:.5rem; flex-wrap:wrap; justify-content:flex-end; }
.album-count.video{
  background: linear-gradient(135deg, rgba(120,110,255,.45), rgba(226, 92, 200, .38));
  border-color: rgba(255,255,255,.14);
}


/* ==========================================================================
   3) Media grid inside an album (FolderDetail / Slideshow page)
   ========================================================================== */

.media-grid{
  display:grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  margin-top: 1rem;
}

/* phone: 2 columns (tighter) */
@media (max-width: 520px){
  .media-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
  }
}

.media-card{
  position:relative;
  border-radius: 14px;
  overflow:hidden;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

.media-card img,
.media-card video{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
  aspect-ratio: 4 / 3;
}

/* Play badge for videos */
.badge-play{
  position:absolute;
  right:.5rem;
  bottom:.5rem;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display:grid;
  place-items:center;
  font-weight: 900;
  color:#fff;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(6px);
}


/* ==========================================================================
   4) Buttons / toolbars used in admin & delete mode
   ========================================================================== */

.pill-btn{
  display:inline-flex;
  align-items:center;
  gap:.55rem;
  padding:.55rem .95rem;
  border-radius:999px;
  font-weight:900;
  line-height:1;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color:#e8ecf8;
  cursor:pointer;
  transition:background .2s ease, box-shadow .2s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.pill-btn:hover{ background: rgba(255,255,255,.10); }
.pill-btn:active{ transform: translateY(1px); }
.pill-btn .icon svg{ width:18px; height:18px; display:block; }

/* Delete toolbar */
.delete-toolbar{
  display:flex;
  flex-wrap:wrap;
  gap:.6rem;
  align-items:center;
  margin:.75rem 0 1rem;
  padding:.5rem .75rem;
  border-radius:12px;
  background:linear-gradient(180deg, rgba(16,18,27,.65), rgba(16,18,27,.35));
  border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(8px);
}

.delete-toolbar .btn{
  display:inline-flex;
  align-items:center;
  gap:.5rem;
  font-weight:900;
  border-radius:999px;
  padding:.55rem .9rem;
  border:1px solid transparent;
  cursor:pointer;
  user-select:none;
  transition:transform .12s ease, box-shadow .15s ease, background .2s ease, color .2s ease, border-color .2s ease;
}

.btn .btn-ico{
  width:22px; height:22px;
  display:grid; place-items:center;
  border-radius:50%;
  background:rgba(255,255,255,.14);
  font-size:.9rem; line-height:1;
}

.btn-delete-mode{
  color:#ff6b7a;
  background:rgba(255, 107, 122, .10);
  border-color:rgba(255, 107, 122, .35);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.btn-delete-mode:hover{ background:rgba(255, 107, 122, .18); transform:translateY(-1px); }

.btn-delete-mode.active{
  color:#fff;
  background:linear-gradient(135deg, #ff4d5e, #ff7a5f);
  border-color:transparent;
  box-shadow:0 8px 20px rgba(255, 77, 94, .35);
}

.btn-delete-selected{
  color:#fff;
  background:linear-gradient(135deg, #d62d4e, #ff6a6a);
  box-shadow:0 8px 22px rgba(214,45,78,.35);
}
.btn-delete-selected:hover{
  transform:translateY(-1px);
  box-shadow:0 10px 26px rgba(214,45,78,.45);
}

.btn[disabled],
.btn:disabled{
  opacity:.45;
  cursor:not-allowed;
  transform:none;
  box-shadow:none;
}

.count-badge{
  margin-left:.35rem;
  padding:.1rem .5rem;
  font-size:.8rem;
  border-radius:999px;
  background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.22);
}

/* Small screens: stack delete toolbar buttons */
@media (max-width: 480px){
  .delete-toolbar{ padding:.5rem; }
  .delete-toolbar .btn{ flex:1 1 auto; justify-content:center; }
}


/* ==========================================================================
   5) MediaManager (admin pages)
   ========================================================================== */

.media-manager{ color:#e5e7eb; }

.media-manager .folder-card{
  background: linear-gradient(135deg,#1b2236,#2a2f45);
  border-radius:16px;
  box-shadow:0 10px 24px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.08);
  overflow:hidden;
}

.media-manager .folder-content h3{
  color:#fff;
  font-weight:900;
  margin:.4rem 0 .25rem;
  text-shadow:0 1px 2px rgba(0,0,0,.45);
}

.media-manager .folder-actions button{
  padding:.45rem .75rem;
  border-radius:10px;
  border:0;
  font-weight:900;
  cursor:pointer;
  box-shadow:0 1px 3px rgba(0,0,0,.25);
}
.media-manager .btn-rename{ background:#0ea5e9; color:#fff; }
.media-manager .btn-delete{ background:#dc2626; color:#fff; }
.media-manager .btn-upload{ background:#2563eb; color:#fff; }

/* Keep upload modal readable */
.media-manager .upload-window{
  background: #0f1422;
  color: #fff;
}

/* Force readable text on dark thumbnails and badges */
.album-count,
.media-card,
.media-card *{
  color:#fff !important;
}

.media-card a{ color:#fff !important; text-decoration:none; }
.media-card a:hover{ text-decoration:underline; }

label.dropdown-label { color:#fff !important; }


/* ==========================================================================
   6) Upload modal (progress list)
   ========================================================================== */

.upload-backdrop{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2vh 2vw;
  height: 100dvh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.upload-window{
  width: min(720px, 92vw);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  background: #0f1422;
  color: #fff;
  border: 1px solid rgba(255,255,255,.08);
}

.upload-header{
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: 12px 16px;
  background: inherit;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.upload-list{
  list-style: none;
  margin: 0;
  padding: 10px 12px 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.upload-item{
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.upload-icon{
  font-size: .75rem;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
  color:#fff;
}

.upload-info .upload-name{
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-info .upload-size{
  opacity: .8;
  font-size: .85rem;
  margin-top: 2px;
}

.upload-progress-bar{
  margin-top: 6px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  overflow: hidden;
}
.upload-progress{
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4ade80, #22c55e);
}

.upload-status{
  font-size: .9rem;
  white-space: nowrap;
  opacity: .9;
}
.upload-status.completed{ color: #4ade80; }

.upload-footer{
  position: sticky;
  bottom: 0;
  background: inherit;
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 10px 12px;
  text-align: center;
}

.btn-close-upl{
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: #fff;
  cursor: pointer;
}
.btn-close-upl:active{ transform: translateY(1px); }

/* Example icon color classes */
.icon-video{ background:#1f2937; }
.icon-image{ background:#334155; }
.icon-pdf  { background:#7f1d1d; }
.icon-html { background:#3b0764; }
.icon-ai   { background:#052e16; }
.icon-psd  { background:#0b1a33; }


/* ==========================================================================
   7) Responsive tables (Bootstrap-friendly)
   ========================================================================== */

/* Standard table styling that works on dark background */
.table{
  width: 100%;
  border-collapse: collapse;
  color: #e8ecf6;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  overflow: hidden;
}

.table th, .table td{
  padding: .6rem .75rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  vertical-align: middle;
}

.table thead th{
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(10,14,28,.9);
  border-bottom: 1px solid rgba(255,255,255,.10);
  font-weight: 900;
  text-transform: none;
}

.table tbody tr:hover{
  background: rgba(255,255,255,.04);
}

/* Horizontal scroll wrapper for phones/tablets */
.table-wrap,
.table-responsive{
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Optional: “card table” on very small screens
   Usage pattern:
   - add class="table table-card" to your table
   - set data-label attributes per td in markup (or generate in Razor)
*/
@media (max-width: 520px){
  .table.table-card thead{ display:none; }
  .table.table-card, .table.table-card tbody, .table.table-card tr, .table.table-card td{
    display:block;
    width:100%;
  }
  .table.table-card tr{
    border-bottom: 1px solid rgba(255,255,255,.08);
    padding: .4rem .2rem;
  }
  .table.table-card td{
    display:flex;
    justify-content: space-between;
    gap: .75rem;
    padding: .45rem .75rem;
    border-bottom: 0;
  }
  .table.table-card td::before{
    content: attr(data-label);
    color: rgba(234,240,255,.65);
    font-weight: 900;
    flex: 0 0 auto;
  }
}


/* ==========================================================================
   8) Lightbox (single, consistent definition)
   ========================================================================== */

:root{
  --lb-accent: rgba(255,255,255,.16);
  --lb-accent-ring: rgba(255,255,255,.45);
}

/* overlay */
.lb{
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  isolation: isolate;
  background: rgba(0,0,0,.92);
}
body.lb-open{ overflow: hidden; }

.lb, .lb-stage{ will-change: transform; transform: translateZ(0); }
.lb-stage{ position: relative; z-index: 2; }

/* media */
.lb video, .lb img{
  position: relative;
  z-index: 3;
  display:block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  visibility: visible !important;
}

/* controls */
.lb-prev, .lb-next{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  width:72px;
  height:72px;
  border-radius:50%;
  border: 3px solid #fff;
  background: rgba(0,0,0,.35);
  display:grid;
  place-items:center;
  z-index: 6;
  cursor:pointer;
}

.lb-prev{ left:12px; }
.lb-next{ right:12px; }

.lb-prev::before, .lb-next::before{
  font-size:42px;
  line-height:1;
  color:#fff;
  content:"\276E";
}
.lb-next::before{ content:"\276F"; }

.lb-prev:hover, .lb-next:hover{
  filter: brightness(1.12);
  background: rgba(0,0,0,.5);
}

.lb-prev:focus-visible, .lb-next:focus-visible{
  outline:none;
  box-shadow: 0 0 0 3px var(--lb-accent-ring);
}

.lb-prev[disabled], .lb-next[disabled]{ opacity:.35; cursor:default; }

.lb-close{
  position:absolute;
  top:10px;
  right:10px;
  width:36px;
  height:36px;
  border:none;
  border-radius:50%;
  background:rgba(0,0,0,.5);
  color:#fff;
  font-size:22px;
  cursor:pointer;
  z-index: 7;
}

.lb-counter{
  position:absolute;
  bottom:10px;
  left:50%;
  transform:translateX(-50%);
  color:#fff;
  font-size:.95rem;
  opacity:.85;
  z-index: 7;
}

/* Hide background videos only (not the opened lightbox media) */
body.lb-open .media-grid video,
body.lb-open .fm-grid video,
body.lb-open .file-list video,
body.lb-open .thumb video{
  visibility: hidden !important;
  pointer-events: none;
}

/* Mobile lightbox */
@media (max-width: 640px){
  .lb-prev, .lb-next{ width:60px; height:60px; }
  .lb-prev::before, .lb-next::before{ font-size:36px; }
  .lb-counter{ bottom:6px; font-size:.85rem; }
  .lb-close{ top:8px; right:8px; width:34px; height:34px; font-size:20px; }
}

/* Slideshow close button (if you use it) */
.slideshow-container { position: relative; }
.sl-close{
  position:absolute;
  top:12px;
  right:12px;
  z-index:10;
  width:40px;
  height:40px;
  line-height:36px;
  text-align:center;
  font-size:28px;
  font-weight:900;
  border:0;
  border-radius:50%;
  background:rgba(0,0,0,.45);
  color:#fff;
  cursor:pointer;
}
.sl-close:hover { background:rgba(0,0,0,.65); }


/* ==========================================================================
   9) Folder title button (used in folder pages)
   ========================================================================== */

.fm-title-btn{
  display:inline-flex;
  width:auto;
  min-height: 34px;
  padding:.4rem .7rem;
  border-radius: 12px;
  gap:.5rem;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color:#fff;
  cursor:pointer;
  user-select:none;
  transition: transform .12s ease, filter .18s ease, background .2s ease;
}
.fm-title-btn:hover{ filter: brightness(1.06); }
.fm-title-btn:active{ transform: translateY(1px); }

.fm-title-text{
  flex:1;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.fm-title-chevron{
  width:18px; height:18px;
  flex:0 0 auto;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  opacity:.85;
  transition: transform .2s, opacity .2s;
}
.fm-title-btn:hover .fm-title-chevron{
  transform: translateX(2px);
  opacity:1;
}


/* ==========================================================================
   Special wide videos card (Home)
   ========================================================================== */

.memories-root .videos-panel{
  margin-top: 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;

  padding: 14px 14px;
  border-radius: 18px;

  background:
    radial-gradient(900px 220px at 10% 10%, rgba(120,90,255,.18), transparent 55%),
    linear-gradient(135deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 16px 44px rgba(0,0,0,.35);
  backdrop-filter: blur(14px);

  cursor:pointer;
}

.memories-root .videos-panel:hover{
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.memories-root .videos-panel .vp-left{
  display:flex;
  align-items:center;
  gap: 12px;
}

.memories-root .videos-panel .vp-ico{
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display:grid;
  place-items:center;

  background: rgba(0,0,0,.30);
  border: 1px solid rgba(255,255,255,.12);
  color: #fff;
}

.memories-root .videos-panel .vp-title{
  font-weight: 1000;
  color: #fff;
  line-height: 1.1;
}

.memories-root .videos-panel .vp-sub{
  margin-top: 2px;
  color: rgba(234,240,255,.70);
  font-size: .92rem;
}

.memories-root .videos-panel .vp-btn{
  display:inline-flex;
  align-items:center;
  gap: .5rem;

  padding: 10px 14px;
  border-radius: 999px;

  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  font-weight: 1000;

  cursor:pointer;
}

.memories-root .videos-panel .vp-btn:hover{
  background: rgba(255,255,255,.12);
}


/* More space between Videos panel (top) and album grid */
.memories-root .videos-panel{
  margin-bottom: 18px !important;
}
/* Safety: do not add extra top margin from the grid */
.memories-root .album-grid{
  margin-top: 0 !important;
}

.media-card { position: relative; }
.select-chk { position: absolute; top: 10px; left: 10px; z-index: 2; width: 20px; height: 20px; }
.media-card.is-selected { outline: 3px solid #0d6efd; outline-offset: 2px; }


/* Ensure left sidebar fills the whole viewport */
/* .sidebar {
  min-height: 100vh;   /* fallback */
  /* min-height: 100dvh;  /* modern mobile viewport */
/* } */ 



/* ========================================================================== 
   10) Stella 2026 visual system — light editorial overrides
   Keeps legacy component class names while aligning the rest of the site
   with the Home/Login redesign.
   ========================================================================== */

:root {
  --st-bg: #f6f5ef;
  --st-surface: #fffef9;
  --st-surface-soft: #edf1e8;
  --st-ink: #25352e;
  --st-muted: #778079;
  --st-accent: #315a4b;
  --st-accent-dark: #24483b;
  --st-line: #e0e4dc;
  --st-danger: #a64f46;
  --st-shadow-sm: 0 8px 24px rgba(42, 59, 50, .07);
  --st-shadow: 0 20px 60px rgba(42, 59, 50, .10);
}

body {
  background:
    radial-gradient(circle at 88% -10%, rgba(194, 211, 183, .20), transparent 30rem),
    var(--st-bg);
  color: var(--st-ink);
}

button, input, select, textarea { font: inherit; }

::selection {
  background: rgba(49, 90, 75, .18);
  color: var(--st-ink);
}

/* Detail / folder page header */
.fd-header {
  gap: .8rem;
  margin: .75rem 0 1.35rem;
}

.btn-back {
  min-height: 40px;
  padding: .55rem .9rem;
  border: 1px solid var(--st-line);
  border-radius: 999px;
  background: rgba(255,255,255,.68);
  color: var(--st-accent);
  box-shadow: var(--st-shadow-sm);
  font-weight: 700;
}

.btn-back:hover {
  background: #fff;
  transform: translateY(-1px);
}

.fd-title {
  color: var(--st-ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.5rem, 2vw, 2rem);
  font-weight: 400;
  letter-spacing: -.025em;
}

/* Album/media cards outside Home */
.media-grid {
  gap: 1rem;
}

.media-card {
  border: 1px solid var(--st-line);
  border-radius: 14px;
  background: var(--st-surface);
  box-shadow: var(--st-shadow-sm);
}

.media-card img,
.media-card video {
  background: #e8ebe4;
}

.badge-play {
  border: 1px solid rgba(255,255,255,.72);
  background: rgba(31, 48, 39, .72);
}

/* Shared pill/button treatment */
.pill-btn {
  border: 1px solid var(--st-line);
  background: rgba(255,255,255,.72);
  color: var(--st-ink);
  box-shadow: 0 5px 18px rgba(42,59,50,.05);
}

.pill-btn:hover { background: #fff; }

.delete-toolbar {
  border: 1px solid var(--st-line);
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  box-shadow: var(--st-shadow-sm);
}

.btn-delete-mode {
  color: var(--st-danger);
  background: #fbefed;
  border-color: #e8c6c1;
}

.btn-delete-mode:hover { background: #f7e3df; }

.btn-delete-mode.active,
.btn-delete-selected {
  background: #a64f46;
  border-color: #a64f46;
  color: #fff;
  box-shadow: 0 8px 22px rgba(166,79,70,.20);
}

/* Admin / MediaManager */
.media-manager { color: var(--st-ink); }

.media-manager .folder-card {
  border: 1px solid var(--st-line);
  border-radius: 15px;
  background: var(--st-surface);
  box-shadow: var(--st-shadow-sm);
}

.media-manager .folder-content h3 {
  color: var(--st-ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  text-shadow: none;
}

.media-manager .folder-actions button {
  border-radius: 9px;
  box-shadow: none;
  font-weight: 700;
}

.media-manager .btn-rename { background: #e8eee7; color: var(--st-accent); }
.media-manager .btn-upload { background: var(--st-accent); color: #fff; }
.media-manager .btn-delete { background: #f5e4e1; color: var(--st-danger); }

/* Upload dialog */
.upload-backdrop { background: rgba(24, 37, 30, .48); }

.upload-window,
.media-manager .upload-window {
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 18px;
  background: #fbfaf6;
  color: var(--st-ink);
  box-shadow: 0 30px 80px rgba(24, 37, 30, .24);
}

.upload-header,
.upload-footer {
  border-color: var(--st-line);
  background: #fbfaf6;
}

.upload-item { border-color: var(--st-line); }

.upload-icon {
  border: 1px solid var(--st-line);
  background: #edf0ea;
  color: var(--st-ink);
}

.upload-progress-bar { background: #e3e7df; }
.upload-progress { background: var(--st-accent); }
.upload-status.completed { color: #4e765e; }

.btn-close-upl {
  border: 1px solid var(--st-line);
  background: #fff;
  color: var(--st-ink);
}

/* Tables */
.table {
  border: 1px solid var(--st-line);
  border-radius: 14px;
  background: rgba(255,255,255,.68);
  color: var(--st-ink);
  box-shadow: var(--st-shadow-sm);
}

.table th,
.table td { border-color: var(--st-line); }

.table thead th {
  background: #edf1e8;
  color: var(--st-ink);
  font-weight: 700;
}

.table tbody tr:hover { background: rgba(49,90,75,.04); }

/* Folder title / navigation button */
.fm-title-btn {
  border: 1px solid var(--st-line);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: var(--st-accent);
  box-shadow: var(--st-shadow-sm);
}

.fm-title-btn:hover { background: #fff; }

/* Account management */
.account-shell {
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 40px);
  margin: 0 auto;
  padding: clamp(42px, 6vw, 76px) 0 48px;
  color: var(--st-ink);
}

.account-header {
  max-width: 650px;
  margin-bottom: 34px;
}

.account-eyebrow {
  margin: 0 0 10px;
  color: var(--st-accent);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.account-header h1 {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(36px, 4vw, 52px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -.045em;
}

.account-header > p:last-child {
  margin: 14px 0 0;
  color: var(--st-muted);
  font-size: 13px;
  line-height: 1.75;
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.account-nav-panel,
.account-content-panel {
  border: 1px solid var(--st-line);
  border-radius: 18px;
  background: rgba(255,255,255,.70);
  box-shadow: var(--st-shadow-sm);
}

.account-nav-panel { padding: 14px; }
.account-content-panel { padding: clamp(22px, 4vw, 38px); }

.account-nav-label {
  margin: 7px 9px 11px;
  color: var(--st-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.account-nav { display: grid; gap: 5px; }

.account-nav-link {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 11px 12px;
  border-radius: 12px;
  color: #52645a;
  text-decoration: none;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.account-nav-link:hover {
  background: #f0f3ed;
  color: var(--st-accent);
  text-decoration: none;
}

.account-nav-link.active {
  background: #e8eee7;
  color: var(--st-accent);
}

.account-nav-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #dce3d8;
  border-radius: 50%;
  background: rgba(255,255,255,.62);
  font-size: 16px;
}

.account-nav-link > span:nth-child(2) {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.account-nav-link strong { font-size: 12px; font-weight: 700; }
.account-nav-link small { margin-top: 2px; color: var(--st-muted); font-size: 9px; }
.account-nav-chevron { font-size: 11px; color: #9aa49e; }

.account-content-panel h1,
.account-content-panel h2,
.account-content-panel h3 {
  color: var(--st-ink);
}

.account-content-panel h2,
.account-content-panel h3 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  letter-spacing: -.025em;
}

.account-content-panel .form-control,
.account-content-panel .form-select {
  border-color: var(--st-line);
  border-radius: 10px;
  background: #fffefb;
  color: var(--st-ink);
}

.account-content-panel .form-control:focus,
.account-content-panel .form-select:focus {
  border-color: rgba(49,90,75,.55);
  box-shadow: 0 0 0 3px rgba(49,90,75,.10);
}

.account-content-panel .btn-primary {
  border-color: var(--st-accent);
  background: var(--st-accent);
}

.account-content-panel .btn-primary:hover {
  border-color: var(--st-accent-dark);
  background: var(--st-accent-dark);
}

@media (max-width: 800px) {
  .account-shell {
    width: min(100% - 28px, 1120px);
    padding-top: 32px;
  }

  .account-layout { grid-template-columns: 1fr; }
  .account-nav-panel { padding: 9px; }
  .account-nav { display: block; }
  .account-nav-label { display: none; }
  .account-nav-link { padding: 9px 10px; }
}

@media (max-width: 520px) {
  .account-shell { width: calc(100% - 20px); }
  .account-header { margin-bottom: 24px; }
  .account-content-panel { padding: 20px 16px; }
}


/* Full-bleed feature pages inside the existing MainLayout content article. */
@supports selector(:has(*)) {
  article.content:has(.journal-page),
  article.content:has(.login-page) {
    padding: 0 !important;
  }
}

/* ========================================================================== 
   11) Shell-aware legacy page alignment
   The new MainLayout is full-bleed; these older page roots receive their own
   consistent content width and the old dark Memories theme is neutralized.
   ========================================================================== */

article.stella-content > .media-manager {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(30px, 5vw, 58px) 0 44px;
}

.memories-root {
  --fm-bg0: var(--st-bg);
  --fm-bg1: var(--st-bg);
  --fm-card: rgba(255,255,255,.72);
  --fm-stroke: var(--st-line);
  --fm-stroke-2: #ccd6ca;
  --fm-pill: #edf1e8;
  --fm-text: var(--st-ink);
  --fm-muted: var(--st-muted);
  --fm-glow-a: rgba(194,211,183,.20);
  --fm-glow-b: transparent;
  --fm-glow-c: transparent;
  color: var(--st-ink);
  background:
    radial-gradient(circle at 92% 2%, rgba(194,211,183,.20), transparent 28rem),
    var(--st-bg);
}

.memories-root .fm-container {
  max-width: 1220px;
  padding: clamp(30px, 5vw, 58px) clamp(18px, 4vw, 44px) 44px;
}

.memories-root .fm-header h1 {
  color: var(--st-ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  letter-spacing: -.035em;
}

.memories-root .fm-header p { color: var(--st-muted); }

.memories-root .fm-age-tabs {
  gap: .4rem;
  padding: .55rem 0;
  border: 0;
  border-top: 1px solid var(--st-line);
  border-bottom: 1px solid var(--st-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.memories-root .fm-age-tabs .age-tab {
  padding: .5rem .85rem;
  border: 1px solid transparent;
  background: transparent;
  color: #68746d;
  box-shadow: none;
  font-size: .78rem;
  font-weight: 650;
}

.memories-root .fm-age-tabs .age-tab:hover {
  background: #e9ede6;
  color: var(--st-accent);
}

.memories-root .fm-age-tabs .age-tab.active {
  border-color: var(--st-accent);
  background: var(--st-accent);
  color: #fff;
  box-shadow: 0 8px 22px rgba(49,90,75,.15);
}

.memories-root .album-card {
  border-color: var(--st-line);
  background: rgba(255,255,255,.72);
  box-shadow: var(--st-shadow-sm);
  backdrop-filter: none;
}

.memories-root .album-card::before { display: none; }

.memories-root .album-card:hover {
  border-color: #ccd5ca;
  box-shadow: 0 18px 42px rgba(42,59,50,.11);
}

.memories-root .videos-panel {
  border-color: #d8e0d3;
  background: #eaf0e5;
  color: var(--st-accent);
  box-shadow: var(--st-shadow-sm);
  backdrop-filter: none;
}

.memories-root .videos-panel .vp-ico {
  border-color: #c7d3c1;
  background: rgba(255,255,255,.55);
  color: var(--st-accent);
}

.memories-root .videos-panel .vp-title { color: var(--st-accent); }
.memories-root .videos-panel .vp-sub { color: var(--st-muted); }
.memories-root .videos-panel .vp-btn {
  border-color: #ccd7c7;
  background: rgba(255,255,255,.65);
  color: var(--st-accent);
}

@media (max-width: 640.98px) {
  article.stella-content > .media-manager {
    width: calc(100% - 24px);
    padding-top: 24px;
  }

  .memories-root .fm-container {
    padding-top: 24px;
  }

  .memories-root .fm-age-tabs {
    top: var(--st-mobile-nav-h, 60px);
    background: rgba(246,245,239,.94);
    backdrop-filter: blur(14px);
  }
}

/* ==========================================================================\n   14) Stella shell visibility fallback (global, not CSS-isolated)\n   Critical layout colors are duplicated here intentionally. MainLayout and\n   NavMenu use CSS isolation, but these global rules guarantee that the shell\n   remains visible after publish/cache/bundle changes.\n   ========================================================================== */

:root {
    --st-shell-sidebar: #173b32;
    --st-shell-sidebar-2: #102d27;
    --st-shell-header: #31594b;
    --st-shell-header-border: #24483c;
    --st-shell-cream: #f6f3ea;
    --st-shell-paper: #fffdf8;
}

/* Desktop shell */
.stella-shell {
    background: var(--st-shell-cream) !important;
}

.stella-sidebar {
    background: linear-gradient(180deg,
        var(--st-shell-sidebar) 0%,
        var(--st-shell-sidebar-2) 100%) !important;
    border-right: 1px solid #0c2821 !important;
    box-shadow: 8px 0 28px rgba(12, 40, 33, .18) !important;
    color: #fff !important;
}

.stella-workspace {
    background: var(--st-shell-cream) !important;
}

.stella-pagebar {
    background: var(--st-shell-header) !important;
    border-bottom: 1px solid var(--st-shell-header-border) !important;
    color: #fff !important;
    box-shadow: 0 5px 18px rgba(20, 48, 39, .18) !important;
}

.stella-pagebar .page-title,
.stella-pagebar-title,
.stella-pagebar-note {
    color: #fff !important;
}

.stella-pagebar-note {
    opacity: .72;
}

.stella-pagebar-dot {
    background: #f1cf8f !important;
    box-shadow: 0 0 0 5px rgba(241, 207, 143, .14) !important;
}

/* NavMenu is a child component, so make the visual contract global too. */
.stella-sidebar .nav-shell,
.stella-sidebar .nav-brandbar,
.stella-sidebar .nav-scrollable {
    color: #fff !important;
}

.stella-sidebar .stella-brand,
.stella-sidebar .stella-brand strong {
    color: #fff !important;
}

.stella-sidebar .stella-brand-copy small,
.stella-sidebar .nav-section-label,
.stella-sidebar .nav-copy small {
    color: rgba(255,255,255,.64) !important;
}

.stella-sidebar .nav-item .nav-link,
.stella-sidebar .nav-logout {
    color: rgba(255,255,255,.88) !important;
}

.stella-sidebar .nav-item .nav-link:hover,
.stella-sidebar .nav-logout:hover {
    background: rgba(255,255,255,.10) !important;
    color: #fff !important;
}

.stella-sidebar .nav-item .nav-link.active {
    background: #f3ede0 !important;
    border-color: #f3ede0 !important;
    color: #173b32 !important;
    box-shadow: 0 8px 22px rgba(3, 24, 19, .28) !important;
}

.stella-sidebar .nav-item .nav-link.active .nav-copy strong,
.stella-sidebar .nav-item .nav-link.active .nav-copy small,
.stella-sidebar .nav-item .nav-link.active .nav-icon,
.stella-sidebar .nav-item .nav-link.active .nav-avatar,
.stella-sidebar .nav-item .nav-link.active .nav-year {
    color: #173b32 !important;
}

.stella-sidebar .nav-icon,
.stella-sidebar .nav-avatar,
.stella-sidebar .nav-year,
.stella-sidebar .stella-brand-mark,
.stella-sidebar .nav-toggle {
    background: rgba(255,255,255,.10) !important;
    border-color: rgba(255,255,255,.18) !important;
    color: #fff !important;
}

/* Mobile: the sidebar becomes the top navigation header. */
@media (max-width: 640.98px) {
    .stella-sidebar {
        background: var(--st-shell-sidebar) !important;
        border-bottom: 1px solid #0c2821 !important;
    }

    .stella-sidebar .nav-shell,
    .stella-sidebar .nav-brandbar {
        background: var(--st-shell-sidebar) !important;
    }

    .stella-sidebar .nav-scrollable {
        background: #102f27 !important;
        border-top: 1px solid rgba(255,255,255,.10) !important;
        box-shadow: 0 20px 40px rgba(6, 31, 24, .34) !important;
    }
}


/* ===== STELLA V5 HARD SHELL CONTRAST =====
   Compatibility fallback for BOTH the original MainLayout classes and the
   redesigned classes. These rules intentionally use !important so the shell
   cannot inherit the cream page background. */
.sidebar,
.stella-sidebar {
    background-color: #173b32 !important;
    background-image: linear-gradient(180deg, #173b32 0%, #102d27 100%) !important;
    color: #ffffff !important;
    border-right-color: #0a2820 !important;
}

.top-row,
.stella-pagebar {
    background-color: #31594b !important;
    background-image: none !important;
    color: #ffffff !important;
    border-bottom-color: #24483c !important;
}

.top-row .page-title,
.stella-pagebar .page-title,
.top-row a,
.top-row .btn-link,
.stella-pagebar-title,
.stella-pagebar-note {
    color: #ffffff !important;
}

.sidebar .nav-shell,
.sidebar .nav-brandbar,
.sidebar .nav-scrollable,
.stella-sidebar .nav-shell,
.stella-sidebar .nav-brandbar,
.stella-sidebar .nav-scrollable {
    color: #ffffff !important;
}

.sidebar .nav-item .nav-link,
.sidebar .nav-logout,
.stella-sidebar .nav-item .nav-link,
.stella-sidebar .nav-logout {
    color: rgba(255,255,255,.90) !important;
}

.sidebar .nav-item .nav-link.active,
.stella-sidebar .nav-item .nav-link.active {
    background: #f5efe2 !important;
    color: #173b32 !important;
}

@media (max-width: 640.98px) {
    .sidebar,
    .stella-sidebar,
    .sidebar .nav-shell,
    .sidebar .nav-brandbar,
    .stella-sidebar .nav-shell,
    .stella-sidebar .nav-brandbar {
        background-color: #173b32 !important;
        background-image: none !important;
    }

    .sidebar .nav-scrollable,
    .stella-sidebar .nav-scrollable {
        background-color: #102f27 !important;
        background-image: none !important;
    }
}
