/* =====================================================================
   Hashtag autocomplete + inline highlight
   ──────────────────────────────────────────────────────────────────────
   - .hashtag-suggest         : the floating suggestions dropdown
   - .hashtag-highlight-overlay : the ghost div behind the textarea
   - .hashtag-mark            : the subtle pill behind each #tag
===================================================================== */

/* ─── Suggestions dropdown ────────────────────────────────────────── */
.hashtag-suggest {
    position: absolute;
    z-index: 200;
    min-width: 180px;
    max-width: 260px;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-paper, #fafaf8);
    border: 1px solid var(--border-color, #d0d0d0);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    padding: 4px;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 13px;
    -webkit-overflow-scrolling: touch;
    animation: hashtag-suggest-pop 0.12s ease-out;
}
@keyframes hashtag-suggest-pop {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hashtag-suggest-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1.3;
    transition: background 0.08s ease;
    user-select: none;
}
.hashtag-suggest-item:hover {
    background: rgba(0, 0, 0, 0.05);
}
.hashtag-suggest-item.selected {
    background: var(--accent, #444);
    color: var(--text-light, #fff);
}
.hashtag-suggest-item.selected .hashtag-suggest-count {
    color: rgba(255, 255, 255, 0.7);
}

.hashtag-suggest-tag {
    font-weight: 500;
    word-break: break-all;
}
.hashtag-suggest-count {
    font-size: 11px;
    color: var(--text-muted, #888);
    margin-left: 8px;
    flex-shrink: 0;
}

/* Touch-friendly tap targets on mobile */
@media (max-width: 480px) {
    .hashtag-suggest {
        min-width: 160px;
        font-size: 14px;
    }
    .hashtag-suggest-item {
        padding: 9px 12px;
    }
}

/* ─── Inline highlight overlay ────────────────────────────────────── */
/*
 * The overlay div sits *behind* the textarea and mirrors the text.
 * Text colour is transparent; only the <mark> pills are visible.
 * This gives a subtle "reverse text" cue under every #hashtag.
 */
.hashtag-highlight-overlay {
    /* All typography props are copied from the textarea in JS.
       Just guarantee the wrapping and overflow behave the same. */
    overflow: hidden;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.hashtag-highlight-overlay .hashtag-mark {
    background: rgba(0, 0, 0, 0.07);
    border-radius: 3px;
    padding: 0;          /* keep zero — any padding misaligns the mirror */
    color: transparent;  /* the textarea text shows through */
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* Dark-theme adjustment — slightly stronger pill */
[data-theme="dark"] .hashtag-highlight-overlay .hashtag-mark,
[data-theme="midnight"] .hashtag-highlight-overlay .hashtag-mark {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Make sure the textarea sits above the overlay and is transparent
   so the pill shows through. The JS already sets z-index inline,
   this is a safety net in case CSS specificity changes. */
.input-wrapper textarea,
.edit-form textarea {
    background-color: transparent;
    position: relative;
    z-index: 1;
}

/* Edge case: if a theme sets a textarea bg, we need to push that bg
   onto the wrapper instead so the overlay shows. The .input-wrapper
   already has a paper background in app.css, so this is usually fine. */
