/* ==========================================================================
   Link/Social Page Styles - Modernized with Web Awesome Components
   ========================================================================== */

/* ==========================================================================
   Main Grid Layout
   ========================================================================== */

#link_main_grid {
    display: grid;
    grid-template-areas: "sidebar main ads";
    grid-template-columns: 280px minmax(0, 600px) 140px;
    gap: 16px;
    padding: 20px;
    background: #000;
    min-height: calc(100vh - 80px);
    max-width: 1100px;
    margin: 0 auto;
    justify-content: center;
}

/* Tablet: Sidebar above main, ads below */
@media (max-width: 1100px) {
    #link_main_grid {
        grid-template-areas:
            "sidebar main"
            "ads ads";
        grid-template-columns: 280px 1fr;
    }
}

/* Mobile: Main content with toggleable sidebar */
@media (max-width: 768px) {
    #link_main_grid {
        grid-template-areas: "main";
        grid-template-columns: 1fr;
        padding: 8px;
        gap: 12px;
    }
}

/* ==========================================================================
   Main Content Column
   ========================================================================== */

#link-main-column {
    grid-area: main;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 700px;
    width: 100%;
}

@media (max-width: 768px) {
    #link-main-column {
        max-width: 100%;
    }
}

/* ==========================================================================
   Post Composer
   ========================================================================== */

.post-composer {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 16px;
}

.post-composer::part(base) {
    background: #1a1a1a;
    border-color: #333;
}

/* Legacy composer-tabs - kept for backwards compatibility */
.composer-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.composer-tabs wa-button {
    --wa-button-font-size-medium: 14px;
}

.composer-tabs wa-button[active] {
    background: linear-gradient(135deg, #00FDf6, #0B7BF5);
}

.composer-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.composer-input-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.composer-avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 2px solid #00fff6;
}

.composer-form textarea {
    flex: 1;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    padding: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    min-height: 60px;
}

.composer-form textarea:focus {
    outline: none;
    border-color: #00fff6;
}

.composer-form textarea::placeholder {
    color: #888;
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.composer-icon-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #888;
    font-size: 1.25rem;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
}

.composer-icon-btn:hover {
    color: #00fff6;
    background: rgba(0, 255, 246, 0.1);
}

/* ==========================================================================
   Feed Filters (Segmented Control + Channel Chips)
   ========================================================================== */

.feed-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #333;
}

/* Post Scope Tabs - Segmented Control Style */
.feed-scope-tabs {
    display: inline-flex;
    background: #252525;
    border-radius: 6px;
    padding: 0;
    gap: 0;
    align-self: flex-start;
    border: 1px solid #555;
    /* No overflow:hidden - allows channel submenu to display */
}

.feed-scope-tabs .scope-tab {
    --wa-button-font-size-small: 13px;
    /* wa-button's shadow-DOM control reads these tokens for its own
       border-radius; setting them on the host propagates into the shadow
       so the inner control is flat. ::part(base) alone can't reach it. */
    --wa-form-control-border-radius: 0;
    --wa-border-radius-pill: 0;
    border-radius: 0 !important;
    margin: 0;
    background: transparent;
    border: none;
    color: #ccc;
    transition: all 0.2s ease;
    border-right: 1px solid #555;
}

.feed-scope-tabs .scope-tab:last-child {
    border-right: none;
}

/* html.visual-refresh prefix is required to outrank
   `html.visual-refresh wa-button[variant="default"]::part(base) { border-radius: 999px !important }`
   in visual_refresh.css (specificity 0,2,2 + !important). */
.feed-scope-tabs .scope-tab::part(base),
html.visual-refresh .feed-scope-tabs .scope-tab::part(base) {
    border-radius: 0 !important;
    border: none !important;
    background: transparent;
    padding: 8px 16px;
    margin: 0;
}

.feed-scope-tabs .scope-tab:first-child::part(base),
html.visual-refresh .feed-scope-tabs .scope-tab:first-child::part(base) {
    border-radius: 5px 0 0 5px !important;
}

/* Channel filter wrapper is last child - needs right rounded corners */
.feed-scope-tabs .channel-filter-wrapper:last-child .channel-filter-btn::part(base),
html.visual-refresh .feed-scope-tabs .channel-filter-wrapper:last-child .channel-filter-btn::part(base) {
    border-radius: 0 5px 5px 0 !important;
}

