/* Reset and Base Styles */
:root{
    --bg: #1a1f2e;
    --page: #0a0e1a;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --line: #374151;
    --card: #1a1f2e;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    --primary: #2f6fed;
    --primary-dark: #2559c2;
    --pill: #2d3748;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: linear-gradient(to bottom, #0a0e1a 0%, #1a1f2e 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    line-height: 1.6;
}

a { color: inherit; }
a:hover { text-decoration: none; }

/* Topbar */
.topbar{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 15;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    transition: transform 0.3s ease-in-out;
}

.topbar-inner{
    max-width: 100%;
    margin: 0;
    padding: 20px 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
}

.topbar-title-spacer{
    width: 32px;
    height: 32px;
}

.day-indicator-wrapper{
    flex: 1;
    display: flex;
    justify-content: center;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 0;
    background-color: #101010;
    border-top: 1px solid #1a1a1a;
    z-index: 100;
    transition: transform 0.3s ease-in-out;
}

.bottom-nav.nav-hidden {
    transform: translateY(100%);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #fff;
    cursor: pointer;
    padding: 4px 12px;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    text-decoration: none;
}

.bottom-nav-item a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: #ffd700;
}

.bottom-nav-item span {
    font-size: 12px;
    font-weight: 500;
}

.bottom-nav-item svg {
    width: 24px;
    height: 24px;
    stroke-width: 1;
}

.bible-title{
    font-family: 'Crimson Pro', serif;
    font-size: 32px;
    font-weight: 400;
    color: var(--text);
    margin: 0;
    line-height: 1;
}

.chapter-selector-row{
    padding: 0 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    min-height: 48px;
}

.day-navigation-left{
    display: flex;
    align-items: center;
    gap: 12px;
}

.day-navigation-center{
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1;
    pointer-events: none;
}
.day-navigation-center button{
    pointer-events: auto;
}

.day-navigation-right{
    margin-left: auto;
    display: flex;
    align-items: center;
}

.completion-checkmark{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}
.completion-checkmark svg{
    width: 100%;
    height: 100%;
}

.day-indicator{
    font-size: 16px;
    font-weight: 800;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.chapter-btn{
    background: #40E0D0;
    color: #ffffff;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 160ms ease;
}
.chapter-btn:hover{
    background: #35c9b8;
}

.nav-arrow-btn{
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #8b6f47;
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    margin-left: auto;
    transition: all 160ms ease;
}
.nav-arrow-btn:hover{
    background: #7a5f3a;
}

.topnav{
    display: flex;
    align-items: center;
    gap: 18px;
}
.topnav-link{
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
}
.topnav-link.is-active{
    color: var(--text);
}

.topbar-actions{
    display: flex;
    align-items: center;
    gap: 8px;
}

.circle-btn{
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    cursor: pointer;
    color: #ffffff;
    font-weight: 600;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 160ms ease;
}
.circle-btn:hover{
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}
.circle-btn span{
    line-height: 1;
}

.icon-btn{
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg);
    cursor: pointer;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding: 0;
    min-width: 44px;
    min-height: 44px;
    /* Ensure touch target is large enough on mobile */
    touch-action: manipulation;
}
.icon-btn:hover{
    color: var(--text);
}

/* Make close buttons even larger on mobile devices */
@media (max-width: 768px) {
    .icon-btn {
        width: 50px;
        height: 50px;
        min-width: 50px;
        min-height: 50px;
        font-size: 24px;
    }
}

