/* ================= ROOT ================= */

#bible-reader{
    border: 1px solid var(--outline, #ccc);
    border-radius: var(--radius-reader, 8px);
}
.br-reader {
    position: relative; /* Positioning context for search results */
    overflow-anchor: none;
}

/* ================= HEADER ================= */

.br-header{
    padding: 2px;
    border-radius: 15px;
}

.br-top{
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.br-logo{
    height: 50px;
}

.br-logo.left{ margin-left: 15px; }
.br-logo.right{ margin-right: 15px; }

/*#br-version{
    min-width: 110px;
}*/

/* ================= TOOLS ROW ================= */

.br-tools{
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 5px;
    background: var(--header-bg);
}

/* ================= SEARCH (PILL) ================= */

.br-search-wrap{
    position: relative;
    display: flex;
    align-items: center;
    width: 300px;
    max-width: 85vw;
    background: #fff;
    border-radius: 999px;
    border: 1px solid #ccc;
}

/* input */
#br-search{
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 8px 38px 8px 36px; /* room for X and icon */
    font-size: 14px;
    border-radius: 999px;
    cursor: text; /* keep normal typing cursor */
}

/* clear X (LEFT INSIDE) */
#br-search-clear{
    position: absolute;
    left: 12px;
    font-size: 18px;
    line-height: 1;
    color: #C4A403;
    cursor: pointer;
    display: none;
    user-select: none;
}

/* magnifier (RIGHT INSIDE) */
.br-search-icon{
    position: absolute;
    right: 12px;
    color: #C4A403;

    /* UPDATED: allow hover/click on the icon */
    pointer-events: auto;

    display: flex;
    align-items: center;

    /* make sure it sits above the input so it can be clicked */
    z-index: 5;

    /* pointer on hover area */
    cursor: pointer;
}

/* UPDATED: pointer on the SVG itself */
.br-search-icon svg{
    cursor: pointer;
    pointer-events: auto;
}

#br-search:focus{
    outline: none;
    border-color: #EBC714;
}

mark{
    background:#FDF6C9;
    padding:0 2px;
}

/* ===============================
   SEARCH OVERLAY (FLOATING)
   =============================== */

.br-reader{
    position: relative; /* anchor overlay */
}

.br-search-results{
    position: absolute;
    top: 0;
    left: 0;
    right: 0;

    max-height: 35%;
    overflow-y: auto;

    background: var(--pane-bg, #fff);
    border-bottom: 1px solid rgba(0,0,0,0.15);

    z-index: 20;
    padding: 10px;
}

/* when search is active, lock reader scroll */
.br-reader.search-mode{
    overflow: hidden;
}

/* ===============================
   SEARCH RESULTS DIVIDER
   =============================== */

.br-search-results{
    border-bottom: 5px solid #EBC714;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

/* ================= XREF TOGGLE ================= */

/* Toggle wrapper */
.br-xref-toggle{
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
}

.br-xref-toggle input{
    display: none;
}

.br-toggle-slider{
    width: 34px;
    height: 18px;
    background: #ccc;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
}

.br-toggle-slider::after{
    content: '';
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all .2s ease;
}

.br-xref-toggle input:checked + .br-toggle-slider{
    background: #EBC714;
}

.br-xref-toggle input:checked + .br-toggle-slider::after{
    transform: translateX(16px);
}

/* ================= READER ================= */

.br-reader{
    padding: 12px;
    overflow-y: auto;
    position: relative;
    min-height: 700px;
    max-height: 85vh;

    /* visual */
    background: var(--pane-bg, #fafafa);
    color: var(--text, #222);
}

.br-reader sup{
    font-size: 0.7em;
}

.br-reader .br-verse.active{
    background: var(--highlight, #fff3b0);
}

@media (max-width: 768px){
    .br-reader{
        height: 60vh;
        max-height: 60vh;
    }
}

/* ================= STRONGS ================= */

.br-strongs{
    color: #2b6cb0;
    cursor: pointer;
    font-size: 0.75em;
}

.br-strongs-tooltip{
    position: absolute;
    background: #FBFAF3;
    border: 1px solid #EBC714;
    padding: 10px;
    max-width: 400px;
    font-size: 14px;
    line-height: 1.2;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border-radius: 12px;
}

/* ================= XREF INLINE ================= */

.br-xrefs{
    margin: 6px 0 12px 28px;
    font-size: 13px;
    color: #444;
}

.br-xref{
    cursor: pointer;
    color: #2b6cb0;
}

.br-xdot{
    margin: 0 8px;
    font-size: 16px;
    font-weight: bold;
}

/* ================= XREF POPUP ================= */

.br-xref-popup{
    position: absolute;
    background: #FBFAF3;
    border: 1px solid #EBC714;
    font-size: 14px;
    line-height: 1.3;
    max-width: 400px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    padding: 10px;
    z-index: 9999;
    border-radius: 12px;
    font-weight: 400;
}

.br-xref-header{
    background: #FBF2D0;
    color: #5C5C5C;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 10px;
    margin: -10px -10px 8px -10px;
    border-bottom: 1px solid rgba(0,0,0,0.15);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

/* ================= MOBILE ================= */
@media (max-width: 600px){
    .br-tools{
        flex-direction: column;
        gap: 10px;
    }

    #br-search{
        width: 100%;
    }
}

/* ================= MOBILE SEARCH FIX ================= */
@media (max-width: 600px){

    .br-tools{
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    /* search pill goes full width */
    .br-search-wrap{
        width: 100%;
        max-width: 100%;
    }

    #br-search{
        width: 100%;
        font-size: 16px; /* better mobile typing */
    }

    /* center x-ref toggle below search */
    .br-xref-toggle{
        justify-content: center;
    }
}

/* keep your existing rule (still fine) */
.br-search-icon {
    cursor: pointer;
}
/* Search results are clickable → show pointer cursor */
.br-search-results .search-result{
    cursor: pointer;
}
/* ===============================
   Responsive fix: book/chapter/verse selects
   =============================== */

/* Allow selects to shrink instead of overflowing */
.br-selects{
    min-width: 0;
    flex-wrap: wrap;
}

/* Book select: flexible, collapsible */
#br-book{
    min-width: 0;
    max-width: 100%;
    flex: 1 1 auto;
}

/* Chapter / Verse: smaller, fixed-ish */
#br-chapter,
#br-verse,
#br-version{
    flex: 0 0 auto;
}
/* Mobile: reduce side padding inside the reader */
@media (max-width: 768px) {
    #bible-reader {
        padding-left: 8px;
        padding-right: 8px;
        box-sizing: border-box;
    }
}

