/* setup/static/assets/css/layout.css */

.ui-autocomplete {
    width: 100% !important;
    z-index: 9999 !important;
}

#myBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 99;
    font-size: 18px;
    border: none;
    outline: none;
    background-color: var(--amber);
    color: black;
    cursor: pointer;
    padding: 15px;
    border-radius: 20px;
}
#myBtn:hover {
    color: var(--amber);
    background-color: var(--navy-mid);
    border-radius: 20px;
}

/* Search modal */
#search-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
}
#search-modal-overlay.active { opacity: 1; pointer-events: auto; }

#search-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -48%);
    width: 92%; max-width: 640px;
    z-index: 10001;
    box-shadow: 0 8px 32px rgba(0,0,0,.35);
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}
#search-modal.active { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }

#search-modal-header {
    background: linear-gradient(var(--navy-deep), var(--navy-mid));
    padding: 14px 18px;
    display: flex; align-items: center; justify-content: space-between;
    border-radius: 10px 10px 0 0;
}
#search-modal-header h5 {
    margin: 0; color: #fff; font-size: 1rem; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}
#search-modal-close {
    background: none; border: none; color: #fff;
    font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0 4px; opacity: .8;
}
#search-modal-close:hover { opacity: 1; }

#search-modal-body { background: #fff; padding: 22px 20px 18px; }
#modal-search-input {
    width: 100%; padding: 10px 14px; font-size: 1rem;
    border: 2px solid var(--navy-mid); border-radius: 6px;
    outline: none; box-sizing: border-box;
}
#modal-search-input:focus { box-shadow: 0 0 0 3px rgba(0,63,115,.18); }

#search-modal-footer {
    background: #f5f7fa; padding: 10px 20px;
    display: flex; justify-content: flex-end;
    border-top: 1px solid #e0e0e0; border-radius: 0 0 10px 10px;
}
#search-modal-close-btn {
    background: var(--navy-mid); color: #fff; border: none;
    padding: 7px 22px; border-radius: 5px; font-size: .9rem;
    cursor: pointer; transition: background .2s;
}
#search-modal-close-btn:hover { background: #fff; color: var(--navy-mid); }

/* loading state — subtle spinner on the right edge of the input */
#modal-search-input.is-loading {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 50 50'%3E%3Cpath fill='%23003f73' d='M25 5a20 20 0 0 1 20 20h-5a15 15 0 0 0-15-15z'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='0.7s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
}

/* Custom results list (no jQuery UI widget) — plain document flow, no
   position:absolute, so it can't get caught in stacking-context/transform
   edge cases with the modal that sits above it. */
.search-ac-dropdown {
    display: none;
    max-height: 320px; overflow-y: auto; overflow-x: hidden;
    margin: 6px 0 0; padding: 4px 0;
    border: 1px solid #dfe5ec;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0,29,58,.18);
    background: #fff;
    list-style: none;
}
.search-ac-dropdown.open { display: block; }

.search-result-item { list-style: none; cursor: pointer; }
.search-result-item .search-result-row { padding: 8px 14px; }
.search-result-item.active .search-result-row,
.search-result-item:hover .search-result-row {
    background: #eef4fb;
}
.search-result-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.search-result-symbol {
    flex: 0 0 auto; min-width: 58px; text-align: center;
    background: var(--navy-mid); color: #fff;
    font-weight: 700; font-size: .78rem; letter-spacing: .03em;
    padding: 3px 8px; border-radius: 4px;
}
.search-result-name {
    flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: #33404e;
}
.search-result-name mark {
    background: rgba(255,191,0,.35); color: inherit; padding: 0 1px; border-radius: 2px;
}
.search-result-tag {
    flex: 0 0 auto; font-size: .7rem; color: #66788c;
    background: #f1f4f8; border: 1px solid #e2e8f0;
    padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}

/* footer hints */
#search-modal-footer { justify-content: space-between; align-items: center; }
.search-modal-hints { font-size: .74rem; color: #66788c; }
.search-modal-hints kbd {
    background: #fff; border: 1px solid #d4dbe3; border-bottom-width: 2px;
    border-radius: 4px; padding: 1px 5px; font-size: .7rem; color: #33404e;
}
@media (max-width: 575px) { .search-modal-hints { display: none; } }
