/* Memories Page - css/pages/memories.css */

/* ── Memory Grid Layout (like explore page) ───────────────────────────────── */
.memories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

/* ── Media Container with Interaction Features ────────────────────────────── */
.memories-media-root {
    position: relative;
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 300px;
    max-height: 70vh;
}

/* Fullscreen button positioning */
.memories-fullscreen-btn {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    color: #fff;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(10px);
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.memories-fullscreen-btn:hover {
    background: var(--sunset-orange);
    transform: translateY(-1px);
}

/* Media layers positioning - PROJECTION ALGORITHM */
.memories-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transition: opacity var(--transition-normal);
}

.memories-media-root {
    position: relative;
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 300px;
    max-height: 70vh;
}

.memories-layer-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    background: radial-gradient(circle at top, rgba(255,255,255,0.08), transparent 55%), #000;
}

.memories-layer-text p {
    max-width: 40rem;
    font-size: 1rem;
    line-height: 1.6;
    color: #fff;
}

.memory-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    cursor: pointer;
    border-top: 4px solid transparent;
    position: relative;
}

.memory-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-top-color: var(--sunset-orange);
}

/* Memory card image/video - DYNAMIC PROJECTION */
.memory-card-image {
    width: 100%;
    height: 200px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.4s;
    overflow: hidden;
}

/* Memory card projection - DYNAMIC */
.memory-card-projection {
    width: 100%;
    height: 200px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

/* Sidebar status cards */
.memories-status-card {
    position: relative;
    overflow: hidden;
}

/* Projection for status cards - DYNAMIC */
.status-card-projection {
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

/* Avatar projection - DYNAMIC */
.avatar-projection {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: inherit;
    overflow: hidden;
}

/* Shell layout defined below */



/* Info panel sections */
.memories-info-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.memories-info-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.memories-info-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-elevated);
}

.memories-info-user-meta {
    flex: 1;
}

