/* ── 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: #fff;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 0 20px 24px;
}

/* ── Horizontal tab bar (matches Music section pattern) ──────────────────── */
.memories-tabs {
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 24px;
  overflow-x: auto;        /* tabs scroll horizontally on small screens */
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
  /* hide scrollbar visually but keep it functional */
  scrollbar-width: none;
}

.memories-tabs::-webkit-scrollbar {
  display: none;
}

.memories-tab-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  min-width: max-content;  /* prevents tabs from wrapping/shrinking */
}

.memories-tab-item {
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 400;
  color: #333;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;     /* sits on top of the container border-bottom */
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.memories-tab-item:hover {
  color: #cd040b;
}

.memories-tab-item.active {
  color: #cd040b;
  font-weight: 700;
  border-bottom-color: #cd040b;
}

@media (max-width: 768px) {
  .memories-tab-item {
    padding: 12px 12px;    /* tighter padding on mobile */
    font-size: 13px;
  }
}

/* ── Other sub-category dropdown (shown when Other tab is active) ─────────── */
.mem-other-subfilter {
  padding: 0 0 20px;
}

.mem-other-select-wrap {
  position: relative;
  display: inline-block;
}

.mem-other-select-wrap::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #555;
  pointer-events: none;
}

.mem-other-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 9px 36px 9px 14px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  background: #fff;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  min-width: 140px;
}

.mem-other-select:focus {
  border-color: #cd040b;
}

/* ── 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(0,0,0,0.10);
  border-top-color: #cd040b;
  border-radius: 50%;
  animation: mem-spin 0.8s linear infinite;
  margin: auto;
}

.memories-spinner-sm {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0,0,0,0.10);
  border-top-color: #cd040b;
  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: #555;
  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: #666;
  font-size: 16px;
  text-align: center;
}

/* ── Page Header ─────────────────────────────────────────────────────────── */
.memories-page-header {
  padding: 0 0 20px;
}

.memories-page-title {
  font-size: 24px;
  font-weight: 700;
  color: #111;
  margin: 0;
}

.memories-page-sub {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

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

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

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

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

/* ── Memory Card ─────────────────────────────────────────────────────────── */
.mem-card {
  position: relative;
  aspect-ratio: 3/4;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 14px rgba(0,0,0,0.10);
}

.mem-card:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
}

/* ── Badge ───────────────────────────────────────────────────────────────── */
.mem-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #fff;
  z-index: 2;
}

.mem-card-badge-highlight {
  background: #1a73e8;
}

.mem-card-badge-flashback {
  background: #f59e0b;
}

.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-date {
  display: block;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.95;
}

/* ── Card hover action buttons ───────────────────────────────────────────── */
.mem-card-actions {
  position: absolute;
  bottom: 44px;          /* sit above the date info bar */
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 3;
}

.mem-card:hover .mem-card-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.mem-card-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,0.50);
  border: 1.5px solid rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.mem-card-action-btn:hover {
  background: rgba(0,0,0,0.75);
}

.mem-action-icon {
  width: 16px;
  height: 16px;
  display: block;
}

/* Heart: show outline by default, filled when favorited */
.mem-card-action-fav .mem-action-icon-filled  { display: none; }
.mem-card-action-fav .mem-action-icon-outline { display: block; }

.mem-card-action-fav.is-favorite .mem-action-icon-filled  { display: block; }
.mem-card-action-fav.is-favorite .mem-action-icon-outline { display: none; }

/* ── Favorite heart icon (top-right of card) ─────────────────────────────── */
.mem-card-favorite {
  display: none;               /* hidden by default; shown via .is-favorite */
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.55));
  pointer-events: none;
}

.mem-card.is-favorite .mem-card-favorite {
  display: block;
}

/* ── 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;
}

.mem-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 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;
}


