/* ============================================================
   Read Page Styles — read_page.css
   Shared stylesheet for the chapter-level Read Page pattern.
   Tool-agnostic: any tool (Morphology, Strong's, Bible Viewer)
   includes this stylesheet when using the Read page layout.
   Uses only CSS variables from common.css.
   ============================================================ */

/* --- Page Container --- */
.read-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 1em 1.5em;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text_color);
    margin-top: var(--menu-bar-height);
}

/* --- Heading (two-line: translation name + book/chapter) --- */
.read-page__heading {
    text-align: center;
    margin-bottom: 1.25em;
    padding-bottom: 0.75em;
    border-bottom: 2px solid var(--border_color);
}

.read-page__heading-line1 {
    display: block;
    font-size: 1em;
    font-weight: 400;
    color: var(--text_subdued);
    margin-bottom: 0.25em;
}

.read-page__heading-line2 {
    display: block;
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text_color);
}

/* --- Controls Row (translation dropdown + font size) --- */
.read-page__controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75em;
    margin-bottom: 1.25em;
    padding: 0.6em 0.75em;
    background-color: var(--callout_fieldset_background);
    border: 1px solid var(--callout_fieldset_border);
    border-radius: 8px;
}

span.select2.select2-container.select2-container--default {
    width: stretch !important;
}

/* Desktop / default layout */
.read-page__controls-left {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex: 1;
    min-width: 200px;
}

/* On desktop, the new row wrapper should behave like the old inline layout */
.read-page__controls-left-row {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex: 1;
}

.read-page__controls-right {
    display: inline-flex;
    flex-direction: column;
    border: 1px solid var(--accent_color_light);
    background: var(--accent_color);
    border-radius: 6px;
    overflow: hidden;
    width: 32px;
}

.read-page__controls-label {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text_color);
    white-space: nowrap;
}

.read-page__font-btn {
    border: none;
    background: var(--accent_color);
    padding: 3px 0;
    font-size: .6em;
    cursor: pointer;
}

/* --- Verse Area (scrollable/expandable container) --- */
.read-page__verse-area {
    min-height: 200px;
    padding: 0.5em 0;
    margin-bottom: 1em;
}

/* --- Individual Verse Block --- */
.read-page__verse-block {
    margin-bottom: 1.25em;
    padding: 0.6em 0.75em;
    border-bottom: 1px solid var(--callout_fieldset_border);
    display: flex;
}

.read-page__verse-block:last-child {
    border-bottom: none;
}

/* --- Verse Number (clickable, 44×44px tap target) --- */
.read-page__verse-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0.25em 0.5em;
    font-size: 0.85em;
    font-weight: 700;
    color: var(--anchor_color);
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.15s, color 0.15s;
    vertical-align: top;
    user-select: none;
    -webkit-user-select: none;
}

.read-page__verse-num:hover {
    background-color: var(--callout_fieldset_background);
    color: var(--accent_color_dark);
}

.read-page__verse-num:active {
    background-color: var(--accent_color_light);
    color: var(--text_on_accent);
}

/* --- Original Text Line --- */
.read-page__original {
    display: block;
    margin: 0.3em 0 0.2em 0;
    padding-left: 0.5em;
    font-size: 1.05em;
    line-height: 1.7;
    color: var(--text_color);
}

/* RTL modifier for Hebrew text */
.read-page__original.rtl {
    direction: rtl;
    text-align: right;
    padding-left: 0;
    padding-right: 0.5em;
    flex: 0 0 55%;
}

/* --- Translation Text Line --- */
.read-page__translation {
    display: block;
    margin: 0.2em 0 0;
    padding-left: 0.5em;
    font-size: 0.95em;
    line-height: 1.6;
    color: var(--accent_color);
    direction: ltr;
    text-align: left;
}

