:root {
    --light-grid: #d5f2fc;
    --grid-color: #3991ae;
    --background-color: #fff;
    --chapter_read: var(--grid-color);
    --chapter_listened: #69c4e2;
    --chapter_studied: gold;
    --normal-cell-size: 15px;
    --mobile-cell-size: 11px;
    --animationSpeed: 0.25s;
}
/* --grid-color: #3991ae; */

* {
    -webkit-tap-highlight-color: transparent;
}

body, html {
    height: 100%;
    background-color: var(--background-color);
    cursor: pointer;
    caret-color: transparent;
    font-family: 'Poppins', sans-serif;
    color: var(--grid-color);
    margin: 0px;
}

/* Show cursor in input fields */
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    caret-color: auto;
}


.container {
    display: inline-block;
    margin: 0px;
}

.grid_overlay_container {
    position: relative;
    display: grid;
}

.page_title_container {
    background-color: white;;
    color: var(--grid-color);
    height: 100%;
    border: none;
}

.page_title_container h1 {
    font-size: 38px;
    font-family: 'Kanit', sans-serif;
    line-height: 24px;
}

#grid,
#chapter_box,
#settings_box,
#timeline_box,
#stats_box,
#bible_nav_box,
#chapter_selection_box
    { grid-area: 1/1; }

#chapter_box {
    display: block; /* none by default */
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.5s linear;
    width: calc((var(--normal-cell-size) * 30) + 29px);
    height: calc((var(--normal-cell-size) * 40) + 39px);
    background-color: white;
    border: 1px solid var(--grid-color);
    z-index: 10;
    cursor: auto;
    position: relative;
}

#settings_box {
    display: flex;
    flex-direction: column;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.5s linear;
    width: calc((var(--normal-cell-size) * 30) + 29px);
    height: calc((var(--normal-cell-size) * 40) + 39px);
    background-color: white;
    border: 1px solid var(--grid-color);
    z-index: 12;
    cursor: auto;
    text-align: left;
    position: relative;

    h4 {
        font-size: 22px;
        /* font-family: 'Kanit', sans-serif; */
        line-height: 24px;
        padding-left: 50px;
    }

    .settings-header {
        text-align: left;
        margin: 20px 20px 10px 20px;
        padding: 0;
    }

    .settings-content {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 10px;
    }

    .settings_option {
        margin-left: 20px;
        margin-bottom: 20px;
    }

    .setting-status {
        margin-top: 10px;
        font-size: 14px;
        color: #666;
    }

    .save-continuously-option {
        display: flex;
        align-items: center;
        gap: 50px;
    }

    .save-manually-wrapper {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    #last_saved {
        display: block;
        margin-top: 8px;
        font-size: 13px;
        color: #666;
    }

    .bible-version-controls {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-top: 5px;
    }

    .version-display {
        margin-top: 5px;
        display: inline-block;
    }

    .settings-separator {
        border: none;
        border-top: 1px solid #ccc;
        margin: 25px 20px 25px 20px;
        width: 300px;
        display: block;
    }

    .close-button-row {
        flex-shrink: 0;
        border-top: 1px solid var(--grid-color);
        padding: 20px 0;
        display: flex;
        justify-content: center;
    }

    #close_button {
        position: relative;
        bottom: auto;
        right: auto;
        transform: none;
        margin: 0;
        padding: 0;
    }
}

#timeline_box {
    display: flex;
    flex-direction: column;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.5s linear;
    width: calc((var(--normal-cell-size) * 30) + 29px);
    height: calc((var(--normal-cell-size) * 40) + 39px);
    background-color: white;
    border: 1px solid var(--grid-color);
    z-index: 12;
    cursor: auto;
    text-align: left;
    position: relative;
}

.timeline-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 10px 10px 10px;
    flex-shrink: 0;
}

.timeline-header-row h4 {
    font-size: 22px;
    line-height: 24px;
    margin: 0;
    padding: 0;
}

.timeline-sort-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.timeline-sort-toggle:hover {
    background-color: #f0f0f0;
}

