body {
    font-family: sans-serif;
    margin: 0;
    padding-top: 30px;
    padding-left: 50px;
    padding-right: 30px;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background-color: rgb(17, 49, 33);
    z-index: 1001;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 30px;
    background-color: rgb(17, 49, 33);
    z-index: 1001;
}

#metadata-widget-container {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
}


#toggles-widget {
    top: 40px;
    right: 5%;
    min-width: 220px;
    padding-top: 40px;
}

#toc-widget-container {
    position: fixed;
    top: 40%;
    left: 0;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: 0 0;
    z-index: 1002;
}

#metadata-button, #toc-button {
    background-color: #e79f3a;
    color: #113121;
    border: none;
    padding: 12px 16px;
    border-radius: 0 0 5px 5px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#toc-button {
    border-radius: 0 0 5px 5px;
}

#metadata-button::after, #toc-button::after {
    content: ' ▼';
    font-size: 0.8em;
    margin-left: 8px;
}

.panel {
    display: none;
    position: fixed;
    background-color: white;
    border: 3px solid rgb(231, 159, 58);
    border-radius: 5px;
    padding: 10px;
    z-index: 1001;
}

#metadata-panel {
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-height: 400px;
    overflow-y: auto;
    padding-left: 20px;
}

#toc-panel {
    left: 30px;
    width: max-content;
    max-height: 400px;
    overflow-y: auto;
    padding-left: 20px;
    padding-right: 60px;
}

#toc-list {
    list-style: none;
    padding-left: 0;
}
#metadata-list {
    list-style-type: none;
    padding-left: 0;
}
#metadata-list ul {
    padding-left: 20px;
}

#metadata-list li {
}

#metadata-list > li:not(#corrections-list-container) {
    margin-bottom: 10px;
}

#corrections-container {
    border: 3px solid rgb(231, 159, 58);
    padding: 10px;
    box-sizing: border-box;
    margin-top: 1em;
    width: 75%;
}

#corrections-container h2 {
    margin-top: 0;
    cursor: pointer;
    user-select: none;
}

#corrections-caret {
    display: inline-block;
    transition: transform 0.2s;
    margin-left: 8px;
}

#corrections-container.expanded #corrections-caret {
    transform: rotate(90deg);
}

#corrections-list {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

#corrections-container.expanded #corrections-list {
    max-height: 500px; /* Large enough for content */
    overflow-y: auto;
    transition: max-height 0.5s ease-in;
}

#toc-list li {
    margin-bottom: 5px;
    padding: 5px 0;
}

.toggles-widget-container {
    position: sticky;
    top: 40px;
    right: 5%;
    z-index: 1000;
    border: 3px solid rgb(231, 159, 58);
    padding: 10px;
    border-radius: 5px;
    background-color: rgba(255, 255, 255);
    min-width: 200px;
    float: right;
    display: none;
}

.toggles-widget-container button {
    display: block;
    margin-bottom: 5px;
    background-color: #113121;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
    text-align: left;
}

.toggles-widget-container button:hover {
    background-color: #22553B;
}

.toggle-switch-container {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}
.switch {
    position: relative;
    display: flex;
    width: 100%;
    height: 34px;
    background-color: #ccc;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.switch-text-on, .switch-text-off {
    flex: 1;
    user-select: none;
    transition: all 0.2s;
}
.switch input:not(:checked) ~ .switch-text-off {
    background-color: #113121;
    color: white;
}
.switch input:not(:checked) ~ .switch-text-on {
    background-color: #ccc;
    color: #333;
}
.switch input:checked ~ .switch-text-on {
    background-color: #113121;
    color: white;
}
.switch input:checked ~ .switch-text-off {
    background-color: #ccc;
    color: #333;
}
.simple-checkbox-label {
    display: flex;
    align-items: center;
    padding: 8px 4px;
    cursor: pointer;
    color: #333;
    font-family: sans-serif;
    font-size: 14px;
}
.simple-checkbox-label input {
    order: 1;
    margin-left: 8px;
}

#toggles-widget-icon {
    position: fixed;
    top: 40px;
    right: 5%;
    cursor: pointer;
    z-index: 1001;
    background-color: white;
    padding: 5px;
    border: 3px solid white;
    border-radius: 5px;
    outline: 3px solid rgb(231, 159, 58);
}

#toggles-widget-icon span {
    display: block;
    width: 33px;
    height: 4px;
    margin-bottom: 5px;
    position: relative;
    background: rgb(231, 159, 58);
    border-radius: 3px;
    z-index: 1;
}

#toggles-widget-icon span:last-child {
    margin-bottom: 0;
}

#toggles-widget-close-button {
    position: fixed;
    top: 35px; /* Almost match the icon */
    right: 5%; /* Match the icon */
    width: 49px; /* Match the icon's total width (33 + 5*2 + 3*2) */
    height: 49px; /* Match the icon's total height */
    font-size: 2.5em;
    line-height: 1.2; /* Vertically center the '×' */
    text-align: center; /* Horizontally center the '×' */
    cursor: pointer;
    z-index: 1002; /* Must be above the panel it closes */
    color: #113121;
}

.toggles-widget-container.expanded {
    display: block;
}

@media (max-width: 950px) {
    #top-widgets {
        flex-direction: column;
    }
    #toggles-widget-icon {
        right: 15%;
    }
    #toggles-widget-close-button {
        right: 15%; /* Match the icon in media query */
    }
    #metadata, #toc {
        width: 75%;
        margin-right: 0;
        margin-bottom: 1em;
    }
}

.toggle-switch {
  display: block;
  position: relative;
  width: 100%;
  height: 34px;
  background-color: #ccc;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: background-color .2s;
  overflow: hidden;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-switch-text {
  display: flex;
  height: 100%;
  justify-content: center;
  align-items: center;
  color: #333;
  font-size: 12px;
  transition: color .2s;
}

.toggle-switch-handle {
  position: absolute;
  content: "";
  height: 28px;
  width: 28px;
  left: 3px;
  top: 3px;
  background-color: white;
  border-radius: 3px;
  transition: .4s;
  box-shadow: 0 0 2px 0 rgba(0,0,0,0.5);
}

.toggle-switch:has(input:checked) {
    background-color: #113121;
}

.toggle-switch:has(input:checked) .toggle-switch-text {
    color: white;
}

.toggle-switch:has(input:checked) .toggle-switch-handle {
    left: calc(100% - 31px);
}

#corrections-info-icon {
    cursor: pointer; 
    width: 16px; 
    height: 16px; 
    margin-left: 8px; 
    vertical-align: middle;
}

#transliteration-controls-container {
    display: flex;
    align-items: center;
    width: 100%;
}

#transliteration-controls {
    display: flex;
    align-items: center;
    margin-left: 20px; /* Changed from auto */
}

#toggle-switch-text {
    display: flex;
    align-items: center;
}

#transliteration-scheme {
    margin-right: 15px;
}

#home-button {
    position: fixed;
    top: 0px;
    left: 0px;
    z-index: 1003;
}

#home-button img {
    width: 35px;
    height: auto;
    border: 3px solid rgb(231, 159, 58);
}

.correction-link {
    cursor: pointer;
    text-decoration: underline;
    color: #1a73e8;
}

.correction-link:hover {
    color: #174ea6;
}

.highlight-correction {
    background-color: #fffde7;
    outline: 2px solid #ffd600;
    transition: background-color 2s, outline 2s;
}
