/* Feed Loading & Display Styles */
:root { --hn-brand: #ff6b2d; }

.loading-spinner { text-align:center; padding:40px; color: var(--color-text-muted); }

.loading-spinner i {
    font-size: 32px;
    margin-bottom: 16px;
}

.no-posts,
.error-message { text-align:center; padding:40px; color: var(--color-text-muted); font-size:16px; }

.post-author-line { margin-top: 2px; font-size: 13px; color: var(--color-text-muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.post-author-link { color: inherit; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.post-author-link:hover { color: var(--color-text); text-decoration: underline; }
.post-author-name { font-weight: 500; color: var(--color-text); }
.post-author-handle { font-size: 12px; color: var(--color-text-muted); }

.detail-author-link, .detail-author-text { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--color-text-muted); text-decoration: none; }
.detail-author-link:hover { color: var(--color-text); text-decoration: underline; }
.detail-author-text .post-author-handle,
.detail-author-link .post-author-handle { font-size: 13px; }

/* AI badge for Milvus search results */
.post-title .ai-prefix,
.ai-badge { display:inline-block; padding:2px 8px; margin-right:8px; background: var(--color-accent-alt); color:#000; border-radius:999px; font-size:12px; font-weight:600; line-height:1; vertical-align:middle; }

.milvus-post .post-header { display: none; }

.error-message { color: var(--hn-brand); }

/* Poll Styles */
.poll-container {
    margin: 16px 0;
}

.poll-option { position:relative; background: var(--color-surface-alt); border:1px solid var(--color-border); border-radius:4px; padding:12px; margin-bottom:8px; cursor:pointer; transition:all 0.2s; overflow:hidden; }

.poll-option:hover { border-color: var(--color-text); }

.poll-option.voted { border-color: var(--hn-brand); }

.poll-option-bar { position:absolute; top:0; left:0; height:100%; background: linear-gradient(90deg, rgba(255,107,45,0.25), rgba(255,107,45,0.12)); transition: width 0.3s ease; z-index:0; }

.poll-option-text {
    position: relative;
    z-index: 1;
    font-size: 14px;
}

.poll-option-percentage { position:absolute; right:12px; top:50%; transform:translateY(-50%); font-size:14px; font-weight:600; color: var(--hn-brand); z-index:1; }

/* Expired poll state */
.poll-option.expired {
    opacity: 0.55;
    cursor: not-allowed;
}
.poll-option.expired .poll-option-bar {
    background: #444;
}
.poll-option.expired:hover {
    background: #2a2a2a !important;
}

.poll-footer { margin-top:12px; font-size:12px; color: var(--color-text-muted); }

/* Post Tags */
.post-tags {
    margin: 12px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hashtag { display:inline-block; padding:4px 8px; background: var(--color-surface-alt); color: var(--hn-brand); border-radius:12px; font-size:12px; cursor:pointer; transition:all 0.2s; }

.hashtag:hover { background: var(--hn-brand); color:#fff; }

/* Link Preview */
.link-preview-card { background: var(--color-surface); border:none; border-radius:4px; padding:0; margin:12px 0; }

.posts-feed .link-preview-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.posts-feed .link-preview-media,
.posts-feed .link-preview-image,
.posts-feed .link-preview-card .ytp-cued-thumbnail-overlay-image,
.posts-feed .post-image {
    width: 100%;
}

.link-preview-media {
    margin-bottom: 12px;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
}

.link-preview-image {
    display: block;
    width: 100%;
    height: auto;
    background: #000;
    line-height: 0;
}

.link-preview-card .link-preview-image,
.link-preview-card .link-preview-image img,
.link-preview-card .ytp-cued-thumbnail-overlay-image,
.link-preview-card .post-image,
.link-preview-card .post-image img {
    width: 100%;
    display: block;
}

.link-preview-card .link-preview-image img,
.link-preview-card .post-image img {
    height: auto;
    object-fit: cover;
}

.link-preview-image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.link-preview-video iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.link-preview-embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
}

.link-preview-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Post text block styled like link preview card */
.post-text { background: var(--color-surface-alt); border:1px solid var(--color-border); border-radius:4px; padding:12px; margin:12px 0; line-height:1.5; font-size:14px; color: var(--color-text); white-space:pre-wrap; }

.link-preview-content h4 { color: var(--hn-brand); font-size:14px; margin-bottom:8px; }

.link-preview-content p { color: var(--color-text-muted); font-size:13px; margin-bottom:8px; line-height:1.4; }

.link-preview-content a { color: var(--color-accent-alt); font-size:12px; text-decoration:none; }

.link-preview-content a:hover {
    text-decoration: underline;
}

/* Post Video */
.post-video {
    margin: 12px 0;
}

.post-video video {
    width: 100%;
    max-height: 500px;
    border-radius: 4px;
}

/* Active vote button */
.vote-btn.upvote.active { color: var(--hn-brand); background: var(--color-highlight); }

/* Filter tabs active state */
.filter-tab.active { border-bottom-color: var(--hn-brand); color: var(--color-text); }

/* Infinite scroll loader */
.feed-loader { text-align:center; padding:20px; color: var(--color-text-muted); }

.feed-loader.hidden {
    display: none;
}

/* Search overlay results */
.search-results-section { margin:12px 0; padding:8px 12px; background: var(--color-surface-alt); border:1px solid var(--color-border); border-radius:6px; }

.search-results-section h4 { margin:0 0 8px 0; color: var(--hn-brand); font-size:14px; }

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-result-item { padding:10px; background: var(--color-surface); border-radius:6px; cursor:pointer; }

.search-result-item .result-title { font-weight:600; color: var(--color-text); margin-bottom:6px; }

.search-result-item .result-snippet { color: var(--color-text-muted); font-size:13px; margin-bottom:6px; }

.search-result-item .result-meta {
    color: #8b8b8b;
    font-size: 12px;
}

.search-loading, .search-error {
    padding: 12px;
    color: #bdbdbd;
}

/* Make search overlay cover full viewport and be scrollable internally */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10,10,10,0.98);
    z-index: 9999;
    display: none; /* toggled via .active */
}
.search-overlay.active {
    display: block;
}
.search-overlay-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(10,10,10,0.98);
    padding: 12px;
    border-bottom: 1px solid #2a2a2a;
}
.search-overlay-content {
    height: calc(100vh - 64px);
    overflow: auto;
    padding: 16px;
}

/* Ensure search results list uses internal scroll and isn't cut off */
.search-results-section {
    max-height: none;
}