/*
 * Table of Contents
 *
 * Import
 * General Styles
 * Bible Icons (for books)
 * Saved verse icon
 * Tabbed Content
 * Tab Navigation
 * Dropdown Styles
 * IQ Bible Header (book name, chapter, version)
 * IQ Bible Errors
 * Chapter buttons
 * Bible Text
 * Bible Stories tab
 * Audio
 * Topics
 * Search and Forms
 * Footer
 * Dialogs
 * Toogle Switch
 * Spinner styles
 * Notes
 * Prev / Next - chapter nav
 * Media Queries
 */



/**
*
* Root Variables
*
*/
:root {
    /* General vars */
    --font-family: inherit;
    --background-color: #f8f9fa;
    --text-color: #343a40;
    --hover-background-color: #e9ecef;

    /* Tab vars */
    --tab-button-background-color: #6c757d;
    --tab-button-color: #fff;
    --tab-button-hover-background-color: #495057;
    --tab-active-background-color: #343a40;
    --tab-border-color: #dee2e6;

    /* Form and btns vars */
    --form-border-color: #ced4da;
    --button-background-color: #6c757d;
    --button-color: #fff;
    --button-hover-opacity: 0.85;
    --input-background-color: #ffffff;

    /* Audio vars */
    --audio-shadow-color: rgba(52, 58, 64, 0.2);
    --audio-controls-color: #495057;
}



/**
*
* General Styles 
*
*/

/* Explicit specifications to avoid theme conflicts */
.iqbible-main {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    padding: 15px;
    border: 1px solid gray;
    border-radius: 15px;
}

/* Explicitly specify font to descendants of .iqbible-main to avoid font conflicts with themes */
.iqbible-main #iqbible-fetch-books-header,
.iqbible-main .iqbible-tab-text,
.iqbible-main .iqbible-tab-content-container,
.iqbible-main form,
.iqbible-main input,
.iqbible-main button,
.iqbible-main select {
    font-family: inherit;
}

.iqbible-main h2 {
    font-size: 2rem;
}

/* Saved verse icon */
.iqbible-saved-icon {
    display: inline-block;
    vertical-align: middle;
    color: currentColor;
    opacity: 0.7;
    width: 1em;
    height: auto;
    margin-left: 4px;
    filter: brightness(1.5);
}




/**
*
* Tabbed Content
*
*/
.iqbible-tab-content-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.iqbible-tab-content {
    display: none;
    padding: 10px;
    border: 1px solid var(--tab-border-color);
    border-top: none;
    background-color: #f9f9f9;
    overflow: auto;
}

.iqbible-tab-content.active {
    display: block;
}

.iqbible-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 3px;
    padding-bottom: 10px;
    max-width: 1200px;
}

.iqbible-tab-button,
.iqbible-option-button {
    display: inline-flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 6px;
    background-color: var(--tab-button-background-color, #6c757d);
    color: var(--tab-button-color, #fff);
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-width: 0;
    width: 100%;
}

.iqbible-option-button {
    margin: 2px 0;
}

.iqbible-tab-button:hover,
.iqbible-option-button:hover {
    background-color: var(--tab-active-background-color, #495057);
    color: var(--tab-button-color, #fff);
}

.iqbible-tab-button .iqbible-tab-icon img,
.iqbible-option-button img {
    filter: invert(100%);
    display: block;
    width: 1em;
    height: auto;
    flex-shrink: 0;
}

.iqbible-tab-button .iqbible-tab-text {
    color: inherit;
}

.iqbible-tab-button:hover .iqbible-tab-text {
    color: inherit;
}





/**
*
* Dropdown Styles 
*
*/
.iqbible-dropdown {
    position: relative;
    display: inline-block;
    cursor: pointer;
    z-index: 999;
    /* Ensure sits atop any other elements (like audio) */
}

.iqbible-dropdown-content {
    display: none;
    position: absolute;
    background-color: #f1f1f1;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.iqbible-dropdown-content a {
    color: black;
    padding: 12px 16px;
    display: block;
}

.iqbible-dropdown-content a:hover {
    background-color: #ddd;
}

.iqbible-dropdown .show {
    display: block;
}



/**
*
* IQ Bible Header (book name, chapter, version)
*
*/
#iqbible-header-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 1rem 0;
}

.iqbible-main #iqbible-header-container>h2,
.iqbible-main #iqbible-header-container>small,
.iqbible-main #iqbible-header-container>img {
    margin: 0;
    padding: 0;
    vertical-align: middle;
    line-height: 1.2;
}

.iqbible-main #iqbible-header-container>img {
    max-height: 1.5em;
    width: auto;
}

#iqbible-fetch-books-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#iqbible-fetch-books-header-version {
    font-size: 0.8em;
    color: gray;
}