.timeline-sort-toggle i {
    font-size: 24px;
    color: var(--grid-color);
    margin-bottom: 4px;
}

.timeline-sort-toggle .sort-label {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
}

#timeline_content {
    padding: 20px 20px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

#timeline_box .close-button-row {
    flex-shrink: 0;
    border-top: 1px solid var(--grid-color);
    padding: 20px 0;
    display: flex;
    justify-content: center;
}

#timeline_box #close_button {
    position: relative;
    bottom: auto;
    right: auto;
    transform: none;
    margin: 0;
}

#stats_box {
    display: flex;
    flex-direction: column;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.5s linear;
    width: calc((var(--normal-cell-size) * 30) + 29px);
    height: calc((var(--normal-cell-size) * 40) + 39px);
    background-color: white;
    border: 1px solid var(--grid-color);
    z-index: 12;
    cursor: auto;
    text-align: left;
    position: relative;

    h4 {
        font-size: 22px;
        line-height: 24px;
        padding-left: 50px;
        flex-shrink: 0;
        padding-top: 10px;
        padding-bottom: 10px;
    }
}

#stats_content {
    padding: 20px 50px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

#stats_box .close-button-row {
    flex-shrink: 0;
    border-top: 1px solid var(--grid-color);
    padding: 20px 0;
    display: flex;
    justify-content: center;
}

#stats_box #close_button {
    position: relative;
    bottom: auto;
    right: auto;
    transform: none;
    margin: 0;
}

#bible_nav_box {
    display: flex;
    flex-direction: column;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.5s linear;
    width: calc((var(--normal-cell-size) * 30) + 29px);
    height: calc((var(--normal-cell-size) * 40) + 39px);
    background-color: white;
    border: 1px solid var(--grid-color);
    z-index: 11;
    cursor: auto;
    position: relative;
    overflow: hidden;
    gap: 10px;
}

.bible_nav_section {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
    padding: 0 15px;
}

.bible_nav_section:first-child {
    flex: 5;
    padding-top: 15px;
}

.bible_nav_section:last-child {
    flex: 3;
    padding-bottom: 15px;
}

.bible_nav_label {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 3px 0;
    padding: 5px 0 2px 8px;
    text-align: left;
    border-bottom: 1px solid var(--grid-color);
    flex-shrink: 0;
}

.bible_nav_grid {
    display: grid;
    grid-gap: 0;
    background: transparent;
    flex: 1;
    border: none;
}

.old_testament_grid {
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(5, 1fr);
}

.new_testament_grid {
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.bible_nav_cell {
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 0;
    color: var(--grid-color);
    min-height: 0;
    min-width: 0;
    border: none;
}

.bible_nav_cell:hover {
    background-color: #f0f0f0;
}

.bible_nav_empty {
    cursor: default;
    background-color: transparent;
}

.bible_nav_empty:hover {
    background-color: transparent;
}

.bible_nav_empty:hover {
    background-color: white;
}

.bible_nav_cell:hover {
    background-color: #f0f0f0;
}

/* ========== CHAPTER SELECTION BOX STYLES START ========== */
#chapter_selection_box {
    display: flex;
    flex-direction: column;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.5s linear;
    width: calc((var(--normal-cell-size) * 30) + 29px);
    height: calc((var(--normal-cell-size) * 40) + 39px);
    background-color: white;
    border: 1px solid var(--grid-color);
    z-index: 13;
    cursor: auto;
    position: relative;
}

.chapter_selection_content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chapter_selection_grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    background: white;
    padding: 15px;
    grid-auto-rows: min-content;
}

.chapter_cell {
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 8px;
    color: var(--grid-color);
    min-height: 30px;
    border: 1px solid var(--light-grid);
    margin: -1px 0 0 -1px;
}

.chapter_cell:hover {
    background-color: var(--light-grid);
}

#chapter_selection_box #close_button {
    position: relative;
    bottom: auto;
    right: auto;
    transform: none;
}

#chapter_selection_box .close-button-row {
    flex-shrink: 0;
    border-top: 1px solid var(--grid-color);
    padding: 20px 0;
    display: flex;
    justify-content: center;
}
/* ========== CHAPTER SELECTION BOX STYLES END ========== */