/* Modal (Search) */
.sr-only{
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.modal{
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
}
.modal.is-open{
    display: block;
}
.modal-backdrop{
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
}
.modal-card{
    position: relative;
    max-width: 760px;
    margin: 80px auto 0;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.modal-small{
    max-width: 400px;
}
.modal-day-list{
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.modal-head{
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}
.modal-title{
    font-weight: 800;
    letter-spacing: -0.01em;
}
.modal-body{
    padding: 16px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.day-list-container{
    max-height: calc(80vh - 120px);
    overflow-y: auto;
    padding: 4px 0;
}

.day-list-item{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 160ms ease;
    border: 1px solid transparent;
    margin-bottom: 4px;
}

.day-list-item:hover{
    background: rgba(64, 224, 208, 0.1);
    border-color: rgba(64, 224, 208, 0.3);
}

.day-list-item.is-active{
    background: rgba(64, 224, 208, 0.15);
    border-color: #40E0D0;
}

.day-list-item-number{
    font-weight: 700;
    color: var(--muted);
    font-size: 14px;
    min-width: 50px;
}

.day-list-item.is-active .day-list-item-number{
    color: #40E0D0;
}

.day-list-item-ref{
    flex: 1;
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
    text-align: left;
    margin-left: 12px;
}

.day-list-item-check{
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 160ms ease;
}

.day-list-item.is-complete .day-list-item-check{
    opacity: 1;
}

.day-list-item-check svg{
    width: 16px;
    height: 16px;
}
.search-form{
    display: flex;
    gap: 10px;
    align-items: center;
}
.search-input{
    flex: 1;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 0 12px;
    font-weight: 700;
    font-size: 16px; /* Prevent mobile zoom on focus */
    outline: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.search-input:focus{
    border-color: rgba(47, 111, 237, 0.6);
    box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.12);
}
.search-meta{
    margin-top: 10px;
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
}
.search-results{
    margin-top: 12px;
    max-height: min(60vh, 520px);
    overflow: auto;
    padding-right: 4px;
}
.search-error{
    padding: 12px;
    border: 1px solid rgba(220, 38, 38, 0.35);
    background: rgba(220, 38, 38, 0.06);
    border-radius: 12px;
    color: #991b1b;
    font-weight: 700;
}

.font-size-controls{
    padding: 20px 0;
}
#fontSizeSlider{
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--line);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
#fontSizeSlider::-webkit-slider-thumb{
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid var(--bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
#fontSizeSlider::-moz-range-thumb{
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid var(--bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
#fontSizeSlider:focus{
    outline: none;
}
#fontSizeSlider:focus::-webkit-slider-thumb{
    box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.2);
}
#fontSizeSlider:focus::-moz-range-thumb{
    box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.2);
}
.font-size-display{
    margin-top: 16px;
    text-align: center;
}
#fontSizeValue{
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.theme-controls{
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-label{
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.theme-buttons{
    display: flex;
    gap: 8px;
}

.theme-btn{
    flex: 1;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 160ms ease;
}

.theme-btn-active{
    background: #f9fafb;
    color: #111827;
    border-color: #f9fafb;
}

body.page-theme-light{
    background: #f9fafb;
    color: #111827;
}

body.page-theme-light .topbar{
    background: #ffffff;
    border-bottom-color: #e5e7eb;
}

body.page-theme-light .page{
    background: #f9fafb;
}

body.page-theme-light .scripture-content{
    color: #111827;
}

body.page-theme-light .bottom-nav{
    background-color: #ffffff;
    border-top-color: #e5e7eb;
}

.day-select-controls{
    display: flex;
    flex-direction: column;
    gap: 12px;
}
#daySelectInput{
    width: 100%;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 0 12px;
    font-weight: 700;
    font-size: 16px;
    outline: none;
    background: var(--bg);
    color: var(--text);
}
#daySelectInput:focus{
    border-color: rgba(47, 111, 237, 0.6);
    box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.12);
}


/* Page + Card */
.page{
    padding: 26px 20px 96px;
    padding-bottom: 120px; /* Extra padding for bottom nav */
}
.content{
    max-width: 760px;
    margin: 0 auto;
    display: grid;
    gap: 18px;
}