.iqbible-book-item {
    cursor: pointer;
}






/**
*
* Chapter buttons
*
*/
.iqbible-chapter-row {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    /* Ensure buttons wrap to the next line */
    margin-bottom: 5px;
    /* Space between rows */
}

.iqbible-chapter-item {
    width: calc(20% - 10px);
    text-align: center;
    padding: 5px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    cursor: pointer;
    margin-right: 10px;
    margin-bottom: 5px;
    color: currentColor;
}

.iqbible-chapter-item:nth-child(5n) {
    margin-right: 0;
}



/**
*
* Bible Text 
*
*/
.iqbible-story-title {
    padding: 10px 0px 10px;
}


/* Highlighted */
.iqbible-highlighted {
    background-color: yellow;
    transition: background-color 0.5s ease;
}



/**
*
* Bible Stories tab 
*
*/
.iqbible-bible-stories-container a {
    text-decoration: none;
}

.iqbible-bible-stories-container p .story-verses {
    font-size: 0.8em;
    /* Make the text smaller */
    font-style: italic;
    /* Italicize the verses */
    color: #666;
    /* You can change this color if needed */
    margin-left: 5px;
    /* Optional: Adds a little space between the story and the verses */
}



/**
*
* Audio 
*
*/
.iqbible-audio {
    width: 100%;
}

#iqbible-audio-player {
    margin: 1rem 0;
}

.iqbible-audio-indicator img {
    padding-left: 5px;
    width: 10px;
}



/**
*
* Topics
*
*/
.iqbible-topic-item {
    cursor: pointer;
}



/**
*
* Search and Forms
*
*/
.iqbible-search-form,
.iqbible-strongs-form {
    display: flex;
    align-items: center;
    margin: 20px auto;
}

.iqbible-search-container {
    position: relative;
    display: flex;
}

#iqbible-query,
#iqbible-definition-query,
#iqbible-strongs-query {
    padding: 10px 40px 10px 15px;
    font-size: 16px;
    border: 1px solid var(--tab-border-color);
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 300px;
}

.iqbible-search-button {
    background-color: var(--button-background-color);
    /* Use the button background color var */
    color: var(--tab-button-color);
    /* Use the button text color var */
    border: none;
    /* Remove default border */
    padding: 10px 15px;
    /* Add padding for spacing */
    border-radius: 4px;
    /* Rounded corners for consistency */
    cursor: pointer;
    /* Change cursor to pointer on hover */
    font-size: 16px;
    /* Adjust font size */
    transition: background-color 0.3s, opacity 0.3s;
    /* Smooth transition effect */
}

.iqbible-search-button:hover {
    opacity: var(--button-hover-opacity);
    /* Apply hover opacity effect */
}

/* Form */
#iqbible-reading-plan-form-container {
    max-width: 100%;
    padding: 20px;
    margin: 0 auto;
}

.iqbible-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.iqbible-form-group {
    flex: 1;
    padding: 10px;
}

/* Standardize height and width for inputs and selects */
.iqbible-form-group input[type="text"],
.iqbible-form-group input[type="number"],
.iqbible-form-group input[type="date"],
.iqbible-form-group select {
    font-size: 16px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    height: 45px;
    box-sizing: border-box;
}

.iqbible-reading-plan-submit {
    background-color: var(--button-background-color);
    color: var(--button-color);
    padding: 20px;
    border: 1px solid var(--button-background-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
}

.iqbible-reading-plan-submit:hover {
    opacity: var(--button-hover-opacity);
}



/**
*
* Dialogs
*
*/

/* Dialog Backdrop */
dialog::backdrop {
    background: rgba(0, 0, 0, .6);
}

/* Dialog Container */
.iqbible-dialog {
    z-index: 1000;
    /* Modal z-index */
    margin-top: 75px;
    border: 1px solid var(--background-color);
    border-radius: 15px;
    background-color: var(--background-color);
    padding: 20px;
    min-width: 50%;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

/* Dialog scrollbar */
.iqbible-dialog::-webkit-scrollbar {
    width: 12px;
}

.iqbible-dialog::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 15px;
}

.iqbible-dialog::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    border: 2px solid transparent;
}

/* Dialog Header */
.iqbible-dialog h2 {
    color: var(--text-color);
    margin-bottom: 15px;
    /* Space below the header */
}

/* Close Button */
.iqbible-dialog dialog button {
    margin-top: 10px;
    border: none;
    background-color: var(--button-color);
    /* Optional: Set button color */
    color: var(--button-text-color);
    /* Optional: Set button text color */
    padding: 10px 15px;
    /* Add padding for a better button size */
    border-radius: 5px;
    /* Rounded corners for the button */
    cursor: pointer;
    /* Pointer cursor on hover */
}