.feed-scope-tabs .scope-tab:hover {
    color: #fff;
}

.feed-scope-tabs .scope-tab:hover::part(base) {
    background: rgba(255, 255, 255, 0.1);
}

.feed-scope-tabs .scope-tab.active {
    color: #000;
}

.feed-scope-tabs .scope-tab.active::part(base) {
    background: #00fff6 !important;
    color: #000;
}

.feed-scope-tabs .scope-tab:first-child.active::part(base) {
    border-radius: 5px 0 0 5px !important;
}

.feed-scope-tabs .channel-filter-wrapper:last-child .channel-filter-btn.active::part(base) {
    border-radius: 0 5px 5px 0 !important;
}

.feed-scope-tabs .scope-tab.active wa-icon {
    color: #000;
}

/* Channel Filter - Chip Row Style */
/* Channel Filter Wrapper with Hover Submenu */
.channel-filter-wrapper {
    position: relative;
    display: inline-block;
}

.channel-filter-btn::part(base) {
    border-radius: 0 5px 5px 0 !important;
    border: none !important;
    background: transparent;
    color: #ccc;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.channel-filter-btn:hover::part(base),
.channel-filter-wrapper:hover .channel-filter-btn::part(base) {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.channel-filter-btn.active::part(base) {
    background: #00fff6 !important;
    color: #000;
}

.channel-filter-btn.active {
    color: #000;
}

.channel-filter-btn.active wa-icon,
.channel-filter-btn.active span {
    color: #000;
}

/* Channel Submenu (hover dropdown) */
.channel-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 180px;
    max-height: 300px;
    overflow-y: auto;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.channel-filter-wrapper:hover .channel-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.channel-submenu-list {
    padding: 4px 0;
}

.channel-submenu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
}

.channel-submenu-item:hover {
    background: rgba(0, 255, 246, 0.1);
    color: #fff;
}

.channel-submenu-item.active {
    background: rgba(0, 255, 246, 0.15);
    color: #00fff6;
}

.channel-submenu-item .channel-prefix {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
}

.channel-submenu-item wa-icon {
    font-size: 14px;
    opacity: 0.7;
}

/* Clear filter option */
.channel-clear-filter {
    border-bottom: 1px solid #333;
    margin-bottom: 4px;
    padding-bottom: 10px;
    color: #888;
}

.channel-clear-filter:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

/* Legacy classes - keep for backwards compatibility */
.channel-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.channel-filter-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Channel Chip Base Style */
.channel-chip {
    --wa-button-font-size-small: 12px;
    border-radius: 16px !important;
}

.channel-chip::part(base) {
    border-radius: 16px;
    border: 1px solid #444;
    background: transparent;
    color: #aaa;
    transition: all 0.2s ease;
}

.channel-chip:hover::part(base) {
    border-color: #666;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.channel-chip.active::part(base) {
    background: rgba(0, 255, 246, 0.15);
    border-color: #00fff6;
    color: #00fff6;
}

.channel-chip.active wa-icon {
    color: #00fff6;
}

/* ==========================================================================
   Search Chips (Topic Entities in Search Bar)
   ========================================================================== */

.search-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
    max-width: 60%;
    overflow-x: auto;
    scrollbar-width: none;
}

.search-chips::-webkit-scrollbar {
    display: none;
}

.search-chips:empty {
    display: none;
    max-width: 0;
}

.search-chip {
    display: inline-flex;
    align-items: center;
    background: rgba(240, 136, 62, 0.15);
    color: #f0883e;
    border: 1px solid rgba(240, 136, 62, 0.35);
    border-radius: 12px;
    padding: 1px 8px 1px 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 20px;
    animation: chipIn 0.15s ease-out;
}

@keyframes chipIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.search-chip-hash {
    opacity: 0.6;
    margin-right: 1px;
}

.search-chip-remove {
    margin-left: 4px;
    cursor: pointer;
    opacity: 0.5;
    font-size: 14px;
    line-height: 1;
    transition: opacity 0.15s;
}

.search-chip-remove:hover {
    opacity: 1;
    color: #ff6b6b;
}

/* Adjust search input when chips are present */
.about-search:has(.search-chips:not(:empty)) .about-search-input {
    flex: 1;
    min-width: 80px;
}