.timeline-list {
    position: relative;
    padding-left: 35px;
}

.timeline-list::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #ccc;
}

.timeline-item {
    display: flex;
    margin-bottom: 30px;
    position: relative;
    align-items: flex-start;
}

.timeline-marker {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 4px solid #ccc;
    background-color: white;
    margin-right: 20px;
    margin-top: 20px;
    flex-shrink: 0;
    position: absolute;
    left: -36px;
    z-index: 1;
}

.timeline-content {
    flex: 1;
    padding: 15px 20px;
    background-color: #f0f0f0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.timeline-content::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 20px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid #f0f0f0;
}

.timeline-date {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
    text-align: right;
}

.timeline-action {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 8px;
    margin-top: 10px;
    color: #555;
}

.timeline-chapters {
    margin: 0;
    padding-left: 20px;
    list-style-type: disc;
}

.timeline-chapters li {
    font-size: 15px;
    font-weight: normal;
    color: #555;
    margin-bottom: 8px;
}

.chapter-notes {
    font-size: 13px;
    color: #555;
    font-style: italic;
    margin-top: 6px;
    margin-left: 0;
    padding: 8px 12px;
    background-color: white;
    border-radius: 6px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.timeline-separator {
    border: none;
    border-top: 1px solid #ccc;
    margin: 15px 0;
}

.timeline-notes {
    font-size: 14px;
    color: #555;
    font-style: italic;
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #e8e8e8;
    border-radius: 4px;
}

.action_panel {
    display: grid;
    grid-template-columns: auto auto auto;
    grid-template-rows: auto;
    column-gap: 20px;
    padding: 10px;

}

.read_action, .listen_action, .study_action {
    display: grid;
    /* border: 1px solid var(--grid-color); */
}

#grid {
    display: grid;
    grid-template-columns: repeat(30, var(--normal-cell-size));
    grid-template-rows: repeat(40, var(--normal-cell-size));
    grid-gap: 1px;
    background: var(--light-grid);
    border: 1px solid var(--grid-color);
    position: relative;
    min-height: 610px; /* 40 rows * 15px + gaps */
}

/* ========== SKELETON GRID STYLES START ========== */
/* Hide grid's own background when skeleton is showing */
#grid:has(#grid-loading) {
    background: transparent;
    border: none; /* Remove border from grid itself, let skeleton handle it */
}

.grid-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(30, var(--normal-cell-size));
    grid-template-rows: repeat(40, var(--normal-cell-size));
    grid-gap: 1px;
    background: var(--light-grid);
    border: 1px solid var(--grid-color); /* Border on skeleton instead of grid */
    z-index: 10;
    pointer-events: none;
}

.skeleton-cell {
    background: var(--background-color);
    pointer-events: none;
}

.panel-loading {
    opacity: 0.6;
}

.skeleton-text {
    color: var(--grid-color);
    opacity: 0.5;
}
/* ========== SKELETON GRID STYLES END ========== */

.cell {
    /* center the cell content */
    justify-content: center;
    align-items: center;
    display: flex;
    font-family: Arial;
    font-size: 3rem;
    font-weight: bold;
    background: var(--background-color);
}

.cell:hover {
    background-color: var(--grid-color);
}

.spacer {
    height: 15px;
    background-color: var(--background-color);
    cursor: auto;
}

.panel {
    border: 1px solid var(--grid-color);
    background-color: var(--background-color);
    height: 100px;
    width: calc((var(--normal-cell-size) * 30) + 29px);
    justify-content: left;
    align-items: left;
    text-align: left;
    display: flex;
}

.title_panel {
    background-color: var(--background-color);
    height: 100px;
    justify-content: left;
    align-items: left;
    text-align: left;
    display: flex;
}

.panel_column {
    float: left;
    background-color: var(--background-color);
}

.title_panel_left {
    width: 8%;
    height: 100%;
    cursor: pointer;
}

.title_panel_right {
    width: 8%;
    height: 100%;
}

.panel_left {
    width: 8%;
    height: 100%;
    border-right: 1px solid var(--grid-color);
    cursor: pointer;
}