.memories-info-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.memories-info-sub {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.memories-info-pill {
    background: var(--sunset-orange);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 500;
}

.memories-info-fade {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.memories-info-stats {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.memories-info-stats > div {
    background: var(--bg-elevated);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
}

/* Action buttons */
.memories-info-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.memories-info-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.memories-info-btn:hover {
    background: var(--gradient-sunset);
    color: #fff;
    border-color: transparent;
    transform: translateY(-1px);
}

.memories-info-btn i {
    font-size: var(--icon-base);
}

.memories-info-caption {
    background: var(--bg-elevated);
    padding: 1rem;
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    line-height: 1.5;
    margin-top: 1rem;
}

/* Comment section */
.memories-info-comment-section {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.memories-info-comment-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.memories-info-comment-input {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.875rem;
    color: var(--text-primary);
    font-family: inherit;
    resize: none;
    min-height: 80px;
}

.memories-info-comment-btn {
    background: var(--gradient-sunset);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.875rem 1.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.memories-info-comment-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ── Responsive Layout ───────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .memories-shell {
        gap: 0.75rem;
    }
    .memories-info-panel {
        width: 230px;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .memories-shell {
        flex-direction: column;
        height: auto;
        min-height: 0;
        gap: 1rem;
    }
    .memories-sidebar {
        display: block; /* show memory list at bottom */
        width: 100%;
        max-width: none;
    }
    .memories-display {
        height: 55vw;
        min-height: 280px;
        max-height: 420px;
        width: 100%;
        flex: 1;
    }
    .memories-info-panel {
        display: none; /* hide on mobile */
    }
}

/* Memory card content */
.memory-card-content {
    padding: 1rem;
}

.memory-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.memory-card-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--gradient-adventure);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    overflow: hidden;
    flex-shrink: 0;
}

.memory-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.memory-card-user {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.memory-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.memory-card-meta {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.memory-card-caption {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -moz-box;
    -moz-line-clamp: 2;
    -moz-box-orient: vertical;
    display: box;
    line-clamp: 2;
    box-orient: vertical;
    overflow: hidden;
}

/* Fading timer strip */
.memory-card-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: linear-gradient(135deg, rgba(255,107,53,0.1), rgba(255,158,109,0.06));
    font-size: 0.75rem;
    color: var(--sunset-orange);
    font-weight: 500;
    border-top: 1px solid rgba(255,107,53,0.15);
}

.memory-card-timer i {
    flex-shrink: 0;
}

.memory-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.memory-card-actions .stats {
    display: flex;
    gap: 1rem;
}

/* Save to wishlist */
.memory-card-wishlist-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.memory-card-wishlist-btn:hover,
.memory-card-wishlist-btn.saved {
    color: var(--danger-color);
    background: #fff;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    margin-top: 2rem;
}

/* ── Legacy styles for mobile compatibility ───────────────────────────────── */
.memories-shell {
    display: flex;
    gap: 1.25rem;
    margin-top: 0.75rem;
    height: calc(100vh - 170px);
    min-height: 520px;
}

.memories-sidebar {
    width: 280px;
    min-width: 240px;
    max-width: 280px;
    height: 100%;
    padding: 0.5rem 0.5rem 0.75rem 0;
    border-right: 1px solid var(--border-subtle);
    overflow-y: auto;
    overscroll-behavior: contain;
    flex-shrink: 0;
}

/* Right info panel */
.memories-info-panel {
    width: 270px;
    min-width: 240px;
    max-width: 290px;
    height: 100%;
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
}

.memories-info-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-sunset);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    overflow: hidden;
    flex-shrink: 0;
}

.memories-info-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.memories-info-pill {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: rgba(255,107,53,0.1);
    color: var(--sunset-orange);
    font-weight: 600;
}

.memories-info-fade {
    font-size: 0.7rem;
    color: var(--sunset-orange);
    font-weight: 600;
}

.memories-info-caption {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.memories-info-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.memories-info-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.memories-info-btn.active,
#memLikeBtn.active {
    color: var(--sunset-orange);
    border-color: var(--sunset-orange);
    background: rgba(255,107,53,0.08);
}

.memories-info-comment-input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
    font-family: inherit;
    color: var(--text-primary);
    resize: none;
    line-height: 1.4;
}

.memories-info-comment-input:focus {
    outline: none;
    border-color: var(--sunset-orange);
}

.memories-info-comment-btn {
    padding: 0.5rem 0.8rem;
    background: var(--gradient-sunset);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    flex-shrink: 0;
}

.memories-sidebar-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-muted);
    margin: 0 0 0.75rem 0.5rem;
}

