/* --- Base Tab Styles (from previous versions, keep these) --- */
.theologie-tabs-wrapper {
    border: 1px solid #eee;
    border-radius: 8px;
    background-color: var(--couleur_blanche);
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

.theologie-tabs-nav { /* Top horizontal tabs (Niveau 0) */
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #eee;
    background-color: #f9f9f9;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    padding: 10px;
}

.theologie-tab-button {
    background: none;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-right: 5px;
}

.theologie-tab-button:hover {
    color: #0073aa;
    border-bottom-color: #ddd;
}

.theologie-tab-button.active {
    color: var(--couleur_noire);
    border: 1px solid var(--couleur_noire);
    background-color: var(--couleur_blanche);
    border-radius: 5px;
}

.theologie-main-content-area { /* Main area containing all dynamic levels */
    padding: 20px;
    min-height: 200px;
    position: relative;
    display: flex; /* Allow level 2 and level 3 to be side-by-side */
    flex-direction: column; /* Default to column, adjust for level 2 */
}

.theologie-content-area { /* Inner area where AJAX response is placed */
    flex-grow: 1; /* Take available space */
}


.theologie-content-area h2 { /* Title of the currently selected main tab */
	margin-top: 0;
    color: #333;
    font-size: var(--font-size_titre);
    margin-bottom: 15px;
    font-family: var(--font-family_titre);
}

.term-description { /* Description of the currently selected main tab */
	margin-bottom: 20px;
    padding: 15px;
    background-color: #f7f7f7;
    border-left: 4px solid var(--couleur_rouge);
    border-radius: 4px;
}

/* Main loading spinner for content area */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

/* Smaller spinner for sub-theme buttons */
.loading-spinner-small {
    display: inline-block;
    vertical-align: middle;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* --- Styles for Level 1: Sub-theme Buttons (Horizontal) --- */
.theologie-sub-theme-buttons-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px; /* Space between buttons */
    margin-top: 20px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee; /* Separator from next level */
}

.theologie-level1-button {
	background: #e9f5fe;
    border: 1px solid #b3d9ff;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 1em;
    font-weight: initial;
    color: var(--couleur_noire);
    border-radius: 5px;
    transition: all 0.2s ease;
}

.theologie-level1-button:hover {
    background-color: #d8edf8;
    border-color: #8cc3ea;
}

.theologie-level1-button.active {
    background-color: var(--couleur_noire);
    color: var(--couleur_blanche);
    border-color: var(--couleur_noire);
}

/* --- Styles for Level 2: Sub-sub-theme Tabs (Vertical) & Content --- */
.theologie-level-container { /* This is #theologie-level1-content */
    display: flex; /* Enable side-by-side for level 2 tabs and level 2 content */
    flex-direction: row; /* Default layout for Level 2 */
    margin-top: 20px;
    min-height: 150px; /* Ensure space for tabs */
}

.theologie-level2-wrapper { /* Contains the level 2 tabs and their content */
    display: flex;
    flex-direction: row; /* Side-by-side layout */
    width: 100%; /* Take full width of parent */
}

.theologie-level2-tabs-nav { /* Vertical tabs navigation */
    display: flex;
    flex-direction: column; /* Stack tabs vertically */
    flex-shrink: 0; /* Don't shrink */
    width: 200px; /* Fixed width for tabs */
    border-right: 1px solid #eee;
    padding-right: 15px;
    margin-right: 15px;
    background-color: #fcfcfc;
    border-radius: 5px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.theologie-level2-tab {
    background: none;
    border: none;
    text-align: left;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1em;
    text-decoration: underline;
    color: var(--couleur_noire);
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    margin-bottom: 5px;
    border-radius: 3px;
}

.theologie-level2-tab:hover {
    color: #0073aa;
    background-color: #f0f8ff;
    border-left-color: #0073aa;
}

.theologie-level2-tab.active {
    color: var(--couleur_noire);
    background: #e9f5fe;
    border: 1px solid #b3d9ff;
    border-radius: 5px;
}

.theologie-level2-content-area { /* Content area for Level 2 tabs (articles) */
    flex-grow: 1; /* Take remaining width */
    padding-left: 15px; /* Add some left padding */
}

/* --- Styles for Level 3: Articles --- */
.theologie-articles-section h4 { /* Title for the list of articles */
    margin-top: 0;
    margin-bottom: 15px;
    color: #555;
    font-size: 1.3em;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.theologie-articles-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.theologie-articles-section li {
    margin-bottom: 10px;
}

.theologie-article-toggle { /* Article toggle button */
	background: var(--couleur_blanche);
    border: 1px solid #ddd;
    padding: 12px 15px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 1.05em;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px;
}

.theologie-article-toggle:hover {
    background-color: #f5f5f5;
    color: #00568c;
    border-color: #ccc;
}

.theologie-article-toggle h4 {
    margin: 0;
    font-size: 1em;
    border: none;
    font-family: var(--font-family_titre);
    color: var(--couleur_primaire);
}

.theologie-article-toggle i.fa-solid {
    margin-left: 10px;
    transition: transform 0.3s ease;
}

.theologie-article-toggle i.fa-chevron-up {
    transform: rotate(180deg);
}

.theologie-article-content { /* Article content */
    padding: 15px;
    margin-top: 5px;
    background-color: #fdfdfd;
    border: 1px solid #eee;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}

.theologie-article-content p:last-child {
    margin-bottom: 0;
}

.term-description-nested { /* Description for sub-terms */
    margin-top: 5px;
    margin-bottom: 10px;
    padding: 8px 12px;
    background-color: #fbfdff;
    border-left: 3px solid #b3d9ff;
    border-radius: 3px;
    font-size: 0.9em;
    color: #555;
}

.no-content-message {
    font-style: italic;
    color: #888;
    padding: 15px;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .theologie-tabs-nav {
        flex-direction: column;
    }
    .theologie-tab-button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 5px;
    }

    .theologie-sub-theme-buttons-wrapper {
        flex-direction: column;
    }
    .theologie-level1-button {
        width: 100%;
    }

    .theologie-level-container,
    .theologie-level2-wrapper {
        flex-direction: column;
    }

    .theologie-level2-tabs-nav {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
        padding-right: 0;
        margin-right: 0;
        padding-bottom: 10px;
        margin-bottom: 10px;
    }
    .theologie-level2-tab {
        text-align: center; /* Center vertical tabs on mobile */
        border-left: none;
        border-bottom: 3px solid transparent; /* Bottom border for active mobile tab */
        margin-left: 5px;
        margin-right: 5px;
    }
    .theologie-level2-tab.active {
        border-left-color: transparent;
        border-bottom-color: #0073aa;
    }
    .theologie-level2-content-area {
        padding-left: 0;
    }
}