/* ==========================================================================
   Albums — Media app additions on top of the approved design
   (real-data states: loading, empty, errors, dialogs, menus, forms)
   ========================================================================== */
[hidden] { display: none !important; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
img.ph { object-fit: cover; width: 100%; height: 100%; color: transparent; }
.tile img.ph, .first-strip img.ph, .album-card img.ph { position: absolute; inset: 0; }
.ph { background-color: var(--fill-2); }

/* Skeleton shimmer */
@keyframes skel { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.skel { background: linear-gradient(90deg, var(--fill-3) 0%, var(--fill-2) 40%, var(--fill-3) 80%) 0 0 / 200% 100%; animation: skel 1.4s linear infinite; border-radius: 8px; }
.skel-card .cover { aspect-ratio: 1; border-radius: 12px; }
.skel-line { height: 12px; margin-top: 10px; width: 70%; }
.skel-line.s { width: 40%; height: 10px; margin-top: 6px; }

/* Empty / error states */
.empty { text-align: center; padding: 70px 20px; max-width: 420px; margin: 0 auto; }
.empty .art { width: 120px; height: 96px; margin: 0 auto 22px; position: relative; }
.empty .art div { position: absolute; width: 74px; height: 58px; border-radius: 10px; box-shadow: var(--shadow-md), 0 0 0 3px var(--bg); }
.empty .art div:nth-child(1) { left: 6px; top: 18px; transform: rotate(-10deg); background: linear-gradient(135deg, #ffd6a5, #ff9f7a); }
.empty .art div:nth-child(2) { right: 6px; top: 18px; transform: rotate(9deg); background: linear-gradient(135deg, #a0e7ff, #5ac8fa); }
.empty .art div:nth-child(3) { left: 23px; top: 4px; background: linear-gradient(135deg, #c7b8ff, #5e5ce6); }
.empty h3 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.empty p { margin: 6px 0 20px; color: var(--label-2); font-size: 13px; line-height: 1.5; }
.error-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; margin-bottom: 18px; background: color-mix(in srgb, var(--red) 10%, transparent); color: var(--red); font-size: 12px; font-weight: 500; }
.error-banner .grow { flex: 1; }

/* Sidebar */
.demo-note { margin: 6px 4px 4px; padding: 10px; border-radius: 10px; font-size: 11px; color: var(--label-2); background: color-mix(in srgb, var(--orange) 12%, transparent); line-height: 1.4; }
.demo-note b { display: block; color: var(--orange); font-size: 11px; margin-bottom: 1px; }
#recent .side-item { min-width: 0; }
#recent .side-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#recent .thumb { object-fit: cover; }
.side-item .badge.hot { min-width: 18px; text-align: center; }

/* Album cards */
.album-card .cover .ph-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--label-3); font-size: 34px; background: linear-gradient(135deg, var(--fill-2), var(--fill-3)); }
.album-card .cover .up-ring { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.up-ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.up-ring circle { fill: none; stroke-width: 6; }
.up-ring .t { stroke: rgba(255,255,255,.25); }
.up-ring .b { stroke: #fff; stroke-linecap: round; stroke-dasharray: 163.4; transition: stroke-dashoffset .4s linear; }
.up-ring .lbl { position: absolute; color: #fff; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.pill-blue .dot { animation: m-pulse-ring 1.6s ease-out infinite; }
.album-card h5 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Album status card variants */
.status-card .avatar.wait { background: linear-gradient(145deg, #ff9f0a, #ff6b3d); }
.status-card .avatar.idle { background: linear-gradient(145deg, #8e8e93, #636366); }
.status-card .avatar.up { background: linear-gradient(145deg, #5ac8fa, #007aff); }
.status-card .avatar.done { background: linear-gradient(145deg, #5e5ce6, #bf5af2); }
.status-card .avatar .i { font-size: 19px; }
.status-card .acts { display: flex; gap: 8px; margin-left: 8px; }
.status-card .changed { color: var(--orange); font-weight: 600; }
.status-card .mini-bar { height: 5px; border-radius: 3px; background: var(--fill); margin-top: 8px; overflow: hidden; max-width: 320px; }
.status-card .mini-bar i { display: block; height: 100%; background: var(--blue); border-radius: 3px; transition: width .4s; }
.first-empty { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 12px; border: 1.5px dashed var(--separator-strong); color: var(--label-2); font-size: 13px; }
.first-empty .i { font-size: 20px; color: var(--label-3); }
.photo-grid .tile { content-visibility: auto; contain-intrinsic-size: 140px; }
.grid-empty { grid-column: 1 / -1; padding: 50px 0; text-align: center; color: var(--label-2); }

/* Details step */
.date-field { height: 46px; width: 100%; font-size: 14px; padding: 0 12px; border-radius: 10px; }
.date-field::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; }
.pick-grid.scrollable { max-height: 228px; overflow-y: auto; padding-right: 2px; }
.pick-grid.scrollable::after { display: none; }
.pick-grid .tile { background: var(--fill-3); }
.pick-grid .tile img.ph { position: absolute; inset: 0; opacity: 0; transition: opacity .3s, transform .35s var(--spring); }
.pick-grid .tile img.ph.ready { opacity: 1; }
.pick-grid .tile.x img.ph { opacity: .25; transform: scale(.86); }
.field.invalid { box-shadow: 0 0 0 .5px var(--red), 0 0 0 3.5px color-mix(in srgb, var(--red) 25%, transparent); }

/* Upload */
.live-grid .tile { background: var(--fill-3); }
.live-grid .tile.pending { background: linear-gradient(90deg, var(--fill-3) 0%, var(--fill-2) 40%, var(--fill-3) 80%) 0 0 / 200% 100%; animation: skel 1.6s linear infinite; }
.live-grid .tile img.ph { position: absolute; inset: 0; animation: m-pop .45s var(--spring) both; }
.up-errors { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--red) 9%, transparent); font-size: 12px; color: var(--label); }
.up-errors b { color: var(--red); display: flex; align-items: center; gap: 6px; }
.up-errors ul { margin: 6px 0 10px; padding-left: 18px; color: var(--label-2); max-height: 72px; overflow: auto; }
.up-errors .acts { display: flex; gap: 8px; }
.ring.paused .bar { stroke: var(--orange); }

/* Build */
.inline-field { width: 100%; margin-top: 4px; height: 30px; font-size: 13px; }
.row .txt .path b { color: var(--label); font-weight: 600; }
.missing { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--orange) 11%, transparent); font-size: 12px; }
.missing b { color: var(--orange); display: flex; gap: 6px; align-items: center; }
.missing ul { margin: 6px 0 0; padding-left: 18px; color: var(--label-2); max-height: 80px; overflow: auto; font-family: var(--mono); font-size: 11px; }
.done-warn { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--orange) 11%, transparent); font-size: 12px; text-align: center; color: var(--label-2); }
.done-folder img.ph { position: absolute; width: 74px; height: 56px; border-radius: 5px; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.2); }
.done-folder img.ph.a { left: 12px; top: 2px; transform: rotate(-9deg); }
.done-folder img.ph.b { right: 12px; top: 0; transform: rotate(8deg); }
.done-folder img.ph.c { left: 30px; top: -8px; transform: rotate(-1deg); }
.bp-now img.ph { width: 56px; height: 56px; border-radius: 8px; flex: none; }

/* Share */
.wa-preview img.ph { width: 64px; height: 64px; flex: none; }
.wa-preview div span { display: block; }
a.share-btn { text-decoration: none; color: inherit; cursor: default; }
a.share-btn.wa { color: #fff; }

/* Settings */
.textarea { width: 100%; height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; border-radius: 10px; font-size: 13px; }
#sheet-settings .segmented button { height: 26px; }

/* Viewer (real image + zoom) */
.v-stage { position: relative; }
.v-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; cursor: zoom-in; opacity: 0; transition: opacity .25s; }
.v-img.ready { opacity: 1; }
.v-stage.zoomed .v-img { cursor: grab; }
.v-stage.zoomed .v-img:active { cursor: grabbing; }
.v-loading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; transition: opacity .2s; }
.v-loading.off { opacity: 0; }
.minimap img.ph { position: absolute; inset: 0; opacity: .6; }
.v-chip + .v-chip { margin-left: 6px; }
.v-chip.local { background: rgba(48,209,88,.18); color: #4ade80; }

/* Lock */
.lock-err { min-height: 18px; margin-top: 10px; font-size: 12px; color: #ffb4ae; font-weight: 500; }
.remember input { display: none; }
.lock-card .go[disabled] { opacity: .6; }

/* Dialogs */
.dialog-wrap { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(0,0,0,.28); animation: m-fade .2s ease; padding: 20px; }
.dialog { width: 340px; max-width: 100%; padding: 22px 22px 18px; border-radius: 18px; background: var(--bg-elevated); box-shadow: var(--shadow-sheet); text-align: center; animation: m-pop .35s var(--spring); }
.dialog .d-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 26px; }
.dialog .d-icon:empty { display: none; }
.dialog h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.dialog p { margin: 6px 0 0; color: var(--label-2); font-size: 13px; line-height: 1.45; }
.dialog .field { width: 100%; margin-top: 14px; height: 34px; }
.d-actions { display: flex; gap: 8px; margin-top: 18px; }
.d-actions .btn { flex: 1; }
.btn-primary.danger { background: var(--red); box-shadow: none; }
.qr-dialog canvas { display: block; margin: 16px auto 6px; border-radius: 12px; background: #fff; padding: 10px; width: 240px !important; height: 240px !important; }
.qr-dialog p { word-break: break-all; font-family: var(--mono); font-size: 12px; }

/* Context menu */
.menu { position: fixed; z-index: 150; min-width: 220px; padding: 5px; border-radius: 12px; background: var(--glass-strong); -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px); box-shadow: var(--shadow-lg), 0 0 0 .5px var(--separator); animation: menuIn .22s var(--out); transform-origin: top right; }
@keyframes menuIn { from { opacity: 0; transform: scale(.94) translateY(-4px); } }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 30px; padding: 0 10px; border-radius: 7px; font-size: 13px; text-align: left; }
.menu button:hover { background: var(--blue); color: #fff; }
.menu button .i { font-size: 15px; }
.menu button.danger { color: var(--red); }
.menu button.danger:hover { background: var(--red); color: #fff; }
.menu hr { border: 0; height: .5px; background: var(--separator); margin: 5px 8px; }

/* Unsupported browser */
.unsupported { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; text-align: center; padding: 30px; background: var(--bg); }
.unsupported h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.unsupported p { color: var(--label-2); max-width: 380px; margin: 8px auto 0; line-height: 1.5; }

/* Quiet re-renders (data refresh) don't replay entrance animations */
.quiet .stagger > *, .quiet.stagger > *, .quiet .stagger-fast > *, .quiet .stagger-pop > *, .quiet .m-rise { animation: none !important; }
.callout .stack div { overflow: hidden; }
.callout .stack img.ph { position: absolute; inset: 0; }
.filmstrip img.f { object-fit: cover; }
.filmstrip .f.in:not(.on) { outline: 2px solid var(--blue); outline-offset: -2px; }

/* Small windows */
@media (max-width: 900px) {
  .app { grid-template-columns: 200px 1fr; }
  .sheet { left: 50%; max-width: calc(100vw - 24px); }
  .toast { left: 50%; }
  .stats .stat { padding: 4px 8px; }
}