#channelDropdown::part(panel) {
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.channel-filter-dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
}

#channelFilterMenu wa-dropdown-item::part(base) {
    padding: 10px 16px;
    color: #ccc;
    transition: all 0.2s;
}

#channelFilterMenu wa-dropdown-item:hover::part(base) {
    background: rgba(0, 255, 246, 0.1);
    color: #fff;
}

#channelFilterMenu wa-dropdown-item::part(checked-icon) {
    display: none;
}

/* Legacy classes kept for backwards compatibility */
.channel-filter-btn {
    --wa-button-font-size-small: 12px;
}

.channel-filter-btn.active {
    background: linear-gradient(135deg, #00FDf6, #0B7BF5);
}

.channel-selector {
    margin-right: auto;
}

.channel-selector wa-button {
    --wa-button-font-size-small: 13px;
}

/* Channel badge on posts */
.channel-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(0, 255, 246, 0.1);
    border: 1px solid rgba(0, 255, 246, 0.3);
    border-radius: 12px;
    font-size: 11px;
    color: #00fff6;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    margin-left: auto;
    margin-right: 8px;
}

.channel-badge:hover {
    background: rgba(0, 255, 246, 0.2);
    border-color: #00fff6;
}

.channel-badge wa-icon {
    font-size: 10px;
}

/* Location badge on posts */
.location-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #f5533d;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.location-badge:hover {
    text-decoration: underline;
    color: #ff6b52;
}

.location-badge wa-icon {
    font-size: 10px;
    flex-shrink: 0;
}

/* Static map image below post text */
.location-map {
    display: block;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    line-height: 0;
}

.location-map img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.create-channel-btn {
    margin-left: auto;
}

.create-channel-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.create-channel-form wa-input,
.create-channel-form wa-textarea {
    width: 100%;
}

/* ==========================================================================
   Posts Container
   ========================================================================== */

#message-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ==========================================================================
   Post Card
   ========================================================================== */

.post-card {
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
}

.post-card::part(base) {
    background: #1a1a1a;
    border-color: #333;
}

.post-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 16px 12px;
}

.post-author {
    display: flex;
    gap: 12px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.post-author:hover .author-name {
    color: #00fff6;
}

.post-avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: #1a1a1a;
    border: 2px solid #fff;
    position: relative;
    overflow: visible;
}

.post-avatar:hover {
    border-color: #00fff6;
    box-shadow: 0 0 12px rgba(0, 255, 246, 0.4);
}

.status-indicator {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #1a1a1a;
    box-shadow: 0 0 0 2px #fff;
    display: block;
}

.status-indicator.status-online {
    background: #44b700;
}

.status-indicator.status-idle {
    background: #FFA500;
}

.status-indicator.status-offline {
    background: #808080;
}

.status-indicator.status-quiet {
    background: #DC3545;
}

.post-author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.author-name {
    font-weight: 600;
    color: #fff;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.author-headline {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-date {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.post-header wa-dropdown {
    margin-left: auto;
}

/* Post Body */
.post-body {
    padding: 0 16px 12px;
}

.post-text {
    color: #e0e0e0;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    margin: 0;
}

.post-image {
    margin-top: 12px;
    max-width: 100%;
    border-radius: 8px;
}

/* ==========================================================================
   Voting System (Reddit-style upvote/downvote)
   ========================================================================== */

.post-voting,
.reply-voting {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-top: 1px solid #333;
}

.reply-voting {
    padding: 0;
    border-top: none;
}

.vote-btn {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #666;
    font-size: 1.1rem;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vote-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.vote-btn.vote-up:hover {
    color: #ff4500;
}

.vote-btn.voted.vote-up {
    color: #ff4500;
}

.vote-btn-small {
    font-size: 0.9rem;
    padding: 4px;
}

.vote-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 2px 4px 2px 10px;
}

.vote-group-small {
    padding: 1px 2px 1px 8px;
}

.vote-group .vote-btn {
    background: transparent;
}

.vote-group:hover {
    background: rgba(255, 255, 255, 0.1);
}

.vote-score {
    font-size: 14px;
    font-weight: 600;
    color: #888;
    min-width: 24px;
    text-align: center;
}

.vote-score.score-positive {
    color: #ff4500;
}

.vote-score.score-zero {
    color: #888;
}

