/* Components CSS */

/* Custom Modal Overlay */
.custom-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.custom-modal-content {
    padding: 24px;
    border-radius: var(--radius-lg);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-icon-danger {
    font-size: 3rem;
    color: #ff4545;
    margin-bottom: 16px;
}

.modal-title {
    margin-top: 0;
    color: var(--text-main);
}

.modal-body {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-flex-1 {
    flex: 1;
    justify-content: center;
}

.btn-danger {
    background: #e0245e;
}

/* Post Cards & Feeds */
.post-card {
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.post-card:hover {
    background: rgba(24, 24, 31, 1);
}

.feed-empty-state {
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border);
}

.feed-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--primary);
}

.feed-empty-title {
    margin-top: 0;
    color: var(--text-main);
}

.feed-empty-text {
    margin-bottom: 24px;
}

/* Post structural layout */
.post-layout-flex {
    display: flex;
    gap: 16px;
}

.post-avatar-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.post-content-area {
    flex: 1;
    min-width: 0;
    /* Prevents flex child from overflowing on long unbroken strings */
}

.post-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.post-author-name {
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    font-size: 1.1rem;
}

.post-author-handle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-left: 8px;
}

.post-badges-container {
    margin-top: 4px;
}

.badge-collab {
    background: var(--primary);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.badge-event {
    background: #2a2a35;
    color: #ffb845;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.badge-community {
    background: rgba(177, 136, 255, 0.15);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-community:hover {
    background: rgba(177, 136, 255, 0.25);
}

.post-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.post-text-body {
    margin-top: 12px;
    line-height: 1.5;
    color: var(--text-main);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: normal;
    max-width: 100%;
}

.post-text-body a {
    color: var(--primary);
    text-decoration: none;
}

.post-text-body a:hover {
    text-decoration: underline;
}

.external-link {
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: normal;
}

.reply-text-body a {
    color: var(--primary);
    text-decoration: none;
}

.reply-text-body a:hover {
    text-decoration: underline;
}

.post-extra-card {
    margin-top: 16px;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--surface-hover);
    border: 1px dashed var(--border);
}

.post-image-grid {
    display: grid;
    gap: 4px;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 12px;
    /* border: 1px solid var(--border); */
}

.grid-image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.grid-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.grid-image:hover {
    opacity: 0.85;
}

/* 1 Image: Full bleed, auto height but max 450px */
.post-image-grid[data-count="1"] {
    grid-template-columns: 1fr;
    max-height: 450px;
}

.post-image-grid[data-count="1"] .grid-image-wrapper {
    max-height: 450px;
    display: flex;
    justify-content: center;
}

.post-image-grid[data-count="1"] .grid-image {
    object-fit: contain;
    /* Single image shouldn't crop usually, but user asked for cropped like bluesky. So cover is fine, or we let single image be contain and multi-be cover. Let's make single cover but limited to 450px. Wait, cover on a flexible div means it will stretch to the div. If we don't set aspect ratio, it will just show full image. So let's leave it as is. */
    object-fit: cover;
}

/* 2 Images: 1x2 split, forced aspect ratio for uniformity */
.post-image-grid[data-count="2"] {
    grid-template-columns: 1fr 1fr;
    aspect-ratio: 16 / 9;
}

/* 3 Images: 1 big on left, 2 stacked on right */
.post-image-grid[data-count="3"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 16 / 9;
}

.post-image-grid[data-count="3"] .grid-image-wrapper:nth-child(1) {
    grid-row: span 2;
    /* Left image takes full height */
}

/* 4 Images: 2x2 grid */
.post-image-grid[data-count="4"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 16 / 9;
}

/* Lightbox Modal */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-image {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 100000;
}

.lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.8);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.post-actions-row {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    color: var(--text-muted);
}

.post-action-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-action-liked {
    color: #e0245e;
}

.post-action-reposted {
    color: #17bf63;
}

.post-action-bookmarked {
    color: var(--primary);
}

.post-action-offer {
    color: var(--primary);
}

.post-action-delete {
    color: #fff;
    margin-left: auto;
}