.panel_right {
    width: 8%;
    height: 100%;
    border-left: 1px solid var(--grid-color);
    cursor: pointer;
}

/* .panel_left:hover, .panel_right:hover {
    background-color: #F8F8F8;
} */

/* .panel_left:active, .panel_right:active {
    background-color: var(--light-grid);
} */

.panel_middle {
    width: 84%;
    cursor: auto;
}

.top_row {
    display: flex;
    /* border: 1px solid red; */
}

.book_percent {
    line-height: 18px;
    margin: 23px 5px 0px 10px;
    /* border: 1px solid red; */
    float: bottom;
}

.book_name {
    float: left;
    font-family: Arial;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--grid-color);
    padding: 5px 10px;
    width: 65%;
}

.chapter_name {
    float: right;
    font-family: Arial;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--grid-color);
    padding: 5px 10px;
    text-align: right;
    line-height: 1.3rem;
    width: 35%;
}

.chapter_title {
    float: center;
    font-family: Arial;
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--grid-color);
    padding: 5px;
    margin-bottom: 5px;
    /* text-align: center; */
}

.read {
    background-color: var(--chapter_read);
    border: 1px solid black;
}

.listen {
    background-color: var(--chapter_listened);
    border: 1px solid black;
}

.study {
    background-color: var(--chapter_studied);
    border: 1px solid black;
}

#close_button {
    position: absolute;
    bottom: 15px;
    right: 50%;
    width: 100px;
    transform: translate(50%,-50%);
    border: 1px dashed var(--grid-color);
    padding: 0px 10px;
    cursor: pointer;
    text-align: center;
}

#close_button:hover {
    border: 1px solid var(--grid-color);
}

.standard_button {
    padding: 8px 16px;
    border: none;
    border-radius: 16px;
    background-color: #fff;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.standard_button:hover {
    background-color: #fff;
    box-shadow: 3px 3px 7px rgba(0, 0, 0, 0.3);
}

.styled_select {
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--grid-color);
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.styled_select:hover {
    border-color: var(--grid-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.styled_select:focus {
    border-color: var(--grid-color);
    box-shadow: 0 0 0 2px rgba(var(--grid-color-rgb), 0.2);
}

/* Sliders  ------------------------- */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input { display:none; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .2s;
    transition: .2s;
}

input:checked + .slider {
    background-color: var(--grid-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--grid-color);
}

input:checked + .slider:before {
    -webkit-transform: translateX(28px);
    -ms-transform: translateX(28px);
    transform: translateX(28px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 28px;
}

.slider.round:before {
    border-radius: 50%;
}

.triangle_l {
    border-right: 4px solid;
    border-bottom: 4px solid;
    height: 12px;
    width: 12px;
    transform: rotate(135deg);
    margin-top: 40px;
    margin-left: 14px;
}

.triangle_r {
    border-right: 4px solid;
    border-bottom: 4px solid;
    height: 12px;
    width: 12px;
    transform: rotate(-45deg);
    margin-top: 40px;
    margin-left: 8px;
}



/*----- hamburger menu icon -----*/
/* * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}  */

.menuItem {
    display: block;
    /* margin: 0rem 3rem; */
    font-size: 1.2rem;
    padding: 20px;
    color: var(--grid-color);
    text-decoration: none;
    background: #fff;
    width: 441px; /* Perfect width to cover the grid. */
    border-left: 1px solid var(--grid-color);
  }

  .menuItem:hover {
    background: var(--light-grid);
    border-top: 1px solid var(--grid-color);
    border-bottom: 1px solid var(--grid-color);
    border-right: 1px solid var(--grid-color);
  }

  #settings_menuitem:hover {
    border-top: none;
  }

  .hamburger {
    position: absolute;
    z-index: 100;
    top: 45px;
    padding: 4px;
    border: 0px solid var(--grid-color) ;
    background: white;
    cursor: pointer;
  }

  .closeIcon {
    display: none;
  }

  .menuIcon,
  .closeIcon,
  .material-icons {
    color: var(--grid-color);
  }

  .menu {
    position: absolute;
    transform: translateY(-110%);
    transition: transform 0.4s;
    top: 0;
    height: 757px; /* Perfect hight to cover the bottom of the grid*/
    margin-left: 0px;
    z-index: 99;
    background:white;
    color: var(--grid-color);
    list-style: none;
    border-bottom: 1px solid var(--grid-color);
    /* border-left: 1px solid black; */
  }

  .showMenu {
    /* Moves the top of the menu down so that it covers the top border of the grid panel.*/
    transform: translateY(84px);
    border-bottom: none;
  }

  /* Hide grid and panel when menu is open */
.menu.showMenu ~ .container .grid_overlay_container {
    visibility: hidden !important;
}

.menu.showMenu ~ .container .panel {
    visibility: hidden !important;
}

.menu.showMenu ~ .container .title_panel_left,
.menu.showMenu ~ .container .title_panel_right {
    visibility: hidden !important;
    pointer-events: none !important;
}

  ul {
    /* Overwrite the default 40px left padding.*/
    padding-inline-start: 0px;
}

/* Login overlay styles */
#login_overlay {
    position: fixed !important;
    top: 84px !important;
    left: 50% !important;
    width: calc(100vw - 10px) !important;
    max-width: 479px !important;
    height: auto !important;
    min-height: 200px !important;
    max-height: calc(100vh - 104px) !important;
    background-color: white !important;
    z-index: 101 !important;
    padding: 20px 0px !important;
    border: none !important;
    box-sizing: border-box !important;
    transform: translateX(-50%) !important;
    margin-left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    list-style: none !important;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    overflow-y: auto !important;
}

/* Login/Create Account container */
#login_container {
    display: block;
}