.vote-score-small {
    font-size: 12px;
    min-width: 20px;
}

/* Legacy reaction styles - kept for backwards compatibility */
.post-reactions,
.reply-reactions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-top: 1px solid #333;
}

.reply-reactions {
    padding: 0;
    border-top: none;
}

.reaction-display {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #888;
    font-size: 0.95rem;
}

.reaction-display wa-icon {
    font-size: 1rem;
    transition: color 0.2s;
}

.reaction-display wa-icon.active {
    color: #00fff6;
}

.reaction-count {
    font-size: 13px;
    color: #888;
}

.reaction-add-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #666;
    font-size: 0.9rem;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.reaction-add-btn:hover {
    color: #00fff6;
    opacity: 1;
}

.reaction-add-btn-small {
    font-size: 0.8rem;
    padding: 2px;
}

.post-reactions wa-dropdown,
.reply-reactions wa-dropdown {
    --show-duration: 300ms;
    --hide-duration: 200ms;
}

.reaction-picker {
    display: flex;
    gap: 2px;
    padding: 4px 6px;
    background: #1a1a1a;
    border-radius: 6px;
}

.reaction-option {
    background: transparent;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    color: #888;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reaction-option:hover {
    color: #00fff6;
    background: rgba(0, 255, 246, 0.1);
    transform: scale(1.1);
}

.reaction-option.active {
    color: #00fff6;
    background: rgba(0, 255, 246, 0.15);
}

/* Menu button (three dots) */
.menu-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #666;
    font-size: 1rem;
    border-radius: 50%;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-btn:hover {
    color: #fff;
}

.menu-btn-small {
    font-size: 0.85rem;
    padding: 2px;
}

/* ==========================================================================
   Reply Card
   ========================================================================== */

.post-replies {
    padding: 0 16px 16px 16px;
}

.reply-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    margin-top: 12px;
    background: #252525;
    border-radius: 10px;
}

.reply-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 2px solid #fff;
    cursor: pointer;
    position: relative;
    overflow: visible;
}

.reply-avatar:hover {
    border-color: #00fff6;
}

.reply-avatar .status-indicator {
    width: 10px;
    height: 10px;
    border-width: 1px;
    box-shadow: 0 0 0 1px #fff;
}

.reply-content-wrapper {
    flex: 1;
    min-width: 0;
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.reply-author {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
}

.reply-title {
    font-size: 12px;
    color: #888;
}

.reply-header wa-dropdown {
    margin-left: auto;
}

.reply-body {
    color: #d0d0d0;
    font-size: 14px;
    line-height: 1.4;
}

.reply-body p {
    margin: 0;
}

.reply-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.reply-reactions .reaction-count {
    font-size: 12px;
}

.reply-reactions .reaction-display wa-icon {
    font-size: 0.9rem;
}

.reply-timestamp {
    font-size: 11px;
    color: #666;
    margin-left: auto;
}

/* ==========================================================================
   Reply Form
   ========================================================================== */

.reply-form {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid #333;
    align-items: flex-start;
}

.reply-form-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 2px solid #fff;
}