/* --- Navigation Footer (left | center | right) --- */
.read-page__nav-footer {
    /*display: flex;*/
    justify-content: space-between;
    align-items: center;
    gap: 0.75em;
    padding: 0.75em 0;
    border-top: 2px solid var(--border_color);
    margin-top: 0.5em;
}

.read-page__nav-left,
.read-page__nav-right {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
}

.read-page__nav-center {
    display: flex;
    align-items: baseline;
    gap: 0.4em;
    flex: 1;
    justify-content: center;
}

.read-page__nav-center label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent_color);
    white-space: nowrap;
}

.read-page__nav-center input[type="number"] {
    width: 60px;
    padding: 0.35em 0.5em;
    font-size: 1.1em;
    border: 1px solid var(--border_color);
    border-radius: 6px;
    text-align: center;
    background-color: var(--background_color);
    color: var(--text_color);
}

.read-page__nav-center input[type="number"]:focus {
    outline: none;
    border-color: var(--accent_color_dark);
    box-shadow: 0 0 4px rgba(62, 92, 118, 0.3);
}

/* --- Overlay (modal with backdrop) --- */
.read-page__overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background-color: rgba(20, 33, 46, 0.6);
    align-items: center;
    justify-content: center;
}

.read-page__overlay.active {
    display: flex;
}

.read-page__overlay-content {
    position: relative;
    background-color: var(--background_color);
    border: 1px solid var(--border_color);
    border-radius: 12px;
    padding: 1.5em;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.read-page__overlay-header {
    font-size: 1.25em;
    font-weight: 700;
    color: var(--text_color);
    margin-bottom: 0.75em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid var(--callout_fieldset_border);
}

.read-page__overlay-close {
    position: absolute;
    top: 0.75em;
    right: 0.75em;
    background: none;
    border: none;
    font-size: 1.4em;
    color: var(--text_subdued);
    cursor: pointer;
    padding: 0.25em;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background-color 0.15s;
    box-shadow: none;
}

.read-page__overlay-close:hover {
    color: var(--text_color);
    background-color: var(--callout_fieldset_background);
    transform: none;
}

.read-page__overlay-original,
.read-page__overlay-translation {
    margin: 0.5em 0;
    padding: 0.5em 0.75em;
    border-radius: 6px;
    background-color: var(--callout_fieldset_background);
    line-height: 1.7;
}

.read-page__overlay-original {
    color: var(--text_color);
    font-size: 1.05em;
}

.read-page__overlay-original.rtl {
    direction: rtl;
    text-align: right;
}

.read-page__overlay-translation {
    color: var(--accent_color);
    font-size: 0.95em;
}

.read-page__overlay-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    margin-top: 1em;
    padding-top: 0.75em;
    border-top: 1px solid var(--callout_fieldset_border);
    font-size: .95rem;
}

/* --- Overlay Comparison Section --- */
.read-page__overlay-comparison {
    margin-top: 1em;
    padding-top: 0.75em;
    border-top: 1px solid var(--callout_fieldset_border);
}

.read-page__overlay-comparison-title {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--accent_color_dark);
    margin-bottom: 0.3em;
}

.read-page__overlay-comparison-title a {
    color: var(--anchor_color);
    border-bottom: 1px dotted var(--anchor_underline);
}

.read-page__overlay-comparison-title a:hover {
    color: var(--anchor_hover);
}

.read-page__overlay-comparison-text {
    font-size: 0.95em;
    line-height: 1.6;
    color: var(--text_color);
    padding: 0.4em 0.6em;
    background-color: var(--callout_fieldset_background);
    border-radius: 6px;
    margin-bottom: 0.75em;
}

.read-page__overlay-comparison-unavailable {
    font-size: 0.9em;
    font-style: italic;
    color: var(--text_subdued);
    padding: 0.4em 0.6em;
    margin-bottom: 0.75em;
}

/* --- Error & Empty States --- */
.read-page__error {
    color: var(--error_text);
    background-color: var(--error_background);
    border: 1px solid var(--error_border);
    border-radius: 6px;
    padding: 0.75em 1em;
    margin: 0.75em 0;
    text-align: center;
}