.reply-count-text {
    font-size: 0.9rem;
}

.replies-container {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}

.replies-list-container {
    margin-bottom: 16px;
}

.reply-composer-header {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.reply-cancel-icon {
    cursor: pointer;
    color: #ff4545;
    margin-left: 8px;
}

.reply-form-flex {
    display: flex;
    gap: 8px;
}

.reply-input-flex {
    flex: 1;
}

.reply-submit-btn {
    padding: 8px 16px;
}

/* Replies & Mentions */
.reply-loading,
.reply-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.reply-error,
.reply-network-error {
    color: #ff4545;
    font-size: 0.9rem;
}

.reply-item-container {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    scroll-margin-top: 80px;
    transition: opacity 0.3s;
}

.reply-item-deleted {
    opacity: 0.5;
}

.reply-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.reply-item-content {
    flex: 1;
    min-width: 0;
    /* Prevent flex child overflow on long strings */
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid transparent;
}

.reply-context-info {
    font-size: 0.8rem;
    color: var(--primary);
    margin-bottom: 4px;
}

.reply-context-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.reply-author-info {
    font-size: 0.9rem;
}

.reply-author-name {
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
}

.reply-author-deleted {
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
}

.reply-time {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 6px;
}

.reply-text-body {
    margin-top: 4px;
    font-size: 0.95rem;
    color: var(--text-main);
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: pre-wrap;
}

.reply-text-deleted {
    font-style: italic;
}

.reply-action-container {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.reply-action-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mention-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.mention-dropdown-item-wrap {
    display: flex;
    flex-direction: column;
}

.mention-dropdown-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.mention-dropdown-handle {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.avatar-live-border {
    border: 2px solid #ff4545;
    padding: 1px;
}

.live-badge {
    display: inline-block;
    background: #ff4545;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 4px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 6px;
    text-transform: uppercase;
    line-height: 1;
}

/* Avatar Border Styling */
.avatar-border-wrapper {
    position: relative;
    display: inline-block;
    align-self: flex-start;
    line-height: 0;
}

.avatar-border-base {
    position: relative;
    z-index: 2;
}

.avatar-border-overlay {
    position: absolute;
    top: 52%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 130%;
    height: 130%;
    pointer-events: none;
    z-index: 5;
}

/* =========================================================
   Reply Composer (shared — used on home + single post)
   ========================================================= */

.reply-form {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.reply-textarea-wrap {
    position: relative;
    margin-bottom: 8px;
}

.reply-textarea {
    width: 100%;
    box-sizing: border-box;
    padding-bottom: 26px;
    /* room for inline counter */
    resize: none;
    min-height: 64px;
    max-height: 200px;
    font-size: 0.95rem;
    overflow-y: auto;
    field-sizing: content;
    /* auto-grow when supported */
}

.reply-char-counter {
    position: absolute;
    bottom: 9px;
    right: 10px;
    font-size: 0.73rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s;
    background: transparent;
    line-height: 1;
}

.reply-char-counter.counter-warning {
    color: #ffb845;
}

.reply-char-counter.counter-danger {
    color: #ff4545;
    font-weight: 700;
}

/* Image previews row — constrained thumbnails */
.reply-image-preview {
    display: none;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.reply-preview-item {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.reply-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.reply-preview-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.65rem;
    transition: background 0.2s;
    line-height: 1;
}

.reply-preview-remove:hover {
    background: rgba(220, 0, 0, 0.85);
}

/* Action row: attach btn + spacer + send btn */
.reply-form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.reply-form-actions-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Pill attach button — matches composer style */
.reply-attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: var(--radius);
    background: rgba(169, 112, 255, 0.1);
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(169, 112, 255, 0.28);
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    user-select: none;
    white-space: nowrap;
}

.reply-attach-btn i {
    font-size: 1rem;
}

.reply-attach-btn:hover {
    background: rgba(169, 112, 255, 0.2);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.reply-submit-btn {
    padding: 7px 14px;
    font-size: 0.9rem;
}

/* =========================================================
   Link Previews Module
   ========================================================= */

.link-preview-wrapper {
    margin-top: 12px;
    max-width: 100%;
}

.link-preview-card {
    display: flex;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.015);
    transition: transform 0.2s ease, border-color 0.2s ease;
    align-items: center;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.link-preview-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.03);
}

.link-preview-card .preview-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.link-preview-card .preview-content {
    padding: 14px;
    flex: 1;
    min-width: 0;
    /* Prevents overflow from long words */
}

.link-preview-card .preview-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-main);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: normal;
}

.link-preview-card .preview-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.link-preview-card .preview-domain {
    font-size: 0.8rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 4px;
    text-transform: lowercase;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: normal;
}

/* Twitch Special Link Preview */
.preview-type-twitch {
    background: linear-gradient(135deg, rgba(145, 70, 255, 0.1), rgba(145, 70, 255, 0.02));
    border-color: rgba(145, 70, 255, 0.3);
}

.preview-type-twitch:hover {
    border-color: rgba(145, 70, 255, 0.6);
    background: linear-gradient(135deg, rgba(145, 70, 255, 0.15), rgba(145, 70, 255, 0.05));
}

.twitch-preview-content {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.twitch-logo {
    width: 80px;
    background: #9146FF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    flex-shrink: 0;
}

.twitch-info {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.twitch-info .preview-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: normal;
}

.twitch-info .preview-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: normal;
}

.twitch-info .preview-btn {
    align-self: flex-start;
    background: #9146FF;
    color: white;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    transition: background 0.2s;
}

.preview-type-twitch:hover .preview-btn {
    background: #772ce8;
}

/* Mobile responsive adjustments */
@media (max-width: 600px) {
    .link-preview-card:not(.preview-type-twitch) {
        flex-direction: column;
        align-items: stretch;
    }

    .link-preview-card:not(.preview-type-twitch) .preview-img {
        width: 100%;
        height: 150px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .twitch-preview-content {
        flex-direction: row;
    }

    .twitch-logo {
        width: 60px;
        font-size: 2rem;
    }
}

/* =========================================================
   Twitch Clean Theme - Component Overrides
   ========================================================= */

body.theme-twitch-clean .post-card,
body.theme-twitch-clean .post-card.glass,
body.theme-twitch-clean .profile-post-card.glass,
body.theme-twitch-clean .community-card.glass,
body.theme-twitch-clean .collab-card.glass,
body.theme-twitch-clean .connections-list.glass {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    border-radius: 0 !important;
    border-bottom: 1px solid var(--border) !important;
    margin-bottom: 0 !important;
    padding: 16px !important;
    /* Ensure consistent padding to edge */
}

body.theme-twitch-clean .post-composer,
body.theme-twitch-clean .post-composer.glass {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    border-radius: 0 !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 16px !important;
}

body.theme-twitch-clean .reply-item-container {
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

/* For context threads added previously */
body.theme-twitch-clean .parent-post-preview {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Home Feed & Composer CSS */

.composer-user-info {
    margin-bottom: 12px;
}

.composer-user-name {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Textarea wrapper with inline char counter */
.composer-textarea-wrap {
    position: relative;
}

.composer-textarea-wrap textarea {
    width: 100%;
    box-sizing: border-box;
    padding-bottom: 28px;
    /* room for counter */
    resize: vertical;
    min-height: 80px;
}

.composer-char-counter {
    position: absolute;
    bottom: 10px;
    right: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s;
}

.composer-char-counter.counter-warning {
    color: #ffb845;
}

.composer-char-counter.counter-danger {
    color: #ff4545;
    font-weight: 700;
}

/* =========================================================
   Unified Composer Action Controls
   ========================================================= */

/* Shared pill base — used by Photo btn, dropdown trigger */
.composer-pill-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    /* pill shape */
    background: rgba(169, 112, 255, 0.08);
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(169, 112, 255, 0.22);
    transition: background 0.18s, border-color 0.18s, transform 0.14s;
    user-select: none;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1;
}

.composer-pill-btn i {
    font-size: 1.05rem;
    line-height: 1;
}

.composer-pill-btn:hover {
    background: rgba(169, 112, 255, 0.18);
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Caret rotates when open */
.composer-dropdown-caret {
    font-size: 0.8rem !important;
    margin-left: 2px;
    transition: transform 0.2s ease;
}

.composer-dropdown.open .composer-dropdown-caret {
    transform: rotate(-180deg);
}

/* Dropdown wrapper — positioning context */
.composer-dropdown {
    position: relative;
}

/* Dropdown menu panel */
.composer-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    /* opens downward */
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
    min-width: 340px;
    max-height: 250px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    z-index: 500;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Scrollbar styling for dropdown */
.composer-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.composer-dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}

.composer-dropdown-menu::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 4px;
}

.composer-dropdown.open .composer-dropdown-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.composer-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.composer-dropdown-item i {
    font-size: 1rem;
    color: var(--text-muted);
    width: 18px;
    text-align: center;
}

.composer-dropdown-item:hover {
    background: var(--surface-hover);
}

.composer-dropdown-item.active {
    color: var(--primary);
}

.composer-dropdown-item.active i {
    color: var(--primary);
}

/* Add small rounding to items in the grid */
.composer-dropdown-item {
    border-radius: 4px;
}

/* Post submit button — distinct primary action */
.composer-post-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 20px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.18s, transform 0.14s, box-shadow 0.18s;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.composer-post-btn i {
    font-size: 1.05rem;
}

.composer-post-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(169, 112, 255, 0.35);
}

/* Legacy attach btn alias kept for reply composer */
.composer-attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    background: rgba(169, 112, 255, 0.12);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(169, 112, 255, 0.3);
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    user-select: none;
}

.composer-attach-btn i {
    font-size: 1.1rem;
}

.composer-attach-btn:hover {
    background: rgba(169, 112, 255, 0.22);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.composer-actions-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.composer-select {
    width: auto;
    padding: 6px;
}

.composer-extra-fields {
    margin-top: 12px;
    border-top: 1px dashed var(--border);
    padding-top: 12px;
}

.composer-guest-card {
    text-align: center;
    padding: 40px 20px;
}

.composer-guest-title {
    margin-top: 0;
}

.composer-guest-text {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.feed-stream-container {
    margin-top: 16px;
}

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

.feed-loading-icon {
    font-size: 2rem;
}

.composer-drag-over {
    border-color: var(--primary) !important;
    background-color: rgba(169, 112, 255, 0.05) !important;
    box-shadow: 0 0 0 2px rgba(169, 112, 255, 0.3) inset;
    transition: all 0.2s ease;
}

/* UTILITY CLASSES */
.width-full {
    width: 100%;
}

.display-none {
    display: none !important;
}

.display-flex {
    display: flex;
}

.margin-0 {
    margin: 0;
}

.margin-bottom-24 {
    margin-bottom: 24px;
}

.margin-bottom-20 {
    margin-bottom: 20px;
}

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

.margin-bottom-15 {
    margin-bottom: 15px;
}

.margin-bottom-12 {
    margin-bottom: 12px;
}

.margin-bottom-8 {
    margin-bottom: 8px;
}

.margin-bottom-4 {
    margin-bottom: 4px;
}

.margin-top-4 {
    margin-top: 4px;
}

.margin-top-8 {
    margin-top: 8px;
}

.margin-top-0 {
    margin-top: 0;
}

.margin-right-8 {
    margin-right: 8px;
}

.margin-right-16 {
    margin-right: 16px;
}

.padding-40 {
    padding: 40px;
}

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

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

.text-decoration-none {
    text-decoration: none;
}

.color-inherit {
    color: inherit;
}

.color-danger {
    color: #ff4545;
}

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

.color-primary {
    color: var(--primary);
}

.color-success {
    color: #00e676;
}

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

.justify-content-center {
    justify-content: center;
}

.justify-content-start {
    justify-content: flex-start;
}

.opacity-60 {
    opacity: 0.6;
}

.cursor-pointer {
    cursor: pointer;
}

.cursor-not-allowed {
    cursor: not-allowed;
}

.gap-8 {
    gap: 8px;
}

.font-weight-600 {
    font-weight: 600;
}

.font-weight-bold {
    font-weight: bold;
}

.font-size-3rem {
    font-size: 3rem;
}

.font-size-2rem {
    font-size: 2rem;
}

.font-size-1-1rem {
    font-size: 1.1rem;
}

.box-sizing-border-box {
    box-sizing: border-box;
}

.appearance-auto {
    appearance: auto;
}

.resize-vertical {
    resize: vertical;
}

.live-badge-sm {
    font-size: 0.55rem;
    padding: 1px 3px;
}

.live-badge-md {
    font-size: 0.6rem;
    padding: 2px 6px;
}

.empty-state-container {
    padding: 40px;
    text-align: center;
    border-radius: var(--radius);
}

.margin-bottom-negative-15 {
    margin-bottom: -15px;
}

.margin-top-15 {
    margin-top: 15px;
}

.flex-direction-column {
    flex-direction: column;
}

.color-text-main {
    color: var(--text-main) !important;
}

.badge-outline-primary {
    text-transform: uppercase;
    font-size: 0.75rem;
    border: 1px solid var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
}

/* =========================================================
   Poll Component
   ========================================================= */

.poll-container {
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 15px;
}

.poll-option-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.poll-option-label:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.poll-option-text {
    font-size: 0.95rem;
    color: var(--text-main);
    word-break: break-word;
}

.poll-result-bar {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    overflow: hidden;
    min-height: 40px;
}

.poll-result-selected {
    border-color: var(--primary);
}

.poll-result-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: rgba(169, 112, 255, 0.25);
    transition: width 0.5s ease-in-out;
}

.poll-result-selected .poll-result-fill {
    background: rgba(169, 112, 255, 0.4);
}

.poll-result-text {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    font-size: 0.95rem;
    color: var(--text-main);
    z-index: 1;
}

.poll-opt-name {
    font-weight: 500;
}

.poll-vote-btn {
    width: 100%;
    margin-top: 5px;
    font-weight: 600;
}

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


/* Premium Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 15, 20, 0.95);
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    line-height: 1.4;
}

[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: 112%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border: 6px solid transparent;
    border-top-color: rgba(15, 15, 20, 0.95);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 1000;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Delay Tooltip Slightly for better UX */
[data-tooltip]:hover::after {
    transition-delay: 0.1s;
}

[data-tooltip]:hover::before {
    transition-delay: 0.1s;
}

/* =========================================================
   Post Editing — Edit Badge, History Dropdown & Edit Modal
   ========================================================= */

/* ── Post header right-side cluster (time + edited badge) ── */
.post-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Edited clock badge ──────────────────────────────────── */
.post-edited-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 6px;
    transition: background 0.18s, color 0.18s;
    user-select: none;
}

.post-edited-badge:hover {
    background: rgba(169, 112, 255, 0.12);
    color: var(--primary);
}

.post-edited-badge i {
    font-size: 0.9rem;
}

.post-edited-label {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ── Edit history dropdown panel ─────────────────────────── */
.post-edit-history-dropdown {
    display: none;
    position: fixed;
    /* JS sets top/right dynamically */
    min-width: 300px;
    max-width: 360px;
    max-height: 380px;
    overflow-y: auto;
    background: rgba(18, 18, 28, 0.97);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(16px);
    z-index: 99999;
    padding: 8px 0;
}

.post-edit-history-dropdown.open {
    display: block;
    animation: dropdownFadeIn 0.18s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.edit-history-header {
    padding: 8px 14px 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.edit-history-loading {
    padding: 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ── Individual version card ─────────────────────────────── */
.edit-history-version {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: default;
    transition: background 0.15s;
}

.edit-history-version:last-child {
    border-bottom: none;
}

.edit-history-version:hover {
    background: rgba(255, 255, 255, 0.03);
}

.edit-history-version-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}

.edit-history-version-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.edit-history-version-date {
    font-size: 0.73rem;
    color: var(--text-muted);
}

.edit-history-version-preview {
    font-size: 0.88rem;
    color: var(--text-main);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: pre-wrap;
    margin-bottom: 4px;
}

.edit-history-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.edit-history-chip {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.edit-history-chip-img {
    background: rgba(169, 112, 255, 0.15);
    color: var(--primary);
}

.edit-history-chip-poll {
    background: rgba(23, 191, 99, 0.15);
    color: #17bf63;
}

.edit-history-chip-no-poll {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

/* ── Edit action button (pencil) ─────────────────────────── */
.post-action-edit {
    color: var(--text-muted);
    margin-left: auto;
}

.post-action-edit:hover {
    color: var(--primary);
}

/* ── Edit Post Modal ─────────────────────────────────────── */
.edit-post-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.edit-post-modal-overlay.open {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.edit-post-modal-card {
    background: rgba(18, 18, 28, 0.98);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    width: 95%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.94) translateY(12px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.edit-post-modal-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.edit-post-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-post-modal-title i {
    color: var(--primary);
}

.edit-post-modal-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.3rem;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}

.edit-post-modal-close:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

.edit-post-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.edit-post-textarea-wrap {
    position: relative;
}

.edit-post-textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 100px;
    max-height: 260px;
    resize: none;
    font-size: 1rem;
    line-height: 1.5;
    padding-bottom: 26px;
    overflow-y: auto;
    field-sizing: content;
}

.edit-post-char-counter {
    position: absolute;
    bottom: 9px;
    right: 10px;
    font-size: 0.73rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s;
}

.edit-post-char-counter.counter-warning {
    color: #ffb845;
}

.edit-post-char-counter.counter-danger {
    color: #ff4545;
    font-weight: 700;
}

/* Existing image thumbnails inside modal */
.edit-post-images-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.edit-post-images-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.edit-post-images-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.edit-post-img-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.edit-post-img-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.edit-post-img-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(0, 0, 0, 0.72);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.65rem;
    transition: background 0.2s;
}

.edit-post-img-remove:hover {
    background: rgba(220, 0, 0, 0.85);
}

.edit-post-add-images-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius);
    background: rgba(169, 112, 255, 0.1);
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(169, 112, 255, 0.28);
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
}

.edit-post-add-images-label:hover {
    background: rgba(169, 112, 255, 0.2);
    border-color: var(--primary);
}

/* Poll section inside edit modal */
.edit-post-poll-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.edit-poll-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.edit-poll-toggle-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 7px;
}

.edit-poll-toggle-label i {
    color: var(--primary);
}

/* Toggle switch reuse */
.edit-poll-toggle {
    position: relative;
    width: 42px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}

.edit-poll-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.edit-poll-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    transition: background 0.25s;
}

.edit-poll-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s;
}