.reply-form-content {
    flex: 1;
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

.reply-form .reply-editor {
    flex: 1;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 20px;
    color: #e0e0e0;
    padding: 8px 14px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    min-height: 36px;
    max-height: 100px;
    overflow-y: auto;
    outline: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.reply-form .reply-editor:focus {
    border-color: #00fff6;
}

.reply-form .reply-editor:empty:before {
    content: attr(data-placeholder);
    color: #888;
    pointer-events: none;
}

/* Autocomplete dropdown opens above the reply editor */
.reply-form-content .autocomplete-dropdown {
    bottom: 100%;
    top: auto !important;
    margin-bottom: 4px;
}

.reply-form wa-button {
    display: none;
}

.reply-form wa-button.visible {
    display: inline-flex;
}

/* ==========================================================================
   Profile Sidebar
   ========================================================================== */

.link-sidebar {
    grid-area: sidebar;
}

#side-bar-profile {
    position: sticky;
    top: 100px;
}

/* Hide mobile-only elements on desktop */
.sidebar-toggle-tab,
.sidebar-backdrop,
.sidebar-close-btn {
    display: none;
}

.profile-sidebar-card {
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
}

.profile-sidebar-card::part(base) {
    background: #1a1a1a;
    border-color: #333;
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    background: linear-gradient(180deg, #252525 0%, #1a1a1a 100%);
}

.profile-avatar-container {
    cursor: pointer;
    margin-bottom: 12px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid #00fff6;
    object-fit: cover;
}

.profile-avatar-container:hover .profile-avatar {
    box-shadow: 0 0 20px rgba(0, 255, 246, 0.5);
}

.profile-name {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px;
    text-align: center;
}

/* Edit icon button (pencil icons) */
.edit-icon-btn {
    background: transparent;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: #666;
    font-size: 0.8rem;
    vertical-align: middle;
    margin-left: 4px;
    transition: color 0.2s;
}

.edit-icon-btn:hover {
    color: #00fff6;
}

.profile-headline {
    color: #888;
    font-size: 14px;
    text-align: center;
    margin: 0;
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    padding: 16px;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #00fff6;
}

.stat-label {
    font-size: 12px;
    color: #888;
}

.profile-follow-btn {
    padding: 12px 16px;
    border-bottom: 1px solid #333;
}

.profile-follow-btn wa-button {
    width: 100%;
}

.profile-bio {
    padding: 16px;
}

.profile-bio h4 {
    color: #fff;
    font-size: 14px;
    margin: 0 0 8px;
}

.profile-bio p {
    color: #aaa;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.profile-bio-more {
    color: #00fff6;
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
    display: inline-block;
}

.profile-bio-more:hover {
    text-decoration: underline;
}

/* Mobile: Sidebar becomes slide-out drawer */
@media (max-width: 768px) {
    .link-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        background: #000;
        overflow-y: auto;
        padding-top: 60px;
    }

    .link-sidebar.open {
        transform: translateX(0);
    }

    #side-bar-profile {
        position: static;
        padding: 12px;
    }

    /* Sidebar toggle tab - visible when closed */
    .sidebar-toggle-tab {
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 80px;
        background: linear-gradient(180deg, #1a1a1a 0%, #252525 100%);
        border: 1px solid #333;
        border-left: none;
        border-radius: 0 8px 8px 0;
        display: flex !important;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 999;
        transition: background 0.2s, width 0.2s;
    }

    .sidebar-toggle-tab:hover {
        background: linear-gradient(180deg, #252525 0%, #333 100%);
        width: 36px;
    }

    .sidebar-toggle-tab wa-icon {
        color: #00fff6;
        font-size: 1rem;
    }

    .sidebar-toggle-tab.hidden {
        display: none;
    }

    /* Close button inside sidebar */
    .sidebar-close-btn {
        display: block !important;
        position: absolute;
        top: 12px;
        right: 12px;
        background: transparent;
        border: none;
        color: #888;
        font-size: 1.25rem;
        cursor: pointer;
        padding: 8px;
        border-radius: 50%;
        transition: color 0.2s, background 0.2s;
        z-index: 1001;
    }

    .sidebar-close-btn:hover {
        color: #fff;
        background: rgba(255, 255, 255, 0.1);
    }

    /* Backdrop overlay */
    .sidebar-backdrop {
        display: block !important;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

    .sidebar-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }
}

/* ==========================================================================
   Ads Sidebar
   ========================================================================== */

.link-ads {
    grid-area: ads;
}

.ads_sidebar_wrapper {
    /* No sticky - scrolls with content */
}

.ads_sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.side-ads {
    background: #111;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #222;
    transition: border-color 0.2s;
    aspect-ratio: 1 / 1;
}

.side-ads:hover {
    border-color: #333;
}

.side-ads ul {
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
}

.side-ads li {
    height: 100%;
}

.side-ads a {
    display: block;
    height: 100%;
}

.side-ads img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.side-ads:hover img {
    opacity: 1;
}

@media (max-width: 768px) {
    .link-ads {
        display: none;
    }
}

/* ==========================================================================
   Image Upload Dialog
   ========================================================================== */

#uploadImageModal::part(base) {
    background: #1a1a1a;
}

#uploadImageModal::part(panel) {
    background: #1a1a1a;
    border-color: #333;
}

#uploadImageModal::part(title) {
    color: #fff;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.upload-preview {
    width: 100%;
    min-height: 200px;
    background: #252525;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.upload-preview img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.upload-preview-placeholder {
    color: #666;
    text-align: center;
}