.memories-sidebar-list {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    padding: 0 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.memories-sidebar-list::-webkit-scrollbar { 
    display: none; 
}

/* Memory status cards in horizontal scroll */

.memories-status-card {
    border-radius: var(--radius-xl);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
    flex-shrink: 0;
    width: 120px;
    height: 80px;
    position: relative;
}

.memories-status-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.memories-status-card--active {
    border-color: var(--sunset-orange);
    box-shadow: 0 0 0 2px rgba(255,107,53,0.25);
}

/* Legacy avatar styles — kept for compat */
.memories-status-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.memories-status-main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.memories-status-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.memories-status-meta {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.memories-status-pill {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: rgba(255,107,53,0.1);
    color: var(--sunset-orange);
}

.memories-status-fade {
    font-weight: 500;
}

.memories-status-stats {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    text-align: right;
}

/* ── Display area ─────────────────────────────────────────────────────────── */
.memories-display {
    flex: 1;
    min-width: 0;
    display: flex;
}

.memories-screen {
    width: 100%;
    border-radius: var(--radius-2xl);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.memories-media-root {
    position: relative;
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.memories-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--transition-normal);
}

.memories-layer-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    background: radial-gradient(circle at top, rgba(255,255,255,0.08), transparent 55%), #000;
}

.memories-layer-text p {
    max-width: 40rem;
    font-size: 1rem;
    line-height: 1.6;
    color: #fff;
}

.memories-fullscreen-btn {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    color: #fff;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(10px);
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.memories-fullscreen-btn:hover {
    background: var(--sunset-orange);
    transform: translateY(-1px);
}

/* ── Interaction panel ─────────────────────────────────────────────────----- */
.memories-interaction-panel {
    height: 180px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-subtle);
    padding: 0.85rem 1rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.memories-interaction-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.memories-interaction-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.memories-interaction-avatar {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    border: 2px solid var(--sunset-orange);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-adventure);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.memories-interaction-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.memories-interaction-user-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.memories-interaction-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.memories-interaction-sub {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
}

.memories-pill {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    background: rgba(255,107,53,0.1);
    color: var(--sunset-orange);
}

.memories-fade-label {
    color: var(--text-muted);
}

.memories-interaction-stats {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
}

.memories-interaction-caption {
    font-size: 0.8rem;
    color: var(--text-secondary);
    max-height: 2.7rem;
    overflow: hidden;
}

.memories-interaction-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.memories-reply-input {
    flex: 1;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    padding: 0.45rem 0.8rem;
    font-size: 0.75rem;
    color: var(--text-primary);
}

.memories-reply-input::placeholder {
    color: var(--text-muted);
}

.memories-reply-button {
    border-radius: 999px;
    border: none;
    background: var(--sunset-orange);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.45rem 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.memories-reply-button:hover {
    background: #ff7f4f;
    transform: translateY(-1px);
}

/* ── Memory Viewer Modal ─────────────────────────────── */
#memoryViewerModal { padding: 0; background: rgba(0,0,0,0.97); }

.memory-viewer {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #000;
    max-width: 600px;
    margin: 0 auto;
}

.memory-viewer-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0.65), transparent);
    z-index: 20;
}

.memory-viewer-author  { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
.memory-viewer-name    { font-weight: 600; font-size: 0.9rem; color: #fff; display: block; }
.memory-viewer-meta    { font-size: 0.72rem; color: rgba(255,255,255,0.75); display: flex; gap: 0.375rem; align-items: center; margin-top: 0.1rem; }
.memory-viewer-header-actions { display: flex; gap: 0.5rem; }
.memory-viewer-header-actions button { background: rgba(255,255,255,0.15); color: #fff; border: none; width: 2.25rem; height: 2.25rem; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--transition-fast); }
.memory-viewer-header-actions button:hover { background: rgba(255,255,255,0.3); }

.memory-viewer-timer {
    position: absolute;
    top: 4.5rem; left: 50%; transform: translateX(-50%);
    background: rgba(255,107,53,0.85);
    color: #fff;
    font-size: 0.78rem;
    padding: 0.3rem 0.875rem;
    border-radius: var(--radius-pill);
    display: flex; align-items: center; gap: 0.375rem;
    z-index: 20;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

.memory-viewer-gallery {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.memory-viewer-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.memory-viewer-media img   { width: 100%; max-height: 100%; object-fit: contain; cursor: pointer; }
.memory-viewer-video       { width: 100%; object-fit: contain; }

.memory-viewer-caption {
    position: absolute;
    bottom: 7rem; left: 0; right: 0;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: #fff;
    z-index: 20;
    font-size: 0.9rem;
    line-height: 1.5;
}

.memory-viewer-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.5rem; }
.memory-viewer-reactions { display: flex; align-items: center; gap: 0.375rem; position: absolute; bottom: 5.5rem; right: 1rem; z-index: 20; color: rgba(255,255,255,0.85); font-size: 0.85rem; }

.memory-viewer-action-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    display: flex;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(8px);
    padding: 0.5rem 0;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    z-index: 20;
}

.viewer-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 0.72rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.viewer-action-btn:hover { color: #fff; }
.viewer-action-btn i { font-size: 1.2rem; }
.viewer-action-btn.active i { color: var(--sunset-orange); }

.memory-viewer-nav {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 2.75rem; height: 2.75rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 25;
    font-size: 1rem;
    backdrop-filter: blur(4px);
    transition: background var(--transition-fast);
}

.memory-viewer-nav:hover      { background: rgba(255,255,255,0.3); }
.memory-viewer-prev-post      { left: 0.5rem; }
.memory-viewer-next-post      { right: 0.5rem; }

/* Thumbnail strip */
.memory-viewer-gallery .media-gallery-thumbnails {
    background: rgba(0,0,0,0.5);
    padding: 0.5rem 0.75rem;
}

/* Fix z-index for media-gallery-expand button */
.media-gallery-expand {
    z-index: 25;
}

/* Comments panel */
.memory-viewer-comments-panel {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 65%;
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.4);
}

.memory-viewer-comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.memory-viewer-comments-header h4 { font-size: 1rem; }

.memory-viewer-comments-list { flex: 1; overflow-y: auto; padding: 0.75rem 1.25rem; }

.memory-viewer-comment-composer {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-subtle);
}

.memory-viewer-comment-composer textarea { flex: 1; }

/* ── Trending Section Styles ─────────────────────────────────────────────── */
.trending-section {
    margin-bottom: 1.5rem;
}

.trending-section h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .875rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.trending-section h2 span {
    background: var(--sunset-orange);
    color: #fff;
    border-radius: 999px;
    padding: .15rem .5rem;
    font-size: .7rem;
    font-weight: 700;
}

#trendingMemories {
    display: flex;
    gap: .875rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#trendingMemories::-webkit-scrollbar {
    display: none;
}

#trendingMemories .trending-memory-card {
    flex-shrink: 0;
    width: 200px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    position: relative;
    transition: all var(--transition-normal);
}

