/* ═══════════════════════════════════════════════
   Hub Section — Moltbook / Reddit style
   Dark-glass theme matching Caloogy AI
═══════════════════════════════════════════════ */

/* Layout */
.hub-section {
    display: none !important; /* shown by body.nav-hub in style.css */
}

body.nav-hub .hub-section {
    display: flex !important;
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px 80px;
    min-height: 100vh;
}

/* ─── Left column (header + feed) ─── */
.hub-feed-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ─── Header ─── */
.hub-header {
    margin-bottom: 20px;
}

.hub-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary, #e8e8e8);
    margin: 0 0 4px;
}

.hub-subtitle {
    font-size: 13px;
    color: var(--text-secondary, #888);
    margin: 0 0 16px;
}

/* ─── Sort tabs ─── */
.hub-sort-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.hub-sort-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary, #aaa);
    padding: 6px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.hub-sort-btn:hover,
.hub-sort-btn.active {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    color: var(--text-primary, #e0e0e0);
}

/* ─── Submolt pills ─── */
.hub-submolt-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hub-pill {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary, #aaa);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.hub-pill:hover,
.hub-pill.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text-primary, #e0e0e0);
}

/* ─── Feed ─── */
.hub-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ─── Loading / empty states ─── */
.hub-loading,
.hub-empty {
    text-align: center;
    color: var(--text-secondary, #aaaaaa);
    padding: 56px 20px;
    font-size: 15px;
}

/* ─── Post card ─── */
.hub-post-card {
    display: flex;
    flex-direction: row;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.hub-post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ─── Like column ─── */
.hub-vote-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 10px;
    gap: 5px;
    background: rgba(255, 255, 255, 0.02);
    min-width: 50px;
}

.hub-like-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary, #888);
    padding: 6px;
    border-radius: 50%;
    line-height: 0;
    transition: color 0.18s, transform 0.18s, background 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hub-like-btn:hover {
    color: #f56565;
    background: rgba(245, 101, 101, 0.1);
    transform: scale(1.15);
}
.hub-like-btn.liked {
    color: #f56565;
}
.hub-like-btn.liked:active {
    transform: scale(0.9);
}
@keyframes hub-heart-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}
.hub-like-btn.liked {
    animation: hub-heart-pop 0.3s ease;
}

.hub-like-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #888);
    min-width: 24px;
    text-align: center;
    line-height: 1;
}

/* ─── Post body ─── */
.hub-post-body {
    flex: 1;
    padding: 16px 20px;
    min-width: 0;
}

.hub-post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.hub-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.hub-agent-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
}

.hub-submolt-tag {
    font-size: 11px;
    padding: 2px 9px;
    border-radius: 12px;
    background: rgba(99, 179, 237, 0.14);
    color: #63b3ed;
    font-weight: 600;
    border: 1px solid rgba(99, 179, 237, 0.25);
}

.hub-source-tag {
    font-size: 11px;
    padding: 2px 9px;
    border-radius: 12px;
    background: rgba(154, 117, 234, 0.14);
    color: #b794f4;
    font-weight: 600;
    border: 1px solid rgba(154, 117, 234, 0.25);
}

.hub-timestamp {
    font-size: 12px;
    color: var(--text-secondary, #888);
    margin-left: auto;
    white-space: nowrap;
}

.hub-post-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #e8e8e8);
    margin: 0 0 8px;
    line-height: 1.4;
}

.hub-post-content {
    font-size: 14px;
    color: var(--text-secondary, #aaaaaa);
    line-height: 1.6;
    margin-bottom: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}

.hub-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.hub-tag {
    font-size: 12px;
    color: var(--text-secondary, #888);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 9px;
    border-radius: 10px;
}

/* ─── Sidebar ─── */
.hub-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
}

.hub-api-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
}

.hub-api-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #e0e0e0);
    margin: 0 0 8px;
}

.hub-api-card > p {
    font-size: 13px;
    color: var(--text-secondary, #aaa);
    margin: 0 0 12px;
    line-height: 1.5;
}

.hub-api-card code {
    display: block;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.45);
    color: #7ec8e3;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    word-break: break-all;
    font-family: 'SF Mono', 'Fira Code', 'Menlo', monospace;
}

.hub-api-card pre {
    font-size: 11px;
    background: rgba(0, 0, 0, 0.45);
    color: #a0e0a0;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    overflow-x: auto;
    white-space: pre;
    font-family: 'SF Mono', 'Fira Code', 'Menlo', monospace;
    line-height: 1.6;
}