#login_title {
    text-align: center;
    color: var(--grid-color);
    font-size: 24px;
    margin-bottom: 25px;
}

#auth_form {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Form fields */
#auth_form > div,
#name_field,
#password_field,
#confirm_password_field,
#city_field,
#state_field {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
}

#auth_form label {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
    background-color: var(--grid-color);
    color: #ffffff;
}

#auth_form input[type="text"],
#auth_form input[type="email"],
#auth_form input[type="password"] {
    flex: 1;
    height: 50px;
    border: 1px solid #dee0e4;
    padding: 0 15px;
    box-sizing: border-box;
}

/* Password field wrapper */
#auth_form input[type="password"] {
    padding: 0 45px 0 15px;
    width: 100%;
}

/* Keep padding for password fields even when type changes to text */
#auth_form #password,
#auth_form #confirm_password {
    padding: 0 45px 0 15px;
    width: 100%;
}

.password-wrapper {
    flex: 1;
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #666;
}

/* Forgot password link */
.forgot-password-link {
    position: absolute;
    bottom: -25px;
    right: 0;
    text-align: right;
    width: 100%;
}

.forgot-password-link a {
    color: var(--grid-color);
    text-decoration: none;
    font-size: 14px;
}

#optional_fields_label {
    display: none;
    width: 100%;
    text-align: left;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

/* Remember me checkbox */
.remember-me-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
}

.remember-me-container input[type="checkbox"] {
    margin-right: 8px;
}

.remember-me-container label {
    font-size: 14px;
    cursor: pointer;
    background-color: transparent !important;
    color: inherit !important;
    width: auto !important;
    height: auto !important;
}

/* Auth buttons */
#submit_btn,
#toggle_mode_btn {
    width: 100%;
    padding: 15px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.2s;
    margin-bottom: 10px;
    border: 0;
}

#submit_btn {
    background-color: var(--grid-color);
    color: #ffffff;
}

#submit_btn:hover {
    opacity: 0.8;
}

#toggle_mode_btn {
    padding: 12px;
    background-color: transparent;
    border: 1px solid var(--grid-color);
    color: var(--grid-color);
    font-size: 16px;
}

#toggle_mode_btn:hover {
    opacity: 0.7;
}

#auth_message {
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
}

/* Logout container styles */
#logout_container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
}

#logout_container h3 {
    text-align: center;
    color: var(--grid-color);
    font-size: 24px;
    margin-bottom: 25px;
    width: 100%;
}

