/* ── Base page height fix ─────────────────────────────────────────────────── */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

#page_memories {
  width: 100%;
  height: 100%;
}

/* ── memoriesMain shell (was in memoriesMain.html <style>) ──────────────── */
.memories-main-container {
  width: 100%;
  height: 100%;
  background-color: #f8f9fa;
}

.memories-content-area {
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

/* ── Memories wrapper ─────────────────────────────────────────────────────── */
.memories-view-wrapper {
  width: 100%;
  min-height: 100%;
  background: #1a1a1a;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 16px;
}

/* ── Loading / Spinner ───────────────────────────────────────────────────── */
.memories-loading,
.mem-modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.memories-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mem-spin 0.8s linear infinite;
  margin: auto;
}

.memories-spinner-sm {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mem-spin 0.8s linear infinite;
  margin: 12px auto;
}

@keyframes mem-spin {
  to { transform: rotate(360deg); }
}

.memories-load-more-spinner {
  text-align: center;
  padding: 12px 0;
}

/* ── Error ───────────────────────────────────────────────────────────────── */
.memories-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  text-align: center;
}

.memories-error-msg {
  color: #ccc;
  font-size: 15px;
  margin-bottom: 16px;
}

.btn-memories-retry {
  background: #e60000;
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-memories-retry:hover {
  background: #cc0000;
}

/* ── Empty ───────────────────────────────────────────────────────────────── */
.memories-empty,
.mem-modal-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.memories-no-content {
  color: #999;
  font-size: 16px;
  text-align: center;
}

/* ── Collections Grid ────────────────────────────────────────────────────── */
.memories-grid-wrap {
  width: 100%;
}

.memories-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

@media (max-width: 1200px) {
  .memories-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
  .memories-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Memory Card ─────────────────────────────────────────────────────────── */
.mem-card {
  position: relative;
  aspect-ratio: 1;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.mem-card:hover {
  transform: scale(1.03);
}

.mem-card-cover {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background-size: cover;
  background-position: center;
}

.mem-card-placeholder {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mem-card-placeholder-icon {
  width: 44px;
  height: 44px;
  opacity: 0.5;
  fill: none;
  stroke: #fff;
  stroke-width: 1.5;
}

.mem-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 10px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
}

.mem-card-label {
  display: block;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.2;
  text-transform: uppercase;
}

.mem-card-date {
  display: block;
  color: #fff;
  font-size: 11px;
  font-weight: 400;
  margin-top: 2px;
  opacity: 0.9;
}

/* ── Full-screen modal overlay ───────────────────────────────────────────── */
.mem-modal-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: #000;
  z-index: 9999;
}

.mem-modal-loading,
.mem-modal-empty {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mem-empty-back {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 1.5px solid rgba(255,255,255,0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mem-empty-back svg {
  width: 20px;
  height: 20px;
}

/* ── Full-screen carousel ────────────────────────────────────────────────── */
.mem-modal-carousel {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
}

/* Slides viewport fills screen */
.mem-carousel-viewport {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  overflow: hidden;
  z-index: 1;
}

.mem-carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.35s ease;
}

.mem-carousel-slide {
  flex: 0 0 100%;
  height: 100%;
  background: #111;
  position: relative;
  overflow: hidden;
}

/* Blurred background layer */
.mem-slide-bg-blur {
  position: absolute;
  top: -10%; right: -10%; bottom: -10%; left: -10%;
  background-size: cover;
  background-position: center;
  filter: blur(24px);
  opacity: 0.55;
}

/* Centered content layer */
.mem-slide-content {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mem-slide-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  position: relative;
  z-index: 1;
}

.mem-carousel-slide-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #555;
  font-size: 13px;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

.mem-carousel-slide-placeholder svg {
  width: 72px;
  height: 72px;
  fill: none;
  stroke: rgba(255,255,255,0.4);
  stroke-width: 1.5;
}

/* Invisible tap-zone nav buttons */
.mem-carousel-prev,
.mem-carousel-next {
  position: absolute;
  top: 0;
  bottom: 120px;
  width: 40%;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
}

.mem-carousel-prev { left: 0; }
.mem-carousel-next { right: 0; }

.mem-carousel-prev:disabled,
.mem-carousel-next:disabled {
  cursor: default;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.mem-carousel-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.mem-carousel-back,
.mem-carousel-more {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 1.5px solid rgba(255,255,255,0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.mem-carousel-back svg {
  width: 20px;
  height: 20px;
}

/* Three-dot vertical "more" button */
.mem-carousel-more {
  flex-direction: column;
  gap: 4px;
  padding: 0;
}

.mem-carousel-more span {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
}

/* ── Bottom overlay ──────────────────────────────────────────────────────── */
.mem-carousel-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 60%, transparent 100%);
  padding: 48px 0 0;
}

.mem-carousel-info {
  padding: 0 18px 10px;
}

.mem-carousel-label {
  display: block;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.15;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.mem-carousel-date {
  display: block;
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  font-weight: 400;
  margin-top: 2px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ── Music player bar ────────────────────────────────────────────────────── */
.mem-carousel-player {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 6px;
  background: rgba(0,0,0,0.45);
}

.mem-player-btn {
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  -webkit-tap-highlight-color: transparent;
}

.mem-player-speaker svg,
.mem-player-eq svg,
.mem-player-grid svg {
  width: 22px;
  height: 22px;
}

.mem-player-play {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.mem-player-play svg {
  width: 40px;
  height: 40px;
}

.mem-player-info {
  flex: 1;
  min-width: 0;
}

.mem-player-title {
  display: block;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mem-player-artist {
  display: block;
  color: rgba(255,255,255,0.6);
  font-size: 10px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Segmented progress bar — sits at the bottom of the bottom overlay ───── */
.mem-player-progress-bar {
  display: flex;
  gap: 3px;
  padding: 6px 10px 8px;
  background: rgba(0,0,0,0.55);
}

.mem-progress-seg {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  overflow: hidden;
}

.mem-progress-seg-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 2px;
}

/* Play button pause state */
.mem-player-play.is-paused .mem-icon-pause { display: none; }
.mem-player-play.is-paused .mem-icon-play  { display: block; }
.mem-player-play .mem-icon-pause           { display: block; }
.mem-player-play .mem-icon-play            { display: none; }

/* ── Select Items overlay ────────────────────────────────────────────────── */
.mem-select-overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: #fff;
  z-index: 20;
  display: flex;
  flex-direction: column;
}

.mem-select-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 2px solid #e8e8f0;
  flex-shrink: 0;
}

.mem-select-close {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.mem-select-close svg { width: 20px; height: 20px; }

.mem-select-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  color: #111;
}

.mem-select-more-btn {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3.5px;
  padding: 0;
  flex-shrink: 0;
}

.mem-select-more-btn span {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #111;
}

.mem-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 3px;
  padding: 3px;
  overflow-y: auto;
  flex: 1;
}

.mem-select-item {
  position: relative;
  aspect-ratio: 1;
  background: #111;
  cursor: pointer;
  overflow: hidden;
}

.mem-select-item-check {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 4px;
  background: transparent;
  z-index: 2;
  box-sizing: border-box;
  transition: background 0.15s, border-color 0.15s;
}

.mem-select-item.selected .mem-select-item-check {
  background: #cd040b;
  border-color: #cd040b;
}

.mem-select-item.selected .mem-select-item-check::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 7px;
  height: 11px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.mem-select-item-placeholder {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mem-select-item-placeholder svg {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: rgba(255,255,255,0.3);
  stroke-width: 1.5;
}

/* Footer action bar */
.mem-select-footer {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid #e8e8e8;
  justify-content: flex-end;
  flex-shrink: 0;
}

.mem-select-action-btn {
  padding: 9px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid #cd040b;
  background: transparent;
  color: #cd040b;
}

.mem-select-delete-btn {
  background: #cd040b;
  color: #fff;
}

/* ── Kabab dropdown (top-right ... menu) ─────────────────────────────────── */
.mem-topbar-more-wrap {
  position: relative;
  flex-shrink: 0;
}

.mem-kabab-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  min-width: 180px;
  overflow: hidden;
  z-index: 30;
}

.mem-kabab-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 500;
  color: #111;
  background: none;
  border: none;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mem-kabab-item:last-child {
  border-bottom: none;
}

.mem-kabab-item:hover {
  background: #f5f5f5;
}

.mem-kabab-item-danger {
  color: #cd040b;
}
.mem-card-error .mem-card-placeholder {
  background: #fdf0f0;
}
.mem-card-retry {
  margin-top: 6px;
  font-size: 11px;
  color: #e00;
  background: none;
  border: 1px solid #e00;
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
}