#trendingMemories .trending-memory-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

#trendingMemories .trending-memory-card img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s;
}

#trendingMemories .trending-memory-card:hover img {
    transform: scale(1.03);
}

#trendingMemories .trending-memory-card .trending-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.65) 40%, transparent);
}

#trendingMemories .trending-memory-card .trending-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: .75rem;
}

#trendingMemories .trending-memory-card .trending-content .trending-username {
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
}

#trendingMemories .trending-memory-card .trending-content .trending-stats {
    color: rgba(255,255,255,.8);
    font-size: .75rem;
}

#trendingMemories .trending-memory-card .trending-badge {
    position: absolute;
    top: .5rem;
    right: .5rem;
    background: rgba(255,107,53,.9);
    color: #fff;
    border-radius: 999px;
    padding: .15rem .4rem;
    font-size: .65rem;
    font-weight: 700;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 480px) {
    .memories-shell {
        flex-direction: column;
    }

    .memories-sidebar {
        width: 100%;
        max-width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        padding-right: 0;
    }

    .memories-display {
        min-height: 340px;
    }

    .memories-interaction-panel {
        height: auto;
        padding-bottom: 0.85rem;
    }
}

@media (max-width: 768px) {
    #memoryStatusCarousel {
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: rgba(255,255,255,0.97);
        backdrop-filter: blur(20px);
        padding: 8px 12px;
        margin-bottom: 16px;
        box-shadow: 0 4px 24px rgba(0,0,0,0.12);
        transform: translateY(0);
        transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        height: 130px;
    }
    
    #memoryStatusCarousel.collapsed {
        transform: translateY(-100%);
    }
    
    .carousel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        font-size: 15px;
        font-weight: 600;
        color: var(--text-primary);
    }
    
    .carousel-header i { font-size: 14px; opacity: 0.7; }
    
    /* HORIZONTAL TRACK - SCROLL SNAP */
    .carousel-track {
        display: flex;
        gap: 12px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 8px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .carousel-track::-webkit-scrollbar { display: none; }
    
    /* STATUS MEMORY CARDS */
    .status-memory-card {
        flex: 0 0 280px;
        scroll-snap-align: center;
        height: 100px;
        background: linear-gradient(135deg, var(--gradient-orange) 0%, var(--gradient-purple) 100%);
        border-radius: 16px;
        padding: 12px 16px;
        color: white;
        position: relative;
        overflow: hidden;
        cursor: grab;
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    }
    
    .status-memory-card:active {
        cursor: grabbing;
    }
    
    .status-memory-card:hover,
    .status-memory-card.active {
        transform: scale(1.03);
        box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    }
    
    /* ✨ NEW RULES: hide sidebar, expand display */
    .memories-sidebar {
        display: none;
    }
    .memories-display {
        width: 100%;
    }

    /* FADE TIMER BADGE - TOP RIGHT */
    .fade-timer-badge {
        position: absolute;
        top: 16px;
        right: 16px;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(10px);
        padding: 6px 14px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.5px;
    }
    
    /* USER AVATAR */
    .status-avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        border: 3px solid rgba(255,255,255,0.25);
        margin: 0;
        background: rgba(255,255,255,0.15);
        object-fit: cover;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        float: left;
        margin-right: 12px;
    }
    
    /* USER INFO */
    .status-user-info {
        text-align: left;
        margin-bottom: 8px;
        padding-top: 4px;
    }
    .status-username { 
        font-size: 14px; 
        font-weight: 700; 
        margin-bottom: 2px;
        text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    }
    .status-location { 
        font-size: 11px; 
        opacity: 0.9;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    /* PROGRESS BAR - BOTTOM */
    .fade-progress-track {
        position: absolute;
        bottom: 16px;
        left: 20px;
        right: 20px;
        height: 5px;
        background: rgba(255,255,255,0.2);
        border-radius: 4px;
        overflow: hidden;
    }
    .fade-progress-fill {
        height: 100%;
        background: linear-gradient(90deg, #FF6B35, #F7931E);
        border-radius: 4px;
        transition: width 0.1s linear;
        width: 75%; /* Dynamic from API */
    }
    
    /* MAIN CONTENT OFFSET - Mobile Only */
    @media (max-width: 768px) {
        main { padding-top: 140px; }
    }
    
    /* COLLAPSE BUTTON ANIMATION */
    @keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }
    @keyframes slideUp { from { transform: translateY(0); } to { transform: translateY(-100%); } }
}

