/*
 * Spiritual Songs - stylesheet
 * Extracted from an inline <style> block so it can be served as an
 * external, same-origin resource. This allows the site's Content-Security-Policy
 * to use `style-src 'self' https://fonts.googleapis.com` without `'unsafe-inline'`.
 */

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

body {
    font-family: 'Source Sans 3', Arial, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
}

h1 {
    font-size: 1.5em;
    margin-bottom: 5px;
    font-weight: normal;
}

.subtitle {
    font-size: 0.9em;
    opacity: 0.9;
    font-style: italic;
}

.search-section {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.browse-container {
    transition: all 0.3s;
}

.browse-container.hidden {
    display: none;
}

input[type="text"] {
    flex: 1;
    max-width: 400px;
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 25px;
    outline: none;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    border-color: #1e40af;
}

button {
    padding: 12px 24px;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.3s;
}

button:hover {
    background: #1e3a8a;
}

.browse-section {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.browse-btn {
    padding: 8px 20px;
    background: white;
    border: 2px solid #1e40af;
    color: #1e40af;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.browse-btn:hover,
.browse-btn.active {
    background: #1e40af;
    color: white;
}

.content-section {
    padding: 30px;
    min-height: 400px;
}

.hymn-list {
    display: grid;
    gap: 8px;
}

.hymn-item {
    padding: 8px 15px;
    background: #f8f9fa;
    border-left: 4px solid #1e40af;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.hymn-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.hymn-number {
    font-weight: bold;
    color: #1e40af;
    margin-right: 10px;
}

.hymn-title {
    font-size: 1.1em;
    color: #333;
}

.hymn-display {
    display: none;
}

.hymn-display.active {
    display: block;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hymn-header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 30px;
}

.hymn-header h2 {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 10px;
}

.hymn-meta {
    color: #666;
    font-style: italic;
}

.hymn-tune {
    margin-top: 6px;
    font-size: 0.85em;
    color: #888;
    font-style: italic;
    letter-spacing: 0.03em;
}

.hymn-tune span {
    font-weight: bold;
    color: #555;
    font-style: normal;
}

.hymn-lyrics {
    line-height: 2;
    font-size: 1.1em;
    color: #444;
}

.stanza {
    margin-bottom: 30px;
    display: flex;
    align-items: flex-start;
}

.verse-number {
    font-weight: bold;
    color: #1e40af;
    margin-right: 0.4em;
    flex-shrink: 0;
    min-width: 1.6em;
    text-align: right;
}

.stanza-text {
    flex: 1;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
}

.chorus {
    margin-left: 40px;
    font-style: italic;
    color: #1e40af;
    margin-bottom: 30px;
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 6px 18px;
    margin-top: 8px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    display: inline-block;
}

/* Hidden by default; toggled to inline-block via JS (backBtn.style.display)
   once a hymn is displayed. Moved here from an inline style="" attribute
   so no style-src 'unsafe-inline' is required. */
#backToIndexBtn {
    display: none;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.toggle-index-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 6px 18px;
    margin-top: 8px;
    margin-left: 8px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    display: inline-block;
}

.toggle-index-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.font-size-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 6px 18px;
    margin-top: 8px;
    margin-left: 8px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    display: inline-block;
}

.font-size-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.dialog-overlay.active {
    display: flex;
}

.dialog {
    background: white;
    border-radius: 10px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.dialog h3 {
    margin-bottom: 20px;
    color: #1e40af;
    text-align: center;
}

.font-size-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.font-size-btn-control {
    padding: 10px 20px;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: background 0.3s;
}

.font-size-btn-control:hover {
    background: #1e3a8a;
}

.font-size-display {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    min-width: 60px;
    text-align: center;
}

.dialog-close {
    width: 100%;
    padding: 12px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    transition: background 0.3s;
}

.dialog-close:hover {
    background: #5a6268;
}

@media (max-width: 600px) {
    body {
        padding: 8px;
    }

    .container {
        border-radius: 6px;
    }

    .content-section {
        padding: 15px 10px;
    }

    .hymn-header {
        padding-bottom: 12px;
        margin-bottom: 16px;
    }

    .chorus {
        margin-left: 20px;
    }

    .hymn-lyrics {
        font-size: 0.95em;
        line-height: 1.8;
    }
}


/* Hymn navigation */
.hymn-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 8px;
}

.hymn-nav button {
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 18px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.hymn-nav button:hover {
    background: #1e3a8a;
}

.hymn-nav button:disabled {
    background: #ccc;
    cursor: default;
}

.hymn-nav-counter {
    font-size: 13px;
    color: #666;
    text-align: center;
    flex: 1;
}

.swipe-hint {
    text-align: center;
    font-size: 11px;
    color: #aaa;
    margin-top: -10px;
    margin-bottom: 10px;
}