.upload-preview-placeholder wa-icon {
    font-size: 3rem;
    margin-bottom: 8px;
    display: block;
}

.upload-file-input {
    position: relative;
}

.upload-file-input input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.upload-form textarea {
    background: #252525;
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 80px;
}

.upload-form textarea:focus {
    outline: none;
    border-color: #00fff6;
}

.upload-form textarea::placeholder {
    color: #666;
}

/* ==========================================================================
   Guest User Callout
   ========================================================================== */

.guest-callout {
    margin-bottom: 16px;
}

.guest-callout::part(base) {
    background: #1a1a1a;
    border-color: #333;
    color: #fff;
}

.guest-callout::part(message) {
    color: #fff;
}

.guest-callout strong {
    color: #fff;
}

.guest-callout a {
    color: #00fff6;
    text-decoration: none;
}

.guest-callout a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #888;
}

.empty-state wa-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    color: #444;
}

.empty-state h3 {
    color: #fff;
    margin: 0 0 8px;
}

.empty-state p {
    margin: 0;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: #888;
}

.loading-state wa-spinner {
    font-size: 2rem;
    margin-bottom: 16px;
}

/* ==========================================================================
   Dropdown Menu Styling
   ========================================================================== */

wa-dropdown-item::part(base) {
    color: #fff;
}

wa-dropdown-item::part(base):hover {
    background: #333;
}

wa-dropdown::part(panel) {
    background: #1a1a1a;
    border: 1px solid #333;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #888;
}

/* ==========================================================================
   Mobile Compact Styles
   ========================================================================== */