/* DESKTOP: HIDDEN */
@media (min-width: 769px) {
    #memoryStatusCarousel { display: none !important; }
}

/* AUDIO LAYER STYLES */
.memories-layer#audio {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gradient-blue) 0%, var(--gradient-purple) 100%);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-sizing: border-box;
}

.memories-layer#audio audio {
    width: 100%;
    max-width: 400px;
    background: rgba(255,255,255,0.9);
    border-radius: 50px;
    padding: 0.5rem;
}

/* COMMENT COMPOSER STYLES */
.comment-input-container {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    position: relative;
}

.comment-tools {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.25rem;
}

.tool-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.tool-btn:hover {
    background: var(--sunset-orange);
    color: #fff;
    border-color: var(--sunset-orange);
    transform: translateY(-1px);
}

/* EMOJI PICKER */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 100;
    max-width: 300px;
    max-height: 200px;
    overflow: auto;
}

.emoji-picker.active {
    display: block;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.25rem;
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.emoji-btn:hover {
    background: var(--bg-elevated);
}

/* GIF PICKER */
.gif-picker {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 100;
    max-width: 300px;
    max-height: 200px;
    overflow: auto;
}

.gif-picker.active {
    display: block;
}

.gif-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
}

.gif-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    overflow: hidden;
}

.gif-btn:hover {
    background: var(--bg-elevated);
}

