/* ============================================================
   Community Feed — Midnight Oasis Theme
   ============================================================ */

/* ── Layout ─────────────────────────────────────────────── */
.feed-layout {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 0 48px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Page header ─────────────────────────────────────────── */
.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.feed-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-color);
    font-family: var(--font-primary);
}

/* ── Filter tabs ─────────────────────────────────────────── */
.feed-filter-tabs {
    display: flex;
    gap: 0;
    background: rgba(124, 108, 245, 0.08);
    border: 1px solid rgba(124, 108, 245, 0.15);
    border-radius: 999px;
    padding: 3px;
    overflow: hidden;
}

.feed-tab {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 5px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.feed-tab.active {
    background: rgba(124, 108, 245, 0.85);
    color: #fff;
}

.feed-tab:hover:not(.active) {
    background: rgba(124, 108, 245, 0.12);
    color: var(--text-color);
}

/* ── Filter controls ─────────────────────────────────────── */
.feed-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.feed-select {
    font-family: var(--font-primary);
    font-size: 0.78rem;
    font-weight: 500;
    border: 1px solid var(--gray-light);
    border-radius: 999px;
    padding: 5px 28px 5px 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237c6cf5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 8px;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.feed-select:hover,
.feed-select:focus {
    border-color: rgba(124, 108, 245, 0.45);
    color: var(--text-primary);
}

/* ── New posts banner ────────────────────────────────────── */
.feed-new-banner {
    background: rgba(124, 108, 245, 0.08);
    border: 1px solid rgba(124, 108, 245, 0.25);
    border-radius: 12px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(180, 160, 255, 0.9);
    font-weight: 500;
    animation: feed-banner-slide 0.3s ease;
}

.feed-new-icon { font-size: 0.95rem; }

.feed-new-btn {
    border: 1px solid rgba(124, 108, 245, 0.4);
    background: rgba(124, 108, 245, 0.2);
    color: rgba(180, 160, 255, 0.95);
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.feed-new-btn:hover { background: rgba(124, 108, 245, 0.35); }

@keyframes feed-banner-slide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Feed list ───────────────────────────────────────────── */
.feed-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feed-empty {
    text-align: center;
    padding: 48px 24px;
}

/* ── Loading ─────────────────────────────────────────────── */
.feed-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.feed-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(124, 108, 245, 0.15);
    border-top-color: rgba(124, 108, 245, 0.8);
    border-radius: 50%;
    animation: feed-spin 0.65s linear infinite;
}

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

.feed-load-more-wrap {
    display: flex;
    justify-content: center;
    padding-top: 4px;
}

/* ── Feed card ───────────────────────────────────────────── */
.feed-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 24px -4px rgba(124, 108, 245, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .feed-card {
    background: rgba(28, 22, 50, 0.92);
    border: 1px solid rgba(124, 108, 245, 0.18);
    box-shadow: 0 0 0 1px rgba(124, 108, 245, 0.08), 0 16px 40px rgba(0, 0, 0, 0.4);
}

.feed-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 50px -8px rgba(124, 108, 245, 0.18), 0 8px 16px -4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .feed-card:hover {
    box-shadow: 0 0 0 1px rgba(124, 108, 245, 0.22), 0 24px 56px rgba(0, 0, 0, 0.5), 0 0 60px rgba(124, 108, 245, 0.08);
}

/* ── Card header ─────────────────────────────────────────── */
.feed-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 11px;
    border-bottom: 1px solid rgba(124, 108, 245, 0.08);
}

.feed-card-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(124, 108, 245, 0.2);
    border: 2px solid rgba(124, 108, 245, 0.25);
    color: rgba(180, 160, 255, 0.9);
    font-weight: 700;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    font-family: var(--font-primary);
    transition: border-color 0.2s ease;
}

.feed-card-avatar:hover { border-color: rgba(124, 108, 245, 0.55); }

.feed-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.feed-card-user { flex: 1; min-width: 0; }

.feed-card-username {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-color);
    cursor: pointer;
    font-family: var(--font-primary);
    transition: color 0.2s ease;
}

.feed-card-username:hover { color: rgba(124, 108, 245, 0.9); }

.feed-card-time {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 1px;
}