.edit-poll-toggle input:checked+.edit-poll-slider {
    background: var(--primary);
}

.edit-poll-toggle input:checked+.edit-poll-slider::before {
    transform: translateX(18px);
}

.edit-poll-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.edit-poll-note {
    font-size: 0.78rem;
    color: #ffb845;
    display: flex;
    align-items: flex-start;
    gap: 5px;
    line-height: 1.4;
}

.edit-poll-options-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.edit-poll-option-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-poll-option-input {
    flex: 1;
    font-size: 0.9rem;
    padding: 7px 10px;
}

.edit-poll-option-remove {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
    flex-shrink: 0;
}

.edit-poll-option-remove:hover {
    color: #ff4545;
    background: rgba(255, 0, 0, 0.08);
}

.edit-poll-add-option-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px 0;
    transition: opacity 0.15s;
}

.edit-poll-add-option-btn:hover {
    opacity: 0.75;
}

.edit-poll-meta-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.edit-poll-meta-row select,
.edit-poll-meta-row input[type="datetime-local"] {
    flex: 1;
    min-width: 130px;
    font-size: 0.85rem;
    padding: 7px 10px;
}

/* Modal footer */
.edit-post-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.edit-post-cancel-btn {
    padding: 8px 18px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.edit-post-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.edit-post-save-btn {
    padding: 8px 22px;
    font-size: 0.9rem;
}

.edit-post-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}