/* ⌘F in a note (Phase 7c, mockup A): a bar floating top right that doesn't push the text down */
.note-find-bar {
    position: absolute;
    right: 20px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 4px;
    width: 380px;
    height: 44px;
    padding: 0 6px 0 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-medium, rgba(0, 0, 0, 0.12));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    animation: noteFindIn var(--duration-fast) var(--ease-in-out);
}
/* The daily note scrolls as a whole: stay under its heading, taking no room */
.note-find-bar.sticky {
    position: sticky;
    top: 12px;
    align-self: flex-end;
    margin: 0 -4px -44px 0;
}
@keyframes noteFindIn {
    from { opacity: 0; transform: translateY(-4px); }
}
.note-find-field {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 8px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1.5px solid transparent;
    cursor: text;
}
.note-find-field:focus-within { border-color: var(--accent-blue, #4A90D9); }
.note-find-bar.none .note-find-field { border-color: var(--color-red); }
.note-find-field input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}
.note-find-bar svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.note-find-field svg { width: 15px; height: 15px; color: var(--text-tertiary); }
.note-find-count {
    padding: 0 4px;
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.note-find-bar button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-in-out);
}
.note-find-bar button:hover { background: var(--bg-hover, rgba(0, 0, 0, 0.05)); color: var(--text-primary); }

/* The matches: the CSS Custom Highlight API, or boxes on WebKit before macOS 14.2 */
::highlight(note-find) { background-color: #FFE58A; color: inherit; }
::highlight(note-find-current) { background-color: #FFB547; color: inherit; }
.note-find-layer { position: relative; height: 0; pointer-events: none; }
.note-find-box {
    position: absolute;
    border-radius: var(--radius-sm);
    background: rgba(255, 213, 79, 0.45);
    mix-blend-mode: multiply;
}
.note-find-box.current { background: rgba(255, 160, 40, 0.6); }

@media (prefers-reduced-motion: reduce) {
    .note-find-bar { animation: none; }
}
[data-theme="dark"] .note-find-bar { box-shadow: var(--shadow-2); }
[data-theme="dark"] ::highlight(note-find) { background-color: rgba(255, 213, 79, 0.35); }
[data-theme="dark"] ::highlight(note-find-current) { background-color: rgba(255, 160, 40, 0.65); }
[data-theme="dark"] .note-find-box { mix-blend-mode: screen; background: rgba(255, 213, 79, 0.3); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .note-find-bar { box-shadow: var(--shadow-2); }
    :root:not([data-theme="light"]) ::highlight(note-find) { background-color: rgba(255, 213, 79, 0.35); }
    :root:not([data-theme="light"]) ::highlight(note-find-current) { background-color: rgba(255, 160, 40, 0.65); }
    :root:not([data-theme="light"]) .note-find-box { mix-blend-mode: screen; background: rgba(255, 213, 79, 0.3); }
}

/* The footer's word count, after "Updated …" */
.note-modal-footer .note-meta { margin-right: 0; }
.note-modal-footer .note-word-count {
    order: -1;
    margin-right: auto;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}
.note-modal-footer .note-word-count:not(:empty)::before {
    content: "·";
    margin-right: 8px; /* the footer's gap spaces its left */
    color: var(--text-tertiary);
}