#logout_container > div {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
}

#logout_container button {
    width: 100%;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.2s;
}

#logoutButton {
    padding: 15px;
    border: 0;
    color: #ffffff;
}

#logoutButton:hover {
    opacity: 0.8;
}

#cancelLogoutButton {
    padding: 12px;
    background-color: transparent;
    border: 1px solid var(--grid-color);
    color: var(--grid-color);
    font-size: 16px;
}

#cancelLogoutButton:hover {
    opacity: 0.7;
}

/* Hide menu border when login overlay is showing */
body.login-overlay-visible .menu {
    border-bottom: none !important;
}

/* Hide menu item borders when login overlay is visible */
body.login-overlay-visible .menuItem {
    border: none !important;
}

/* Hide grid border when login overlay is visible */
body.login-overlay-visible #grid {
    border: none !important;
}

/* Hide panel border when login overlay is visible */
body.login-overlay-visible .panel {
    border: none !important;
}

/* Forgot Password overlay styles */
#forgot_password_overlay {
    position: absolute !important;
    top: 84px !important;
    left: 50% !important;
    width: 479px !important;
    height: 757px !important;
    background-color: white !important;
    z-index: 102 !important;
    padding: 20px !important;
    border: none !important;
    box-sizing: border-box !important;
    transform: translateX(-50%) !important;
    margin-left: 0 !important;
    right: auto !important;
    bottom: auto !important;
}

/* Hide grid when forgot password overlay is visible */
body.forgot-password-visible .grid_overlay_container {
    visibility: hidden !important;
}

/* Hide panel when forgot password overlay is visible */
body.forgot-password-visible .panel {
    visibility: hidden !important;
}

/* ========== SKELETON GRID: Authentication visibility rules START ========== */
/* Hide grid and panel by default until authenticated */
body:not(.user-authenticated) .grid_overlay_container {
    visibility: visible !important; /* Changed: allow grid container to be visible for skeleton */
}

/* Hide everything in grid except the skeleton */
body:not(.user-authenticated) #grid {
    visibility: visible !important;
    background: transparent !important; /* Remove blue background while loading */
}

body:not(.user-authenticated) #grid-loading {
    visibility: visible !important;
    display: grid !important;
}

body:not(.user-authenticated) #grid-loading .skeleton-cell {
    visibility: visible !important;
}

body:not(.user-authenticated) #grid > .cell {
    display: none !important;
}

/* Show skeleton panel, hide real panel */
body:not(.user-authenticated) .panel:not(.panel-loading) {
    display: none !important;
}

body:not(.user-authenticated) .panel-loading {
    display: flex !important;
}
/* ========== SKELETON GRID: Authentication visibility rules END ========== */

body:not(.user-authenticated) .hamburger {
    visibility: hidden !important;
}

body:not(.user-authenticated) .title_panel_left,
body:not(.user-authenticated) .title_panel_right {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Forgot Password container styles */
#forgot_password_container {
    position: fixed !important;
    top: 84px !important;
    left: 50% !important;
    width: calc(100vw - 10px) !important;
    max-width: 479px !important;
    height: auto !important;
    min-height: 200px !important;
    max-height: calc(100vh - 104px) !important;
    background-color: white !important;
    z-index: 1000 !important;
    padding: 20px 10px !important;
    border: none !important;
    box-sizing: border-box !important;
    transform: translateX(-50%) !important;
    margin-left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    list-style: none !important;
    display: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    overflow-y: auto !important;
    cursor: default;
}

#forgot_password_container h3 {
    text-align: center;
    color: var(--grid-color);
    font-size: 24px;
    margin-bottom: 25px;
}

#forgot_password_form {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#forgot_password_form > div {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
}

#forgot_password_form label {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
    background-color: var(--grid-color);
    color: #ffffff;
}

#forgot_password_form input[type="email"] {
    flex: 1;
    height: 50px;
    border: 1px solid #dee0e4;
    padding: 0 15px;
}