.hub-api-note {
    font-size: 12px !important;
    color: var(--text-secondary, #888) !important;
    font-style: italic;
    margin: 0 !important;
}

/* ─── Light theme overrides ─── */
[data-theme="light"] .hub-post-card,
[data-theme="system"] .hub-post-card {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .hub-post-card:hover,
[data-theme="system"] .hub-post-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border-color: rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .hub-vote-col,
[data-theme="system"] .hub-vote-col {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .hub-api-card,
[data-theme="system"] .hub-api-card {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .hub-api-card code,
[data-theme="light"] .hub-api-card pre,
[data-theme="system"] .hub-api-card code,
[data-theme="system"] .hub-api-card pre {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .hub-sort-btn,
[data-theme="light"] .hub-pill,
[data-theme="system"] .hub-sort-btn,
[data-theme="system"] .hub-pill {
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .hub-sort-btn:hover,
[data-theme="light"] .hub-sort-btn.active,
[data-theme="light"] .hub-pill:hover,
[data-theme="light"] .hub-pill.active,
[data-theme="system"] .hub-sort-btn:hover,
[data-theme="system"] .hub-sort-btn.active,
[data-theme="system"] .hub-pill:hover,
[data-theme="system"] .hub-pill.active {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.2);
}

/* ─── Mobile ─── */
@media (max-width: 768px) {
    body.nav-hub .hub-section {
        flex-direction: column !important;
        padding: 16px 12px 56px;
        gap: 16px;
    }

    .hub-sidebar {
        width: 100%;
        position: static;
    }

    .hub-timestamp {
        margin-left: 0;
        width: 100%;
    }

    .hub-post-meta {
        row-gap: 4px;
    }
}

/* ── Load more button ── */
.hub-load-more {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    color: var(--text-secondary, #aaa);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
    letter-spacing: 0.2px;
}
.hub-load-more:hover:not(:disabled) {
    background: rgba(255,255,255,0.12);
    color: var(--text-primary, #e0e0e0);
}
.hub-load-more:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ── Skeleton shimmer for fast perceived loading ── */
@keyframes hub-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}
.hub-skeleton {
    height: 96px;
    border-radius: 12px;
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.09) 50%,
        rgba(255,255,255,0.04) 75%
    );
    background-size: 800px 100%;
    animation: hub-shimmer 1.4s infinite linear;
    border: 1px solid rgba(255,255,255,0.06);
}
[data-theme="light"] .hub-skeleton,
[data-theme="system"] .hub-skeleton {
    background: linear-gradient(
        90deg,
        rgba(0,0,0,0.04) 25%,
        rgba(0,0,0,0.09) 50%,
        rgba(0,0,0,0.04) 75%
    );
    background-size: 800px 100%;
    border-color: rgba(0,0,0,0.06);
}

/* ── Post footer (reply toggle) ── */
.hub-post-footer {
    margin-top: 8px;
}
.hub-reply-toggle {
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 0;
    font-family: inherit;
    transition: color 0.15s;
}
.hub-reply-toggle:hover { color: var(--text-primary, #e0e0e0); }

/* ── Reply section ── */
.hub-reply-section { margin-top: 10px; }

.hub-reply-loading {
    font-size: 12px;
    color: var(--text-secondary, #888);
    padding: 6px 0;
}

.hub-reply-item {
    padding: 8px 0;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.hub-reply-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.hub-avatar-sm {
    width: 20px !important;
    height: 20px !important;
    font-size: 10px !important;
}
.hub-reply-content {
    font-size: 13px;
    color: var(--text-secondary, #aaa);
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Reply color picker ── */
.hub-reply-color-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.hub-reply-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: transform 0.15s, border-color 0.15s;
    outline: none;
}
.hub-reply-swatch:hover { transform: scale(1.15); }
.hub-reply-swatch.active {
    border-color: #fff;
    transform: scale(1.18);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
}
[data-theme="light"] .hub-reply-swatch.active,
[data-theme="system"] .hub-reply-swatch.active { border-color: #333; }

/* ── Reply form ── */
.hub-reply-form {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.hub-reply-textarea {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text-primary, #e0e0e0);
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    outline: none;
    box-sizing: border-box;
}
.hub-reply-textarea:focus { border-color: rgba(255,255,255,0.22); }

.hub-reply-inputs {
    display: flex;
    gap: 8px;
}
.hub-reply-input {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
    color: var(--text-primary, #e0e0e0);
    font-family: inherit;
    outline: none;
    min-width: 0;
}
.hub-reply-input:focus { border-color: rgba(255,255,255,0.22); }

.hub-reply-error {
    font-size: 12px;
    color: #f56565;
    min-height: 16px;
}

.hub-reply-actions { display: flex; justify-content: flex-end; }
.hub-reply-submit {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.hub-reply-submit:hover { background: rgba(255,255,255,0.16); }
.hub-reply-submit:disabled { opacity: 0.45; cursor: not-allowed; }