.card{
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-muted{
    box-shadow: none;
}
.card-head{
    padding: 22px 22px 14px;
}
.card-body{
    padding: 0 22px 22px;
}

.kicker{
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.plan-title{
    margin-top: 8px;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.day-row{
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.day-label{
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.day-controls{
    display: flex;
    align-items: center;
    gap: 10px;
}
.pill-btn{
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg);
    cursor: pointer;
    color: var(--muted);
    font-size: 18px;
}
.pill-btn:hover{
    color: var(--text);
}

.day-select{
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg);
    padding: 0 12px;
    font-weight: 800;
    color: var(--text);
    outline: none;
    cursor: pointer;
    min-width: 140px;
}
.day-select:focus{
    border-color: rgba(47, 111, 237, 0.6);
    box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.12);
}

.section-head{
    padding-top: 8px;
    margin-top: 12px;
}
.section-title{
    font-size: 16px;
    font-weight: 700;
    margin-top: 12px;
}

.scripture-list{
    list-style: none;
    margin-top: 10px;
    display: grid;
    gap: 10px;
}
.scripture-item{
    padding: 14px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.scripture-item a{
    text-decoration: none;
    font-weight: 700;
}
.scripture-item small{
    color: var(--muted);
    font-weight: 600;
}
.read-btn{
    color: #40E0D0;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(64, 224, 208, 0.1);
    border: 1px solid rgba(64, 224, 208, 0.3);
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: all 160ms ease;
}
.read-btn:hover{
    background: rgba(64, 224, 208, 0.2);
    border-color: rgba(64, 224, 208, 0.5);
}
.read-btn:active{
    background: rgba(64, 224, 208, 0.3);
}
.scripture-item.skeleton{
    height: 52px;
    background: linear-gradient(90deg, #f3f4f6 0%, #eceff4 50%, #f3f4f6 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite linear;
    border-color: #edf0f5;
}
@keyframes shimmer{
    0%{ background-position: 0% 0%; }
    100%{ background-position: 200% 0%; }
}

.cta-row{
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn{
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    background: var(--bg);
}
.btn-primary{
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover{
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-ghost{
    border-color: var(--line);
    color: var(--muted);
}
.btn-ghost:hover{
    color: var(--text);
}
.btn-wide{
    padding-left: 18px;
    padding-right: 18px;
}

/* Scripture Text Styling */
.scripture-content {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    font-size: 1.12rem;
    line-height: 1.8;
    padding: 20px;
    max-width: 100%;
    margin: 0;
}

.section-title-large {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    font-size: 24px;
    font-style: italic;
    font-weight: 400;
    color: var(--text);
    margin: 0 0 24px 0;
    line-height: 1.4;
}

.chapter-header {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-top: 26px;
    margin-bottom: 10px;
}

.chapter-block {
    position: relative;
    margin-bottom: 32px;
}

.verse-num {
    font-size: 0.75em;
    font-weight: bold;
    color: #d64541; /* Red verse numbers */
    vertical-align: super;
    margin-right: 4px;
    user-select: none; /* Don't copy verse numbers when selecting text */
}

.divider{
    height: 1px;
    background: var(--line);
    margin-top: 18px;
}

.chapter-navigation{
    margin-top: 32px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.nav-arrow-btn-large{
    width: 60px;
    height: 60px;
    border-radius: 999px;
    background: transparent;
    color: #ffffff;
    border: 2px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 28px;
    transition: all 160ms ease;
    box-shadow: 0 4px 12px rgba(64, 224, 208, 0.3);
}

.nav-arrow-btn-large:hover{
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(64, 224, 208, 0.4);
}

.nav-arrow-btn-large:active{
    transform: scale(0.95);
}

.complete-day-btn-large{
    width: 60px;
    height: 60px;
    border-radius: 999px;
    background: transparent;
    color: #ffffff;
    border: 2px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 32px;
    transition: all 160ms ease;
    box-shadow: 0 4px 12px rgba(47, 111, 237, 0.3);
}

.complete-day-btn-large:hover{
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(47, 111, 237, 0.4);
}

.complete-day-btn-large:active{
    transform: scale(0.95);
}
.muted{
    color: var(--muted);
    margin-top: 10px;
}

/* Loading Animation */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #111827;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 50px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Tweak */
@media (max-width: 600px) {
    .topnav{ display: none; }
    .plan-title{ font-size: 22px; }
    .card-head, .card-body{ padding-left: 16px; padding-right: 16px; }
    .scripture-content { font-size: 1.05rem; }
    .modal-card{ margin: 56px 12px 0; }
    .page{ padding-bottom: 120px; }
    
    .chapter-selector-row{
        flex-wrap: wrap;
        justify-content: space-between;
        min-height: auto;
        padding-bottom: 20px;
    }
    
    .day-navigation-left{
        flex: 0 0 auto;
        max-width: calc(50% - 6px);
    }
    
    .day-navigation-center{
        position: static;
        transform: none;
        flex: 1 1 100%;
        order: 3;
        justify-content: center;
        align-items: center;
        margin-top: 8px;
        width: 100%;
        max-width: 100%;
        padding: 0;
    }
    
    .day-navigation-right{
        display: none;
    }
}