.read-page__empty {
    text-align: center;
    padding: 2em 1em;
    color: var(--text_subdued);
    font-style: italic;
    font-size: 1.05em;
}

/* --- Responsive --- */
@media (max-width: 980px) {
    .read-page__nav-center input[type="number"] {
        min-height: 30px;
    }
}

@media (max-width: 960px) {

    /* ----- responsiveness for read-page__controls ----- */

    .read-page__controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75em;
    }

    /* Label on its own line */
    .read-page__controls-left {
        display: flex;
        flex-direction: column;
        gap: 0.4em;
        min-width: 0;
    }

    .read-page__controls-label {
        white-space: normal;
        font-size: 0.85em;
    }

    /* Row containing select + +/- buttons */
    .read-page__controls-left-row {
        display: flex;
        align-items: center;
        gap: 0.5em;
        width: 100%;
    }

    .read-page__translation-dropdown {
        flex: 1;
        min-width: 0;
    }

    .read-page__controls-right {
        width: 32px;
        flex-shrink: 0;
        align-self: auto;
    }

    span.select2.select2-container.select2-container--default {
        min-width: 0;
        flex: 1 1 auto;
    }

    .select2-container .select2-selection--multiple {
        flex: 1 1 auto;
        width: 50px;
        min-width: 0;
    }

    span.selection {
        min-width: 0;
        display: flex;
        flex: 1 1 auto;
    }
}

@media (max-width: 600px) {
    
    /* ----- other responsiveness for read-page ----- */

    .read-page {
        padding: 0.75em;
    }

    .read-page__nav-footer {
        flex-direction: column;
        gap: 0.5em;
    }

    .read-page__nav-left,
    .read-page__nav-right {
        width: 100%;
        text-align: center;
    }

    .read-page__nav-left button,
    .read-page__nav-right button {
        width: 100%;
    }

    .read-page__nav-center {
        order: -1;
        width: 100%;
        justify-content: center;
    }

    .read-page__overlay-content {
        width: 95%;
        padding: 1em;
    }

}

@media (max-width: 480px) {
    span.select2.select2-container.select2-container--default {
        width: calc(86% - 10px) !important;
    }
}

@media (max-width: 430px) {
    span.select2.select2-container.select2-container--default {
        width: calc(86% - 110px) !important;
    }
}

@media (max-width: 400px) {
    span.select2.select2-container.select2-container--default {
        width: calc(86% - 130px) !important;
    }
}

@media (max-width: 380px) {
    span.select2.select2-container.select2-container--default {
        width: calc(86% - 150px) !important;
    }
}

/* ============================================================
   Strong's Read Page — Additional Styles
   ============================================================ */

/* Non-clickable Strong's references in verse body */
.strongs-ref-plain {
    font-size: 0.68em;
    vertical-align: super;
    font-weight: 600;
    margin: 0 1px;
    color: var(--text_subdued);
}

/* Clickable Strong's references inside the overlay */
.strongs-ref-overlay {
    font-size: 0.75em;
    vertical-align: super;
    font-weight: 600;
    margin: 0 2px;
    text-decoration: none;
    color: var(--anchor_color);
    border-bottom: 1px dotted var(--anchor_underline);
    cursor: pointer;
}

.strongs-ref-overlay:hover {
    color: var(--anchor_hover);
}

/* Strong's text in overlay (larger for readability) */
.read-page__overlay-strongs-text {
    font-size: 1.1em;
    line-height: 1.8;
    color: var(--callout_text);
    padding: 0.5em 0;
}

/* Definition panel container inside overlay */
#read-page-overlay-definition {
    margin-top: 0.75em;
}

#read-page-overlay-definition .strongs-definition-panel {
    margin-top: 0;
}

#read-page-verses {
    font-size: 1rem;
}