.feed-card-header-badges {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

/* ── Badges ──────────────────────────────────────────────── */
.feed-live-badge {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.07em;
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
    animation: feed-live-pulse 1.8s ease-in-out infinite;
}

@keyframes feed-live-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

.feed-completed-badge {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.04em;
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.feed-card-privacy {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.feed-card-privacy.public {
    background: rgba(34, 197, 94, 0.08);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.15);
}

.feed-card-privacy.friends {
    background: rgba(124, 108, 245, 0.1);
    color: rgba(180, 160, 255, 0.9);
    border: 1px solid rgba(124, 108, 245, 0.2);
}

[data-theme="dark"] .feed-card-header {
    background: linear-gradient(135deg, rgba(124, 108, 245, 0.12), transparent);
    border-bottom-color: rgba(124, 108, 245, 0.15);
}

/* ── Card body ───────────────────────────────────────────── */
.feed-card-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feed-card-title-row {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.feed-card-gamemode-icon { font-size: 1.05rem; line-height: 1; }

.feed-card-gamemode-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    font-family: var(--font-primary);
}

.feed-difficulty-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: capitalize;
    flex-shrink: 0;
}

.feed-difficulty-badge.easy   { background: rgba(34,197,94,0.1);  color: #22c55e; border: 1px solid rgba(34,197,94,0.2); }
.feed-difficulty-badge.medium { background: rgba(245,158,11,0.1); color: #f59e0b; border: 1px solid rgba(245,158,11,0.2); }
.feed-difficulty-badge.hard   { background: rgba(239,68,68,0.1);  color: #ef4444; border: 1px solid rgba(239,68,68,0.2); }

.feed-points-badge {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(124, 108, 245, 0.7);
    font-family: var(--font-primary);
}

/* ── Stat grid ───────────────────────────────────────────── */
.feed-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-radius: 11px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.feed-stat {
    padding: 9px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-align: center;
    border-right: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.feed-stat:last-child { border-right: none; }
.feed-stat:hover { background: rgba(124, 108, 245, 0.06); }

.feed-stat-value {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-color);
    font-family: var(--font-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.feed-stat-value.empty {
    color: var(--text-light);
    font-weight: 400;
}

.feed-stat-value.live {
    color: #ef4444;
    animation: feed-live-pulse 1.8s ease-in-out infinite;
}

.feed-stat-label {
    font-size: 0.64rem;
    color: var(--text-light);
    font-family: var(--font-primary);
    font-weight: 500;
    line-height: 1.2;
}

.feed-stat-sub {
    display: block;
    font-size: 0.6rem;
    color: var(--text-light);
    margin-top: 1px;
}

@media (max-width: 480px) {
    .feed-stats { grid-template-columns: repeat(2, 1fr); }
    .feed-stat:nth-child(2) { border-right: none; }
    .feed-stat { border-bottom: 1px solid rgba(124, 108, 245, 0.08); }
    .feed-stat:nth-last-child(-n+2) { border-bottom: none; }
}

/* ── Reaction bar ────────────────────────────────────────── */
.feed-card-reactions {
    padding: 9px 14px 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(124, 108, 245, 0.08);
}

.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(124, 108, 245, 0.15);
    background: rgba(124, 108, 245, 0.05);
    border-radius: 999px;
    padding: 4px 11px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
    font-family: var(--font-primary);
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1;
}

.reaction-btn:hover {
    background: rgba(124, 108, 245, 0.12);
    border-color: rgba(124, 108, 245, 0.35);
    color: var(--primary);
    transform: scale(1.05);
}

.reaction-btn.reacted {
    background: rgba(124, 108, 245, 0.18);
    border-color: rgba(124, 108, 245, 0.5);
    color: var(--primary);
}

.reaction-emoji { font-size: 0.95rem; }
.reaction-count { font-size: 0.75rem; min-width: 10px; }

.feed-card-comment-toggle {
    margin-left: auto;
    background: none;
    border: none;
    font-family: var(--font-primary);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.feed-card-comment-toggle:hover {
    background: rgba(124, 108, 245, 0.08);
    color: rgba(124, 108, 245, 0.9);
}

/* ── Admin bar ───────────────────────────────────────────── */
.feed-card-admin-bar {
    padding: 5px 10px;
    border-top: 1px solid rgba(239, 68, 68, 0.15);
    background: rgba(239, 68, 68, 0.04);
    display: flex;
    justify-content: flex-end;
}

.feed-admin-delete-btn {
    background: none;
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #ef4444;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.feed-admin-delete-btn:hover { background: rgba(239, 68, 68, 0.12); }

/* ── Comments section ────────────────────────────────────── */
.feed-card-comments {
    border-top: 1px solid rgba(124, 108, 245, 0.08);
    padding: 12px 14px 14px;
    display: none;
}

.feed-card-comments.open { display: block; }

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.comment-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.comment-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(124, 108, 245, 0.18);
    border: 1px solid rgba(124, 108, 245, 0.2);
    color: rgba(180, 160, 255, 0.9);
    font-weight: 700;
    font-size: 0.68rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.comment-bubble {
    background: rgba(124, 108, 245, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 7px 10px;
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    align-items: baseline;
    gap: 7px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

.comment-username {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-color);
    font-family: var(--font-primary);
}

.comment-time {
    font-size: 0.68rem;
    color: var(--text-light);
}

.comment-text {
    font-size: 0.84rem;
    color: var(--text-color);
    word-break: break-word;
    line-height: 1.45;
}

.comment-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--text-light);
    padding: 2px 4px;
    border-radius: 4px;
    margin-left: auto;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.comment-delete-btn:hover { color: #ef4444; }

.comments-empty {
    font-size: 0.82rem;
    color: var(--text-light);
    text-align: center;
    padding: 6px 0 4px;
}

.comment-form {
    display: flex;
    gap: 7px;
    align-items: center;
    margin-top: 4px;
}

.comment-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 6px 14px;
    font-family: var(--font-secondary);
    font-size: 0.84rem;
    background: rgba(124, 108, 245, 0.06);
    color: var(--text-color);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comment-input::placeholder { color: rgba(150, 140, 190, 0.4); }
.comment-input:focus {
    border-color: rgba(124, 108, 245, 0.5);
    box-shadow: 0 0 0 3px rgba(124, 108, 245, 0.1);
}

.comment-submit-btn {
    border: none;
    background: rgba(124, 108, 245, 0.75);
    color: #fff;
    border-radius: 999px;
    padding: 6px 15px;
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
}

.comment-submit-btn:hover { background: rgba(124, 108, 245, 0.9); transform: translateY(-1px); }
.comment-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.comments-load-more {
    background: none;
    border: none;
    font-family: var(--font-primary);
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(124, 108, 245, 0.75);
    cursor: pointer;
    padding: 5px 0;
    display: block;
    margin: 2px auto 6px;
}

.comments-load-more:hover { color: rgba(124, 108, 245, 1); text-decoration: underline; }

/* ── Mobile navbar safety ────────────────────────────────── */
@media (max-width: 768px) {
    .floating-brand,
    .floating-controls {
        position: fixed !important;
        z-index: 9999 !important;
        transform: none !important;
        -webkit-transform: none !important;
        backface-visibility: hidden;
    }
    .floating-brand { top: 14px !important; left: 14px !important; }
    .floating-controls { top: 14px !important; right: 14px !important; left: auto !important; }
}

/* ── Session photos ──────────────────────────────────────── */
.feed-card-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.feed-photo {
    position: relative;
    width: 92px;
    height: 92px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--gray-light);
    background: var(--bg-secondary);
}

.feed-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}

.feed-photo-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.65rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.feed-photo:hover .feed-photo-delete {
    opacity: 1;
}

.feed-photo-delete:hover {
    background: rgba(239, 68, 68, 0.85);
}

.feed-photo-add {
    width: 92px;
    height: 92px;
    border-radius: 10px;
    border: 1.5px dashed rgba(124, 108, 245, 0.45);
    background: rgba(124, 108, 245, 0.05);
    color: rgba(124, 108, 245, 0.9);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: var(--font-primary);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.feed-photo-add:hover {
    background: rgba(124, 108, 245, 0.12);
    border-color: rgba(124, 108, 245, 0.7);
}

.feed-photo-add:disabled {
    opacity: 0.5;
    cursor: wait;
}

.feed-photo-add-icon {
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1;
}

.feed-photo-add-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Photo lightbox ──────────────────────────────────────── */
.feed-photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
}

.feed-photo-lightbox.open {
    display: flex;
}

.feed-photo-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

/* ── Privacy select (own sessions) ───────────────────────── */
.feed-privacy-select {
    font-family: var(--font-primary);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 18px 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(124, 108, 245, 0.3);
    background-color: rgba(124, 108, 245, 0.08);
    color: rgba(124, 108, 245, 0.95);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%237c6cf5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

.feed-privacy-select:hover,
.feed-privacy-select:focus {
    border-color: rgba(124, 108, 245, 0.6);
}

[data-theme="dark"] .feed-privacy-select {
    color: rgba(180, 160, 255, 0.95);
}
