/*
 * Doconut Search Bar — embedded search toolbar (ribbon) styles.
 * Served from the Doconut assembly at /doconut-res/css/searchBar.css.
 *
 * Self-contained: includes the generic panel/form helpers the ribbon uses
 * (.float-panel-header, .panel-close, .fp-*) so a host page only needs to add this one
 * stylesheet. Class names match the markup the component injects (see searchBar.js).
 *
 * Mirrors the Microsoft Word-style ribbon language of annotationBar.css: a full-width
 * horizontal bar that sits below the main toolbar, with grouped controls (FIND | OPTIONS |
 * RESULTS) separated by vertical rules.
 */

/* ── Shared panel chrome (header / close button) ─────────────────────────── */
.float-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: #f1f3f5;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    color: #343a40;
    gap: 6px;
}
.panel-close {
    width: 24px; height: 24px;
    border: none; background: transparent;
    border-radius: 4px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #6c757d; padding: 0;
}
.panel-close:hover { background: #dee2e6; color: #212529; }

/* ── Shared form controls ────────────────────────────────────────────────── */
.fp-btn {
    flex: 1; padding: 5px 8px;
    border: 1px solid #ced4da; border-radius: 4px;
    background: #fff; cursor: pointer;
    font-size: 0.80rem; white-space: nowrap;
    transition: background 0.12s; min-width: 0;
}
.fp-btn:hover:not(:disabled) { background: #e9ecef; }
.fp-btn:disabled { opacity: 0.42; cursor: not-allowed; }
.fp-btn.primary { background: #0d6efd; color: #fff; border-color: #0d6efd; }
.fp-btn.primary:hover:not(:disabled) { background: #0b5ed7; }
.fp-btn.success { background: #198754; color: #fff; border-color: #198754; }
.fp-btn.success:hover:not(:disabled) { background: #157347; }

.fp-input {
    width: 100%; padding: 5px 8px;
    border: 1px solid #ced4da; border-radius: 4px;
    font-size: 0.82rem; outline: none;
}
.fp-input:focus { border-color: #86b7fe; box-shadow: 0 0 0 2px rgba(13,110,253,.15); }
.fp-label {
    display: flex; align-items: center; gap: 6px;
    cursor: pointer; color: #495057; font-size: 0.81rem;
}
.fp-label input[type=checkbox] { margin: 0; cursor: pointer; }

/* ── Search toolbar (ribbon) ─────────────────────────────────────────────── */
#searchToolbar {
    position: static;
    z-index: 900;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
    background: #fff;
    border: 0;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.8rem;
}
#searchToolbar .float-panel-header {
    cursor: default;
    padding: 4px 8px;
    border-radius: 0;
    min-height: 34px;
}
#searchToolbar .search-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* ── Ribbon body / groups ────────────────────────────────────────────────── */
#searchToolbar .search-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 6px 8px 8px;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin;
    scrollbar-color: #adb5bd transparent;
}
#searchToolbar .search-panel-body::-webkit-scrollbar { height: 6px; }
#searchToolbar .search-panel-body::-webkit-scrollbar-track { background: transparent; }
#searchToolbar .search-panel-body::-webkit-scrollbar-thumb {
    background: rgba(108, 117, 125, 0.45);
    border-radius: 999px;
}
#searchToolbar .search-ribbon {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    width: 100%;
    min-width: min-content;
}
#searchToolbar .search-ribbon-group {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    flex: 0 0 auto;
    padding: 0 12px;
    border-right: 1px solid #dee2e6;
}
#searchToolbar .search-ribbon-group:first-child { padding-left: 0; }
#searchToolbar .search-ribbon-group:last-child { border-right: 0; padding-right: 0; }
#searchToolbar .search-ribbon-label {
    color: #6c757d;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    text-transform: uppercase;
}

/* Buttons inside the ribbon must not stretch like the generic .fp-btn default. */
#searchToolbar .fp-btn { flex: 0 0 auto; }

/* FIND group */
#searchToolbar .search-find-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
#searchToolbar .search-input {
    flex: 1 1 auto;
    width: auto;
    min-width: 200px;
}

/* OPTIONS group */
#searchToolbar .search-option { white-space: nowrap; }

/* RESULTS group */
#searchToolbar .search-results-row {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
#searchToolbar .search-counter {
    font-size: 0.82rem;
    color: #6c757d;
    min-width: 92px;
}
#searchToolbar .search-counter.found    { color: #198754; font-weight: 600; }
#searchToolbar .search-counter.notfound { color: #dc3545; font-weight: 600; }
#searchToolbar .search-nav {
    display: inline-flex;
    gap: 4px;
}
#searchToolbar .search-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    padding: 0;
    color: #495057;
}
#searchToolbar .search-limited {
    font-size: 0.76rem;
    color: #856404;
}

/* ── Responsive: keep the ribbon usable on narrow / short screens ─────────── */
@media (max-width: 480px), (max-height: 560px) {
    #searchToolbar .search-panel-body {
        overflow-x: auto;
    }
    #searchToolbar .search-input {
        min-width: 150px;
    }
    #searchToolbar .search-counter {
        min-width: 80px;
    }
}