@media (max-width: 768px) {
    /* Compact post composer */
    .post-composer {
        padding: 12px;
        border-radius: 8px;
    }

    .composer-tabs {
        margin-bottom: 12px;
        gap: 6px;
    }

    .composer-tabs wa-button {
        --wa-button-font-size-medium: 12px;
        padding: 0 8px;
    }

    /* Compact feed filters */
    .feed-filters {
        gap: 10px;
        margin-bottom: 12px;
        padding-bottom: 12px;
    }

    .feed-scope-tabs {
        padding: 3px;
        border-radius: 6px;
    }

    .feed-scope-tabs .scope-tab {
        --wa-button-font-size-small: 12px;
    }

    .channel-filter {
        gap: 6px;
    }

    .channel-chip {
        --wa-button-font-size-small: 11px;
    }

    .composer-avatar {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .composer-form textarea {
        padding: 10px;
        font-size: 14px;
        min-height: 50px;
    }

    /* Compact post cards */
    .post-card {
        border-radius: 8px;
    }

    .post-header {
        padding: 12px 12px 8px;
        gap: 10px;
    }

    .post-avatar {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .status-indicator {
        width: 12px;
        height: 12px;
    }

    .author-name {
        font-size: 14px;
    }

    .author-headline {
        font-size: 12px;
    }

    .post-date {
        font-size: 11px;
    }

    .post-body {
        padding: 0 12px 10px;
    }

    .post-text {
        font-size: 14px;
        line-height: 1.4;
    }

    .post-image {
        border-radius: 6px;
        margin-top: 8px;
    }

    /* Compact voting */
    .post-voting {
        padding: 6px 12px;
    }

    .vote-btn {
        font-size: 1rem;
        padding: 4px;
    }

    .vote-score {
        font-size: 13px;
        min-width: 20px;
    }

    /* Compact reactions (legacy) */
    .post-reactions {
        padding: 6px 12px;
    }

    .reaction-display {
        font-size: 0.85rem;
    }

    .reaction-count {
        font-size: 12px;
    }

    /* Compact replies */
    .post-replies {
        padding: 0 12px 12px;
    }

    .reply-card {
        padding: 10px;
        gap: 10px;
        margin-top: 10px;
        border-radius: 8px;
    }

    .reply-avatar {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .reply-avatar .status-indicator {
        width: 12px;
        height: 12px;
    }

    .reply-author {
        font-size: 13px;
    }

    .reply-title {
        font-size: 11px;
    }

    .reply-body {
        font-size: 13px;
    }

    .reply-timestamp {
        font-size: 10px;
    }

    /* Compact reply form */
    .reply-form {
        padding: 10px 12px;
        gap: 10px;
    }

    .reply-form-avatar {
        width: 30px;
        height: 30px;
        min-width: 30px;
    }

    .reply-form .reply-editor {
        padding: 6px 12px;
        font-size: 16px;
        min-height: 32px;
    }

    /* Compact profile card in sidebar */
    .profile-header {
        padding: 16px 12px;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
    }

    .profile-name {
        font-size: 16px;
    }

    .profile-headline {
        font-size: 13px;
    }

    .profile-stats {
        padding: 12px;
    }

    .stat-value {
        font-size: 16px;
    }

    .stat-label {
        font-size: 11px;
    }

    .profile-bio {
        padding: 12px;
    }

    .profile-bio h4 {
        font-size: 13px;
    }

    .profile-bio p {
        font-size: 12px;
    }

    /* Compact empty/loading states */
    .empty-state,
    .loading-state {
        padding: 32px 16px;
    }

    .empty-state wa-icon,
    .loading-state wa-spinner {
        font-size: 2rem;
    }
}
/* Post button visibility animation */
.post-submit-btn {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.post-submit-btn.visible {
    opacity: 1;
}

/* Mobile touch improvements */
@media (max-width: 768px) {
    .mobile-touch-target {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }
    
    .mobile-touch-target:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    .composer-form textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 16px;
    }
    
    .composer-actions {
        padding-top: 12px;
    }
    
    .channel-selector wa-button {
        min-height: 44px;
    }
}

/* Quick action button improvements */
.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease, transform 0.1s ease;
    cursor: pointer;
    min-height: 44px;
}

.quick-action-btn:hover {
    background: #333;
    color: #fff;
}

.quick-action-btn:active {
    transform: scale(0.98);
}

.quick-action-btn i {
    font-size: 16px;
    color: var(--CS-aqua);
}
/* ==========================================================================
   Infinite Scroll Sentinel
   ========================================================================== */

.feed-sentinel {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin-top: 20px;
}

.sentinel-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #888;
    font-size: 14px;
}

.sentinel-loading wa-spinner {
    font-size: 24px;
    --indicator-color: var(--CS-aqua);
}

/* End of feed indicator */
.feed-sentinel:not(:has(.sentinel-loading[style*="display: flex"])):not(:empty)::after {
    content: "You've reached the end";
    color: #666;
    font-size: 13px;
    padding: 20px;
}

/* Hide end message when loading is visible */
.feed-sentinel:has(.sentinel-loading[style*="display: flex"])::after {
    display: none;
}

/* ==========================================================================
   Center Profile View Styles
   ========================================================================== */

/* View container for switching between feed and profile */
#feed-views-container {
    width: 100%;
}

.feed-view-section {
    width: 100%;
}

/* Profile View Header (Back button + Title) */
.profile-view-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--wa-color-neutral-100, #1a1a1a);
    border-radius: 12px;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.profile-view-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.back-to-feed-btn {
    flex-shrink: 0;
}

/* Profile Center Header Card */
.profile-center-header {
    background: var(--wa-color-neutral-100, #1a1a1a);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.profile-center-header .profile-banner {
    height: 140px;
    background: linear-gradient(135deg, var(--CS-blue) 0%, #1a1a2e 100%);
    background-size: cover;
    background-position: center;
    position: relative;
    z-index: 0;
}

.profile-center-header .edit-banner-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.profile-center-header .edit-banner-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.banner-crop-dialog {
    --width: min(95vw, 580px);
}

#bannerCropModal::part(dialog) {
    background: #1a1a1a;
    border: 1px solid #333;
}

#bannerCropModal::part(header) {
    background: #1a1a1a;
}

#bannerCropModal::part(title) {
    color: #fff;
}

#bannerCropModal::part(close-button) {
    color: #aaa;
}

#bannerCropModal::part(body) {
    background: #1a1a1a;
    overflow: auto;
    padding: 16px;
    max-height: calc(100vh - 180px);
}

#bannerCropModal::part(footer) {
    background: #1a1a1a;
    border-top: 1px solid #333;
}

#bannerCropArea {
    max-height: calc(100vh - 280px);
    overflow: hidden;
}

#bannerCropArea .cr-boundary {
    background: #222;
}

#bannerCropArea .cr-slider-wrap {
    margin: 12px 0 0;
}