.gif-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════════════════════════════════
   DESKTOP / LARGE SCREEN — Fading Memory panel as vertical left pane
   Applies at ≥ 769 px (i.e. the moment the horizontal carousel hides)
   ═══════════════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {

    /* ── Shell: sidebar gets a fixed, scrollable left column ── */
    .memories-shell {
        align-items: stretch;           /* all three columns fill the height */
        height: calc(100vh - 180px);
        min-height: 540px;
    }

    /* ── Sidebar panel ── */
    .memories-sidebar {
        display: flex !important;       /* override any 768 px hide rule */
        flex-direction: column;
        width: 260px;
        min-width: 220px;
        max-width: 260px;
        flex-shrink: 0;
        height: 100%;
        background: var(--bg-card);
        border-right: 1px solid var(--border-subtle);
        border-radius: var(--radius-xl) 0 0 var(--radius-xl);
        overflow: hidden;
        padding: 0;
    }

    /* Sticky title bar inside sidebar */
    .memories-sidebar-title {
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--bg-card);
        padding: .9rem .9rem .6rem;
        margin: 0;
        font-size: .72rem;
        text-transform: uppercase;
        letter-spacing: .17em;
        color: var(--text-muted);
        border-bottom: 1px solid var(--border-subtle);
        flex-shrink: 0;
    }

    /* ── List: flip to vertical column ── */
    .memories-sidebar-list {
        flex-direction: column;         /* ← key change: vertical */
        overflow-y: auto;               /* scroll vertically */
        overflow-x: hidden;
        gap: 0;
        padding: .35rem 0;
        flex: 1;
        min-height: 0;
        scrollbar-width: thin;
        scrollbar-color: var(--border-subtle) transparent;
    }
    .memories-sidebar-list::-webkit-scrollbar       { width: 4px; display: block; }
    .memories-sidebar-list::-webkit-scrollbar-track { background: transparent; }
    .memories-sidebar-list::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 4px; }

    /* ── Cards: full-width horizontal row ── */
    .memories-status-card {
        width: 100%;                    /* fill sidebar width */
        height: auto;                   /* let content determine height */
        flex-shrink: 0;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid var(--border-subtle);
        display: flex;
        flex-direction: row;
        align-items: stretch;
        gap: 0;
        background: transparent;
        transition: background var(--transition-fast);
        position: relative;
        padding: 0;
    }
    .memories-status-card:hover {
        background: var(--bg-elevated);
        transform: none;                /* no lift effect in list */
        box-shadow: none;
    }
    .memories-status-card--active {
        background: rgba(255,107,53,.07);
        border-bottom-color: var(--border-subtle);
        box-shadow: none;
    }
    /* Active indicator: left orange bar */
    .memories-status-card--active::before {
        content: '';
        position: absolute;
        left: 0; top: 0; bottom: 0;
        width: 3px;
        background: var(--sunset-orange);
        border-radius: 0 2px 2px 0;
    }

    /* ── Thumbnail: fixed square on the left ── */
    .mem-card-thumb {
        width: 60px !important;
        min-width: 60px !important;
        height: 60px !important;
        flex-shrink: 0;
        margin: .5rem .5rem .5rem .65rem;
        border-radius: var(--radius-lg) !important;
        overflow: hidden;
        position: relative;
    }

    /* ── Info row: fills remaining width ── */
    .mem-card-info {
        flex: 1;
        min-width: 0;
        padding: .55rem .65rem !important;
        display: flex !important;
        align-items: center;
        gap: .4rem;
    }

    /* Hide the JS-injected absolute orange border overlay */
    .memories-status-card > div:last-child[style*="border: 2px solid"] {
        display: none !important;
    }
}

/* ── Extra room on very large screens ── */
@media (min-width: 1280px) {
    .memories-sidebar {
        width: 300px;
        max-width: 300px;
    }
    .memories-shell {
        height: calc(100vh - 160px);
    }
}
