/* --- Reset & Base --- */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f4f9;
    color: #333;
    line-height: 1.6;
}

/* --- Layout Shell --- */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Top Bar --- */
.top-bar {
    background-color: #2c3e50;
    color: #fff;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-mark {
    background: #e74c3c;
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 4px;
}

.logo-text {
    font-weight: 600;
    font-size: 1.1rem;
}

.lang-select {
    padding: 6px 10px;
    font-size: 0.95rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: white;
    cursor: pointer;
}

/* --- Main Layout (Sidebar + Content) --- */
.layout {
    display: flex;
    flex: 1;
    flex-direction: column;
}

@media (min-width: 768px) {
    .layout {
        flex-direction: row;
    }
}

/* --- Sidebar --- */
.sidebar {
    width: 100%;
    background: #fff;
    border-right: 1px solid #ddd;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 768px) {
    .sidebar {
        width: 300px;
        flex-shrink: 0;
        height: calc(100vh - 64px); /* Full height minus header */
        overflow-y: auto;
    }
}

.sidebar-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #888;
    margin: 0 0 0.5rem 0;
    letter-spacing: 0.5px;
}

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

.field-group label {
    font-size: 0.9rem;
    font-weight: 500;
}

select {
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    background: #fff;
}

select:disabled {
    background: #f9f9f9;
    color: #aaa;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-item {
    font-size: 0.9rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    color: #555;
}

/* --- Content Area --- */
.content {
    flex: 1;
    /* AANGEPAST: Op mobiel 0 padding, zodat het de volledige breedte pakt */
    padding: 0; 
    overflow-y: auto;
    /* max-width en margin auto zorgen dat hij op desktop gecentreerd blijft */
    max-width: 900px; 
    margin: 0 auto;
    width: 100%;
}

/* Pas op desktop (vanaf 768px) voegen we de ruimte eromheen weer toe */
@media (min-width: 768px) {
    .content {
        padding: 1.5rem;
    }
}

.study-card {
    background: #fff;
    /* AANGEPAST: Op mobiel iets compactere padding binnenin (1.5rem ipv 2rem) */
    padding: 1.5rem; 
    /* AANGEPAST: Op mobiel rechthoekig en geen schaduw (strakker) */
    border-radius: 0; 
    box-shadow: none; 
    /* Optioneel: een lijntje bovenop om het te scheiden van de sidebar erboven */
    border-top: 1px solid #e0e0e0;
    min-height: 50vh; /* Zorgt dat het wit in ieder geval flink doorloopt */
}

/* Op desktop maken we er weer die mooie zwevende kaart van */
@media (min-width: 768px) {
    .study-card {
        padding: 2rem;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        border-top: none;
        min-height: auto;
    }
}

/* Header & Length Toggle */
.study-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.study-label {
    font-size: 0.85rem;
    color: #e74c3c;
    font-weight: 700;
    text-transform: uppercase;
    margin: 0;
}

#current-reference {
    margin: 0.25rem 0 0 0;
    font-size: 1.5rem;
    line-height: 1.2;
}

.study-meta-bar {
    margin-bottom: 2rem;
    color: #666;
    font-size: 0.9rem;
}

.length-toggle {
    display: flex;
    background: #eee;
    padding: 4px;
    border-radius: 6px;
}

.length-btn {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    transition: all 0.2s;
}

.length-btn.active {
    background: #fff;
    color: #2c3e50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Document Text */
.document-container {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2c3e50;
    min-height: 100px;
}

.placeholder {
    color: #999;
    font-style: italic;
}

.section-divider {
    border: 0;
    height: 1px;
    background: #e0e0e0;
    margin: 3rem 0 2rem 0;
}

/* --- Accordions (Reflection / Prayer) --- */
details.accordion {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 1rem;
    background: #fff;
    overflow: hidden;
}

details.accordion.hidden {
    display: none;
}

details.accordion summary {
    padding: 1rem 1.25rem;
    cursor: pointer;
    list-style: none; /* Hide default marker */
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #374151;
    background-color: #f9fafb;
    transition: background-color 0.2s;
    user-select: none;
}

details.accordion summary:hover {
    background-color: #f3f4f6;
}

details.accordion summary::-webkit-details-marker {
    display: none;
}

.accordion-icon {
    transition: transform 0.25s ease;
    font-size: 0.75rem;
    color: #9ca3af;
}

details.accordion[open] summary .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    line-height: 1.7;
    color: #1f2937;
    background: #fff;
}

/* --- Status & Loading --- */
.status-message {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #888;
    text-align: right;
    height: 1.5em; 
}

.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

.hidden {
    display: none !important;
}