.profile-center-header .profile-info-section {
    padding: 0 20px 20px;
    position: relative;
    z-index: 1;
}

.profile-center-header .profile-avatar-wrapper {
    margin-top: -50px;
    margin-bottom: 16px;
}

.profile-center-header .profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: #333;
    border: 4px solid #1a1a1a;
}

.profile-center-header .profile-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-center-header .profile-name {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.profile-center-header .profile-username {
    color: #888;
    font-size: 15px;
    margin: 0;
}

.profile-center-header .profile-headline-badge {
    display: inline-block;
    background: rgba(0, 255, 246, 0.1);
    color: #00fff6;
    font-size: 13px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid rgba(0, 255, 246, 0.25);
    margin-top: 6px;
}

.profile-center-header .profile-bio {
    color: #ccc;
    font-size: 15px;
    line-height: 1.5;
    margin: 8px 0;
}

.profile-center-header .profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: #888;
    font-size: 14px;
    margin: 8px 0;
}

.profile-center-header .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.profile-center-header .meta-item a {
    color: var(--CS-aqua);
    text-decoration: none;
}

.profile-center-header .meta-item a:hover {
    text-decoration: underline;
}

.profile-center-header .profile-social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 8px 0;
}

.profile-center-header .social-link-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2a2a2a;
    color: #ccc;
    font-size: 16px;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.profile-center-header .social-link-item:hover {
    background: var(--CS-aqua);
    color: #000;
}

.profile-center-header .profile-divider {
    border: none;
    border-top: 1px solid #333;
    margin: 16px 0 12px;
    width: 100%;
}

.profile-center-header .profile-stats {
    display: flex;
    gap: 24px;
    margin: 12px 0;
}

.profile-center-header .stat-item {
    cursor: pointer;
    color: #ccc;
    font-size: 14px;
    transition: color 0.2s;
}

.profile-center-header .stat-item:hover {
    color: var(--CS-aqua);
}

.profile-center-header .stat-item strong {
    color: #fff;
    font-weight: 600;
    margin-right: 4px;
}

.profile-center-header .profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

/* Profile Posts Column */
#profile-posts-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#profile-posts-col .post-card {
    /* Uses existing post-card styles */
}

/* Empty state for profile posts */
#profile-posts-col .empty-state,
#profile-center-header .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #888;
}

#profile-posts-col .empty-state wa-icon,
#profile-center-header .empty-state wa-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

#profile-posts-col .empty-state h3,
#profile-center-header .empty-state h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #ccc;
}

#profile-posts-col .empty-state p,
#profile-center-header .empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .profile-view-header {
        padding: 12px;
        gap: 12px;
    }

    .profile-view-header h3 {
        font-size: 16px;
    }

    .profile-center-header .profile-banner {
        height: 100px;
    }

    .profile-center-header .profile-avatar-wrapper {
        margin-top: -40px;
    }

    .profile-center-header .profile-avatar {
        width: 80px;
        height: 80px;
    }

    .profile-center-header .profile-name {
        font-size: 20px;
    }

    .profile-center-header .profile-info-section {
        padding: 0 16px 16px;
    }

    .profile-center-header .profile-stats {
        gap: 16px;
    }

    .profile-center-header .profile-actions {
        gap: 8px;
    }

    .profile-center-header .profile-actions wa-button,
    .profile-center-header .profile-actions button {
        flex: 1;
        min-width: 0;
    }
}

/* ==========================================================================
   Inline Reference Links (@mentions, #topics, /channels)
   ========================================================================== */

.mention-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.mention-link:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

.topic-link {
    color: #f0883e;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.topic-link:hover {
    color: #d97706;
    text-decoration: underline;
}

.channel-link {
    color: #28a745;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.channel-link:hover {
    color: #218838;
    text-decoration: underline;
}

/* ==========================================================================
   Scroll-to-post Highlight Animation
   ========================================================================== */

@keyframes highlight-flash {
    0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
    20% { box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.4); }
    80% { box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

.highlight-post {
    animation: highlight-flash 3s ease-in-out;
    border-radius: 8px;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Notification Post Preview
   ========================================================================== */

.notification-post-preview {
    margin-top: 4px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid rgba(102, 126, 234, 0.5);
    border-radius: 0 4px 4px 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}
