:root {
    --primary-color: #2c4f6e;
    --secondary-color: #e6eef4;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --sidebar-bg: #fff;
    --header-bg: #fff;
    --border-color: #dee2e6;
    --hover-color: #1a3f5c;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Crimson Text', serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: var(--header-bg);
    padding: 1rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

h1 {
    font-family: 'Playfair Display', serif;
    color: var(--primary-color);
    font-size: 2rem;
}

.search-container {
    display: flex;
    gap: 0.5rem;
}

#searchInput {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 300px;
    font-family: inherit;
}

button {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: var(--hover-color);
}

main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.navigation-controls {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: end;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.input-group select {
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-color);
}

.input-group select:hover {
    border-color: var(--primary-color);
}

.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--shadow-color);
}

.input-group optgroup {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.input-group option {
    padding: 8px;
    color: var(--text-color);
    font-weight: normal;
}

.nav-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.nav-buttons button {
    padding: 0.8rem 1rem;
    height: 100%;
}

.current-reference {
    margin-bottom: 2rem;
}

.current-reference h2 {
    font-family: 'Playfair Display', serif;
    color: var(--primary-color);
    font-size: 1.8rem;
}

.verse-content {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.verse {
    margin: 1em 0;
    line-height: 1.6;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 1em;
}

.verse-number {
    color: #2c4f6e;
    font-weight: bold;
    font-size: 0.8em;
    min-width: 2em;
    text-align: right;
    padding-top: 0.2em;
    user-select: none;
    opacity: 0.7;
}

.verse-text {
    flex: 1;
}

.verse.selected {
    background-color: rgba(44, 79, 110, 0.1);
    border-radius: 4px;
    padding: 0.5em;
}

.verse.selected .verse-number {
    opacity: 1;
}

.bottom-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.bottom-navigation button {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bottom-navigation button:hover {
    background-color: var(--hover-color);
}

.welcome-message {
    text-align: center;
    padding: 2rem;
}

.welcome-message h3 {
    font-family: 'Playfair Display', serif;
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.welcome-message ul {
    list-style-position: inside;
    text-align: left;
    max-width: 400px;
    margin: 1rem auto;
}

footer {
    text-align: center;
    padding: 2rem;
    background-color: var(--header-bg);
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.reading-stats {
    margin: 1.5em 0;
    padding: 1.5em;
    background-color: #e6eef4;
    border-radius: 8px;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stats-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2em;
}

.stats-group {
    display: flex;
    flex-direction: column;
    gap: 1em;
    min-width: max-content;
}

.reading-time, .total-time, .chapters-read, .last-read, .reading-streak, .daily-goal {
    display: flex;
    align-items: center;
    gap: 0.8em;
    font-size: 1.1em;
    color: #2c4f6e;
    white-space: nowrap;
}

.reading-time i, .total-time i, .chapters-read i, .last-read i, .reading-streak i, .daily-goal i {
    color: #2c4f6e;
    opacity: 0.8;
    width: 1.2em;
    text-align: center;
}

.reading-streak i {
    color: #e67e22;
}

.daily-goal i {
    color: #27ae60;
}

.last-read span {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reading-streak, .daily-goal {
    display: flex;
    align-items: center;
    gap: 0.8em;
    font-size: 1.1em;
    color: #2c4f6e;
    white-space: nowrap;
    position: relative;
}

.reading-streak i {
    color: #e67e22;
}

.daily-goal i {
    color: #27ae60;
}

.info-btn, .edit-goal-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #2c4f6e;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.info-btn:hover, .edit-goal-btn:hover {
    opacity: 1;
}

.goal-progress {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background-color: rgba(44, 79, 110, 0.1);
    border-radius: 2px;
    margin-top: 0.3em;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #27ae60;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.reading-streak[title]:hover::after,
.daily-goal[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5em 1em;
    background-color: #2c4f6e;
    color: white;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    z-index: 1000;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 2em;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 90%;
}

.modal-header {
    font-size: 1.2em;
    color: #2c4f6e;
    margin-bottom: 1em;
}

.modal-body {
    margin-bottom: 1.5em;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1em;
}

@media (max-width: 1200px) {
    .stats-row {
        flex-wrap: wrap;
        gap: 1.5em;
    }

    .stats-group {
        flex: 1;
        min-width: 200px;
        align-items: center;
    }

    .study-timer {
        width: 100%;
        order: -1;
        margin-bottom: 1em;
    }
}

@media (max-width: 1024px) {
    .stats-row {
        flex-direction: column;
        gap: 1em;
    }

    .study-timer {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8em;
    }

    .timer-label {
        width: 100%;
        text-align: center;
        order: -1;
    }

    .timer-display {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    main {
        flex-direction: column;
    }

    .search-container {
        width: 100%;
    }

    #searchInput {
        width: 100%;
    }

    .navigation-controls {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .nav-buttons {
        justify-content: space-between;
    }

    .reading-stats {
        padding: 1em;
    }

    .study-timer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8em;
    }

    #timerInput {
        width: 100%;
    }

    .timer-btn {
        justify-content: center;
    }

    .timer-display {
        text-align: center;
        margin-top: 0.5em;
    }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.timer-display.ending {
    color: #e74c3c;
    animation: pulse 1s infinite;
}

.study-timer {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 0.8em 1em;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    flex: 1;
    min-width: 0;
}

.timer-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.3em;
}

.timer-label {
    font-size: 0.85em;
    color: #2c4f6e;
    opacity: 0.8;
    text-align: left;
}

#timerInput {
    width: 100px;
    padding: 0.8em;
    border: 1px solid rgba(44, 79, 110, 0.2);
    border-radius: 4px;
    font-size: 1em;
    background-color: white;
}

#timerInput:focus {
    outline: none;
    border-color: #2c4f6e;
}

#timerInput::placeholder {
    color: #2c4f6e;
    opacity: 0.6;
}

#timerInput:hover {
    cursor: help;
}

#timerInput::-webkit-inner-spin-button, 
#timerInput::-webkit-outer-spin-button { 
    opacity: 1;
    height: 24px;
}

@media (max-width: 1024px) {
    .timer-input-wrapper {
        width: 100%;
        align-items: center;
    }

    #timerInput {
        width: 100%;
        max-width: 200px;
    }
}

.timer-btn {
    padding: 0.8em 1.2em;
    border: none;
    border-radius: 4px;
    background-color: #2c4f6e;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 1em;
    white-space: nowrap;
}

.timer-btn:hover {
    background-color: #1e3a52;
    transform: translateY(-1px);
}

.timer-btn:active {
    transform: translateY(0);
}

.timer-display {
    font-size: 1.2em;
    font-weight: bold;
    color: #2c4f6e;
    min-width: 80px;
    text-align: center;
    font-family: 'Courier New', monospace;
    margin-left: auto;
}
