/* כלל גלובלי לחישוב מדויק של רוחב וגובה */
* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    direction: rtl; /* כיוון הדף הראשי (עברית) */
    display: flex; /* שימוש ב-Flexbox כדי למקם את העמודות זו לצד זו */
    height: 100vh;
    overflow: hidden;
}

/* התפריט הצדדי הימני */
.sidebar {
    flex-basis: 250px;
    flex-grow: 0;
    flex-shrink: 0;
    background-color: #f1f1f1;
    padding: 20px;
    min-width: 200px;
    max-width: 500px;
    overflow-y: auto;
    border-left: 1px solid #ddd;
    box-sizing: border-box;
    direction: rtl;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
}

/* סרגל צד שמאלי לחיפוש */
#search-sidebar {
    flex-basis: 200px;
    flex-grow: 0;
    flex-shrink: 0;
    background-color: #f1f1f1;
    padding: 20px 10px;
    min-width: 150px;
    max-width: 400px;
    border-right: 1px solid #ddd;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    direction: rtl;
}

/* אלמנטים ניתנים לשינוי גודל */
.resizer {
    width: 10px;
    cursor: col-resize;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    background-color: #ccc;
}

/* אזור התוכן הראשי */
.content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
}

/* שאר עיצובי הדף נשארים כפי שהם */
.sidebar h2, .sidebar ul, .sidebar a {
    direction: rtl;
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
}

.sidebar a {
    text-decoration: none;
    color: #333;
    display: block;
    padding: 5px 0;
}

.sidebar a:hover {
    color: #0056b3;
}

/* הזחה של 25px בתוכן העניינים */
.sidebar ul ul {
    padding-right: 25px; 
}

/* הכללים החדשים לקווי העץ */
.sidebar li {
    position: relative;
}

.sidebar li > ul::before {
    content: '';
    position: absolute;
    top: 0;
    right: 12.5px;
    bottom: 0;
    border-right: 1px solid #ccc;
    z-index: 1;
}

.sidebar li > ul > li::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 12.5px;
    width: 12.5px;
    border-top: 1px solid #ccc;
    z-index: 1;
}

.sidebar li:not(.expanded) > ul::before,
.sidebar li:not(.expanded) > ul > li::before {
    display: none;
}

h1, h2, h3, h4, p {
    color: #333;
    margin-top: 40px;
}

/* עיצוב החץ של הקיפול (כפתור +/- בתוך ריבוע) */
.toc-toggle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 1em;
    height: 1em;
    cursor: pointer;
    margin-left: 5px;
    font-size: 0.8em;
    border: 1px solid #ccc;
    border-radius: 2px;
    line-height: 1;
    text-align: center;
    z-index: 2;
    background-color: #f1f1f1;
}

/* המצב ההתחלתי: סימן "+" בתוך הריבוע */
.toc-toggle::after {
    content: "+";
}

/* מצב כשהתפריט פתוח: סימן "-" בתוך הריבוע */
.expanded > .toc-item-header > .toc-toggle::after {
    content: "-";
}

.toc-item-header {
    display: flex;
    align-items: center;
    position: relative;
}

.sidebar li a {
    text-decoration: none;
    color: #333;
    padding: 5px 0;
    position: relative;
    z-index: 2;
}

.sidebar ul ul {
    display: none;
}

.sidebar li.expanded > ul {
    display: block;
}

/* עיצוב תיבת החיפוש בתוך סרגל הצד השמאלי */
#search-container {
    width: 100%;
    margin-top: 20px;
    direction: rtl;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
}

#search-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* קבוצת פילטרים לחיפוש */
#search-filters {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    margin-top: 10px;
    font-size: 0.9em;
}

#search-filters label {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

#search-filters input[type="radio"] {
    margin-left: 5px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 1px solid #ccc;
    border-radius: 50%;
    width: 1em;
    height: 1em;
    outline: none;
    cursor: pointer;
    background-color: #fff;
    transition: background-color 0.2s, border-color 0.2s;
}

#search-filters input[type="radio"]:checked {
    background-color: #333;
    border-color: #333;
}

.search-nav {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.search-nav button {
    background-color: #333;
    color: white;
    border: none;
    padding: 5px 10px;
    margin: 0 5px;
    cursor: pointer;
    border-radius: 4px;
}

/* מכולה שניתן לגלול עבור תוצאות החיפוש */
#search-results-summary {
    width: 100%;
    margin-top: 10px;
    border-top: 1px solid #ddd;
    padding-top: 10px;
    overflow-y: auto;
    flex-grow: 1;
}

.search-summary-item {
    background-color: #f9f9f9;
    padding: 5px;
    margin-bottom: 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-summary-item:hover {
    background-color: #e9e9e9;
}

/* עיצוב ההדגשה הכללי */
.highlight {
    background-color: yellow;
    font-weight: bold;
}

/* עיצוב ההדגשה עבור התוצאה הנוכחית */
.current-highlight {
    background-color: orange;
    color: white;
}

/* **כללי CSS חדשים עבור הכפתור והחלונית** */
#info-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin-top: auto; /* Push the button to the bottom */
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#info-button:hover {
    background-color: #0056b3;
}

/* סגנון חלונית קופצת (popup) */
.popup {
    display: none; /* התחלה נסתרת */
    position: fixed;
    z-index: 20;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    justify-content: center;
    align-items: center;
    direction: rtl;
}

.popup-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    position: relative;
    text-align: right;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close-button {
    color: #aaa;
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}