.iqbible-dialog-close {
    position: absolute;
    top: 10px;
    /* Adjust as needed */
    right: 10px;
    /* Adjust as needed */
    font-size: 20px;
    /* Size of the close icon */
    cursor: pointer;
    /* Show pointer on hover */
    border: none;
    /* No border */
    background: transparent;
    /* No background */
}

/* Dialog Content */
.iqbible-dialog-content {
    padding: 10px;
    color: var(--text-color);
    background-color: var(--background-color);
}

/* Add transition for dialog */
.iqbible-dialog {
    transition: all 0.3s ease;
    /* Smooth transitions for opening and closing */
}

#versions-dialog li {
    cursor: pointer;
}

.iqbible-dialog.iqbible-message-dialog {

    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}



/**
*
* Verse container 
*
*/
.iqbible-verse {
    position: relative;
    padding: 5px;
    border-radius: 4px;
    margin-bottom: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.iqbible-verse:hover {
    background-color: white;
    transition: background-color 0.3s, color 0.3s;
    color: black;
    border-bottom-left-radius: 0;
}

.iqbible-verse:hover .iqbible-verse-options {
    display: flex;
}


.iqbible-verse-options {
    display: none;
    position: absolute;
    align-items: flex-start;
    justify-content: flex-start;
    background: #ffffff;
    padding: 5px;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    top: 100%;
    left: 0;
    z-index: 10;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    box-sizing: border-box;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 2px;
}

.iqbible-verse:hover .iqbible-verse-options {
    display: grid;
}

.iqbible-verse-options .iqbible-option-button {
    justify-content: flex-start;
    text-align: left;
    width: 100%;
    white-space: nowrap;
    font-size:12px;
}



/* Loading Dialog */
#iqbible-loading-dialog {
    background-color: transparent;
    /* Make the dialog background transparent */
    border: none;
    /* Remove border */
    box-shadow: none;
    /* Remove shadow */
    outline: none;
    /* Remove the default outline */

}

/* Dialog Content (Spinner or any other content) */
#iqbible-loading-dialog .iqbible-dialog-content {
    background-color: transparent;
    /* Make the dialog content background transparent */
    border: none;
    /* Remove content border */
    box-shadow: none;
    /* Remove shadow */

}



/**
*
* Toggle Switch
*
*/
/* Toggle switch style */
.iqbible-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.iqbible-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.iqbible-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.iqbible-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked+.iqbible-slider {
    background-color: #2196F3;
}

input:checked+.iqbible-slider:before {
    transform: translateX(26px);
}

/* Round slider */
.iqbible-slider.iqbible-round {
    border-radius: 34px;
}

.iqbible-slider.iqbible-round:before {
    border-radius: 50%;
}



/* Spinner styles in loading dialog */
.iqbible-spinner {
    border: 8px solid #f3f3f3;
    /* Light grey */
    border-top: 8px solid purple;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
    /* Center the spinner */
}

/* Animation for the spinner */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Style for loading dialog to center the spinner */
#iqbible-loading-dialog .iqbible-dialog-content {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}



/**
*
* Notes
*
*/

.iqbible-note-content {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 90%
}



/**
*
* Prev / Next - chapter nav
*
*/

#iqbible-prev-next {
    text-align: center;
    margin-top: 20px;
}

#iqbible-prev-next span {
    cursor: pointer;
    padding: 10px 20px;
}

#iqbible-prev-next span:hover {
    text-decoration: underline;
}

/**
*
* Prev | Next buttons
*
*/
#iqbible-prev-next span.disabled {
    color: #999;
    cursor: default;
    text-decoration: none;
}

#iqbible-prev-next span.disabled:hover {
    text-decoration: none;
}




/**
*
* Media Queries
*
*/

/* Min */

@media (min-width: 768px) {
    .iqbible-tab-icon {
        display: none;
    }
}

/* Max */
@media (max-width: 767px) {
    .iqbible-tab-icon {
        display: block;
    }

    .iqbible-tab-text {
        display: none;
    }



    .iqbible-verse-options {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, auto);
    }


    #iqbible-fetch-books-header {
        font-size: 1.3rem;
        white-space: nowrap;
    }

    .iqbible-tab-icon img {
        filter: brightness(0) invert(1);
    }


    #iqbible-reading-plan-form-container {
        padding: 10px;
    }

    .iqbible-form-row {
        flex-direction: column;
        gap: 10px;
    }

    .iqbible-search-container {
        flex-direction: column;
        align-items: stretch;
    }

    #iqbible-query,
    #iqbible-definition-query,
    #iqbible-strongs-query,
    .iqbible-search-button {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
    }

    .iqbible-tab-button {
        font-size: 16px;
    }

}