/* ── Hashtag Autocomplete Dropdown ─────────────────────────────────── */

.hashtag-dropdown {
    display: none;
    position: fixed;
    z-index: 10002;
    width: 280px;
    background: var(--modal-bg, #000);
    border: 1px solid var(--border-color, #2f3336);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    padding: 4px 0;
    animation: hashtagFadeIn 0.12s ease;
}

@keyframes hashtagFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Saat dropdown muncul ke atas, animasi dari bawah ke atas */
.hashtag-dropdown--above {
    animation: hashtagFadeInUp 0.12s ease;
}

@keyframes hashtagFadeInUp {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hashtag-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.12s;
}

.hashtag-item:hover,
.hashtag-item-active {
    background: var(--card-hover, rgba(255,255,255,0.08));
}

.hashtag-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color, #1d9bf0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hashtag-icon i {
    font-size: 18px;
    color: #fff;
}

.hashtag-new .hashtag-icon {
    background: var(--text-muted, #71767b);
}

.hashtag-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.hashtag-tag {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main, #e7e9ea);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hashtag-count {
    font-size: 13px;
    color: var(--text-muted, #71767b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Light mode */
body.light-mode .hashtag-dropdown {
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

body.light-mode .hashtag-item:hover,
body.light-mode .hashtag-item-active {
    background: rgba(0, 0, 0, 0.05);
}

/* ── Hashtag Rich Editor (contenteditable) ───────────────────────────── */

.hashtag-rich-editor {
    display: block;
    width: 100%;
    min-height: 24px;
    outline: none;
    background: transparent;
    color: var(--text-main, #e7e9ea);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 20px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    caret-color: var(--text-main, #e7e9ea);
    cursor: text;
    resize: none;
    border: none;
    padding-top: 10px;
    margin-bottom: 2px;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .hashtag-rich-editor {
        font-size: 17px;
        min-height: 40px;
    }
}

/* Placeholder menggunakan ::before */
.hashtag-rich-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted, #71767b);
    pointer-events: none;
}

.hashtag-rich-editor:focus {
    outline: none;
}

/* Warna hashtag yang di-highlight */
.hashtag-highlighted {
    color: var(--primary-color, #1d9bf0);
    font-weight: inherit;
    background: transparent;
    cursor: text;
    user-select: text;
    -webkit-user-select: text;
}

/* Light mode */
html[data-theme="light"] .hashtag-rich-editor,
body.light-mode .hashtag-rich-editor {
    color: var(--text-main, #0f1419);
    caret-color: var(--text-main, #0f1419);
}

html[data-theme="light"] .hashtag-rich-editor:empty::before,
body.light-mode .hashtag-rich-editor:empty::before {
    color: var(--text-muted, #536471);
}

html[data-theme="light"] .hashtag-highlighted,
body.light-mode .hashtag-highlighted {
    color: var(--primary-color, #1d9bf0);
}

/* ── Mention highlight (di dalam overlay maupun contenteditable) ─────── */
.mention-highlighted {
    color: var(--primary-color, #1d9bf0);
    font-weight: inherit;
    background: transparent;
    cursor: text;
    user-select: text;
    -webkit-user-select: text;
}

html[data-theme="light"] .mention-highlighted,
body.light-mode .mention-highlighted {
    color: var(--primary-color, #1d9bf0);
}

/* ── Textarea Highlight Overlay ──────────────────────────────────────── */
/* Wrapper yang membungkus textarea + overlay div */
.textarea-highlight-wrap {
    position: relative;
    display: block;
    width: 100%;
}

/*
 * Overlay div: diposisikan di belakang textarea, hanya visual.
 * Tidak menerima event mouse/keyboard (pointer-events: none).
 * Harus identik ukuran, padding, font dengan textarea.
 */
.textarea-highlight-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: var(--text-main, #e7e9ea); /* warna teks normal agar teks biasa tetap terbaca */
    background: transparent;
    /* font/padding/lineheight akan di-set via JS agar identik dengan textarea */
    box-sizing: border-box;
    z-index: 0;
}

/* Light mode: samakan warna teks overlay dengan tema terang */
html[data-theme="light"] .textarea-highlight-bg,
body.light-mode .textarea-highlight-bg {
    color: var(--text-main, #0f1419);
}

/* Textarea di atas overlay — teks transparan agar overlay "tembus" */
.textarea-highlight-wrap > textarea {
    position: relative;
    z-index: 1;
    background: transparent !important;
    color: transparent !important;
    caret-color: var(--text-main, #e7e9ea) !important;
    resize: none;
}

/* Light mode caret */
html[data-theme="light"] .textarea-highlight-wrap > textarea,
body.light-mode .textarea-highlight-wrap > textarea {
    caret-color: var(--text-main, #0f1419) !important;
}