/* Grundlegende Reset-Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --base-font-size: 16px;
    --primary-color: rgb(81, 165, 71);
    --primary-color-dark: rgb(60, 130, 52);
    --background-color: #f9f9f9;
    --text-color: #333;
    --section-background: white;
    --refrain-background: #f5f5f5;
    --border-color: #eaeaea;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    padding-bottom: 60px;
}

/* Gottesdienst-Auswahl */
#service-selector {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1.5rem;
    background-color: var(--section-background);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#service-selector h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.selector-logo {
    max-width: 150px;
    margin-bottom: 0.5rem;
}

.service-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.service-buttons button {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    padding: 1rem;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.service-buttons button:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Lade-Indikator */
.loading-spinner {
    padding: 2rem;
    text-align: center;
    color: #888;
    font-style: italic;
}

.no-services, .error-message {
    padding: 2rem;
    text-align: center;
    color: #888;
}

.error-message {
    color: #c0392b;
}

/* Kompakter grüner Header */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    max-width: 800px;
    margin: 0 auto;
}

.header-logo {
    height: 36px;
    width: auto;
    flex-shrink: 0;
}

.header-text {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.6rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

.header-title {
    font-weight: bold;
    font-size: 1.05rem;
}

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

.header-location {
    opacity: 0.8;
    font-size: 0.85rem;
}

/* Toolbar: Nav + Textgröße + Zurück in einer Zeile */
nav {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.5rem;
    background-color: #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    gap: 0.3rem;
}

nav button, .size-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
    flex-shrink: 0;
}

nav button:hover, .size-btn:hover {
    background-color: var(--primary-color-dark);
}

nav button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#back-to-selection {
    background-color: #666;
    font-size: 0.9rem;
}

#back-to-selection:hover {
    background-color: #444;
}

.toolbar-spacer {
    flex-grow: 0;
    width: 1px;
    height: 20px;
    background-color: #ccc;
    margin: 0 0.2rem;
    flex-shrink: 0;
}

.nav-short { display: none; }
.nav-full { display: inline; }

#section-select {
    flex-grow: 1;
    min-width: 0;
    padding: 0.35rem 0.3rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    font-size: 0.85rem;
}

.font-size-small { font-size: 14px; }
.font-size-normal { font-size: var(--base-font-size); }
.font-size-large { font-size: 18px; }
.font-size-xlarge { font-size: 20px; }
.font-size-xxlarge { font-size: 22px; }

/* Main Content */
main {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.service-section {
    display: none;
    background-color: var(--section-background);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.service-section.active { display: block; }

.service-section h2 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.heading {
    font-weight: bold;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.copyright {
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 1.5rem;
    font-style: italic;
    color: #666;
}

.verse, .refrain {
    margin-bottom: 1.2rem;
}

.refrain {
    background-color: var(--refrain-background);
    padding: 0.8rem;
    border-left: 3px solid var(--primary-color);
    border-radius: 0 4px 4px 0;
}

/* Text-Blöcke: Psalm, Gebet, Text */
.text-block {
    margin-top: 0.5rem;
}

.text-block-gebet {
    border-left: 3px solid var(--primary-color);
    padding-left: 1rem;
}

.text-block p {
    margin-bottom: 1rem;
}

/* Psalm Zitat-Blöcke (> in Markdown) */
.psalm-quote {
    margin: 0.8rem 0;
    padding: 0.6rem 1rem;
    border-left: 3px solid var(--primary-color);
    background-color: #f2f9f1;
    font-style: italic;
    border-radius: 0 4px 4px 0;
}

.psalm-quote p {
    margin-bottom: 0;
}

/* Noten-Button (Outline) */
.sheet-button {
    display: inline-block;
    margin: 0.5rem auto 1rem;
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    padding: 0.4rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.2s;
}

.sheet-button:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Noten-Button in Section zentriert */
.service-section .sheet-button {
    display: block;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* Noten-Button in Übersicht inline */
.sheet-button-inline {
    display: inline-block;
    margin: 0 0 0 0.5rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    vertical-align: middle;
}

/* Noten-Modal */
.sheet-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sheet-modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
}

.sheet-modal-content {
    position: relative;
    background: white;
    border-radius: 8px;
    max-width: 95vw;
    max-height: 95vh;
    overflow: auto;
    padding: 1rem;
}

.sheet-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #c0392b;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}

.sheet-modal-close:hover {
    background: #922b21;
}

.sheet-image {
    max-width: 90vw;
    max-height: 85vh;
    display: block;
    margin: 0 auto;
}

.sheet-pdf {
    width: 90vw;
    height: 85vh;
    border: none;
}

/* Namensliste */
.name-list {
    list-style: none;
    margin: 1rem 0;
}

.name-list li {
    margin-bottom: 0.3rem;
}

/* Übersichtsseite */
.section-list {
    list-style: none;
}

.section-list li {
    margin-bottom: 0.8rem;
}

.section-link {
    background: none;
    border: none;
    padding: 0.5rem;
    font-size: 1.1rem;
    color: var(--primary-color);
    cursor: pointer;
    text-align: left;
    width: 100%;
    display: block;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.section-link:hover {
    background-color: #f0f0f0;
}

/* Footer */
footer {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    padding: 0.5rem;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 480px) {
    .header-text { font-size: 0.85rem; }
    .header-title { font-size: 0.95rem; }
    .header-logo { height: 28px; }

    nav { padding: 0.3rem; gap: 0.2rem; }
    nav button, .size-btn {
        padding: 0.4rem 0.6rem;
        font-size: 1rem;
        min-width: 36px;
        min-height: 36px;
    }
    .nav-short { display: inline; }
    .nav-full { display: none; }
    #section-select { margin: 0 0.1rem; font-size: 0.8rem; }

    .service-section { padding: 1rem; }
    .service-buttons button {
        padding: 1rem;
        font-size: 1rem;
        min-height: 48px;
    }
    .sheet-modal-content { padding: 0.5rem; }
    .sheet-image { max-width: 100vw; }
    .sheet-pdf { width: 100vw; height: 90vh; }
}

@media (min-width: 768px) {
    .service-section { padding: 2rem; }
    .header-logo { height: 44px; }
}