#send_reset_link_btn,
#cancel_forgot_password_btn {
    width: 100%;
    padding: 15px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.2s;
    margin-bottom: 10px;
    border: 0;
}

#send_reset_link_btn {
    background-color: var(--grid-color);
    color: #ffffff;
}

#send_reset_link_btn:hover {
    opacity: 0.8;
}

#cancel_forgot_password_btn {
    padding: 12px;
    background-color: transparent;
    border: 1px solid var(--grid-color);
    color: var(--grid-color);
    font-size: 16px;
}

#cancel_forgot_password_btn:hover {
    opacity: 0.7;
}

#forgot_password_message {
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
}

/* Content wrapper for overlaying notes and chapter */
#content_wrapper {
	position: relative;
	min-height: 360px;
	margin: 0 15px;
}

/* Notes styles */
#notes_container {
	display: none;
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease-out;
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 10;
	background: white;
	border: 1px solid var(--grid-color);
}

#notes_header {
	background-color: #f9f9f9;
	border-bottom: 1px solid var(--grid-color);
	text-align: left;
}

#save_close_notes_btn {
	background-color: white;
	color: var(--grid-color);
	border: none;
	border-right: 1px solid var(--grid-color);
	border-radius: 0;
	padding: 6px 16px 6px 16px;
	cursor: pointer;
	font-size: 14px;
	font-weight: normal;
	transition: opacity 0.2s;
	display: inline-block;
	font-family: inherit;
}

#save_close_notes_btn:hover {
	opacity: 0.7;
}

#showLoginOverlay {
    font-size: 1rem;
    border: 1px solid var(--grid-color);
    display: block;
    padding: 0.7em;
    text-decoration: none;
    color: var(--grid-color);
}


#save_success_message {
	margin-left: 12px;
	color: #4caf50;
	font-size: 14px;
	font-weight: 500;
	opacity: 0;
	transition: opacity 0.3s;
	display: inline-block;
}

#save_success_message.show {
	opacity: 1;
}

#notes_text {
	width: 100%;
	height: 304px;
	margin: 0;
	padding: 10px;
	border: none;
	resize: none;
	overflow-y: auto;
	font-family: inherit;
	font-size: 14px;
	box-sizing: border-box;
	cursor: text;
	caret-color: auto;
	color: var(--grid-color);
	outline: none;
}

#notes_text::placeholder {
	color: var(--grid-color);
	opacity: 0.5;
}

/* Chapter text display styles */
#chapter_text_container {
	display: none;
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #f9f9f9;
	box-sizing: border-box;
	z-index: 10;
	padding: 0;
}

#chapter_text_header {
	display: flex;
	justify-content: center;
	align-items: center;
	position: relative;
	padding: 10px 15px;
	border-bottom: 1px solid var(--grid-color);
	background-color: #f9f9f9;
}

#chapter_text_content {
	height: calc(100% - 51px);
	overflow-y: auto;
	padding: 15px;
	box-sizing: border-box;
}

#close_chapter_text_btn {
	background-color: transparent;
	color: var(--grid-color);
	border: 1px solid var(--grid-color);
	border-radius: 4px;
	padding: 6px 16px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	transition: opacity 0.2s;
}

#close_chapter_text_btn:hover {
	opacity: 0.7;
}

#verse_count_display {
	position: absolute;
	right: 15px;
	font-size: 12px;
	color: #666;
}

.section-title {
	font-weight: bold;
	font-size: 16px;
	margin: 15px 0 10px 0;
	color: var(--grid-color);
	text-align: left;
}

.verse-line {
	display: block;
	margin: 5px 0;
	line-height: 1.6;
	text-align: left;
}

.verse-number {
	display: inline;
	font-weight: bold;
	color: var(--grid-color);
	margin-right: 5px;
}

.verse-text {
	display: inline;
}

/* Smartphones (portrait) ----------- */
@media only screen and (max-width : 425px) {
    /* Styles */
    .grid {
        display: grid;
        grid-template-columns: repeat(30, var(--mobile-cell-size));
        grid-template-rows: repeat(40, var(--mobile-cell-size));
        grid-gap: 1px;
        background: var(--grid-color);
    }

}