/* ==========================================================================
   Search modal — v2 styling
   --------------------------------------------------------------------------
   Matches the visual language of auth_v2 / profile_v2:
     • 12 px card radius, 8 px input/button radius
     • #245494 accent with a 3 px focus ring at 0.15 alpha
     • Soft drop shadow, off-white backdrop tint
     • Neutral text scale (#111827 / #6B7280 / #9CA3AF)
   All rules are scoped under `.search-v2` so they don't leak onto other
   modals that still use the old .modal-box styling from style.css.
   ========================================================================== */

/* -------------------------------------------------------------------------- */
/* Overlay + card                                                             */
/* -------------------------------------------------------------------------- */
.search-v2.modal {
    background-color: rgba(15, 23, 42, 0.55);
}

.search-v2 .modal-box {
    width: 640px;
    max-width: calc(100% - 32px);
    padding: 32px 32px 28px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
    /* Kill the drop-shadow filter inherited from .modal .modal-box — it
       clips children (our focus rings) because filter creates a containing
       block. box-shadow above replaces it. */
    -webkit-filter: none;
    filter: none;
}
@media (max-width: 768px) {
    .search-v2 .modal-box {
        padding: 24px 20px 20px;
        border-radius: 10px;
    }
}

/* -------------------------------------------------------------------------- */
/* Close button                                                               */
/* Reset native <button> defaults first — the browser border was leaking      */
/* through the modal's rounded corner and looked "rough".                     */
/* -------------------------------------------------------------------------- */
.search-v2 .modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #6B7280;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.search-v2 .modal-close:hover {
    background: #F3F4F6;
    color: #111827;
}
.search-v2 .modal-close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(36, 84, 148, 0.15);
}
.search-v2 .modal-close svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* -------------------------------------------------------------------------- */
/* Title + body layout                                                        */
/* -------------------------------------------------------------------------- */
.search-v2 .modal-body {
    width: 100%;
    display: block;
}

.search-v2-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 16px;
    letter-spacing: -0.01em;
}

/* -------------------------------------------------------------------------- */
/* Search field (icon + input)                                                */
/* -------------------------------------------------------------------------- */
.search-v2-form { width: 100%; margin: 0; }

/* Input + submit button sit side-by-side. Stack on narrow screens so the
   button doesn't get squeezed below its legible minimum. */
.search-v2-input-group {
    display: flex;
    flex-direction: row;
    gap: 8px;
    width: 100%;
}
@media (max-width: 480px) {
    .search-v2-input-group { flex-direction: column; gap: 10px; }
}

.search-v2-field {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}
.search-v2-field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: #9CA3AF;
    pointer-events: none;
}

/* Input — match auth_v2 focus ring exactly */
.search-v2-field input {
    width: 100%;
    height: 44px;
    padding: 0 44px 0 44px;
    font-size: 15px;
    color: #111827;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.search-v2-field input::placeholder { color: #9CA3AF; }
.search-v2-field input:focus {
    border-color: #245494;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(36, 84, 148, 0.15);
}
/* Hide native search-input clear button — the modal close button covers it */
.search-v2-field input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

/* Submit button — matches the "View all results" button below so the
   modal reads as a coherent search surface, not a field with a stray CTA. */
.search-v2-submit {
    flex: 0 0 auto;
    height: 44px;
    padding: 0 20px;
    background: #245494;
    color: #ffffff;
    border: 1px solid #245494;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s, transform 0.08s;
}
.search-v2-submit:hover {
    background: #1E4A84;
    border-color: #1E4A84;
    box-shadow: 0 2px 8px rgba(36, 84, 148, 0.3);
}
.search-v2-submit:active { transform: translateY(1px); }
.search-v2-submit:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(36, 84, 148, 0.25);
}

/* -------------------------------------------------------------------------- */
/* Loader                                                                     */
/* -------------------------------------------------------------------------- */
/* Three bouncing dots. jQuery's slideDown sets inline display:block after the
   animation, so we use inline-block children + text-align instead of flex
   (flex would be clobbered by the inline display:block). */
#search_news_loader_indicator.search-v2-loader {
    height: 28px;
    margin-top: 14px;
    text-align: center;
    font-size: 0;
    line-height: 28px;
}
.search-v2-loader span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin: 0 3px;
    border-radius: 50%;
    background: #245494;
    vertical-align: middle;
    animation: search-v2-bounce 1.1s infinite ease-in-out both;
}
.search-v2-loader span:nth-child(1) { animation-delay: -0.32s; }
.search-v2-loader span:nth-child(2) { animation-delay: -0.16s; }
@keyframes search-v2-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.35; }
    40%           { transform: scale(1);   opacity: 1;    }
}

/* -------------------------------------------------------------------------- */
/* Results                                                                    */
/* -------------------------------------------------------------------------- */
.search-v2 .modalSearchResults {
    width: 100%;
    margin-top: 16px;
}

/* Empty state */
.search-v2-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 12px 12px;
    color: #6B7280;
    text-align: center;
}
.search-v2-empty svg {
    width: 40px;
    height: 40px;
    color: #D1D5DB;
    margin-bottom: 10px;
}
.search-v2-empty-text { margin: 0; font-size: 14px; }

/* List of results. No internal scroll — `.modal-box` already provides
   `max-height: 90vh; overflow-y: auto`, so long result sets scroll the
   whole card naturally (one scroll context instead of two nested ones). */
.search-v2 .search-v2-list {
    margin: 4px 0 16px;
    padding: 0;
    list-style: none;
    display: block;
}
.search-v2 .search-v2-list li {
    padding: 0;
    display: block;
}

.search-v2-item + .search-v2-item {
    border-top: 1px solid #F3F4F6;
}
.search-v2-item-link {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s;
}
.search-v2-item-link:hover {
    background: #F9FAFB;
    text-decoration: none;
    color: inherit;
}
.search-v2-item-body {
    flex: 1 1 auto;
    min-width: 0;
}
.search-v2-item-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: #111827;
    margin: 0 0 6px;
    /* Clamp to two lines — long titles stay tidy in the narrow list. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.search-v2-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: #6B7280;
}
.search-v2-item-meta .genres { color: #245494; }

.search-v2-item-image {
    width: 96px;
    flex: 0 0 96px;
    border-radius: 6px;
    overflow: hidden;
    background: linear-gradient(45deg, #ffffff 0%, #F3F4F6 50%, #E5E7EB 100%);
}
.search-v2-item-image img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 320/220;
    object-fit: cover;
}
@media (max-width: 480px) {
    .search-v2-item-image { width: 72px; flex-basis: 72px; }
}

/* -------------------------------------------------------------------------- */
/* "View all results" button                                                  */
/* -------------------------------------------------------------------------- */
.search-v2 .search-v2-all-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 44px;
    padding: 0 16px;
    background: #245494;
    color: #ffffff;
    border: 1px solid #245494;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s, transform 0.08s;
}
.search-v2 .search-v2-all-btn:hover {
    background: #1E4A84;
    border-color: #1E4A84;
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(36, 84, 148, 0.3);
}
.search-v2 .search-v2-all-btn:active {
    transform: translateY(1px);
}
.search-v2-all-count {
    font-weight: 600;
    font-size: 13px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 10px;
}
