/* --- Base & General Styling (Light Theme Default) --- */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #fafafa;
    color: #212529;
    font-size: 16px;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* --- Layout --- */
.site-container {
    display: flex; /* Fallback for IE11 */
    display: grid;
    min-height: 100vh;
    grid-template-columns: 280px 1fr;
    grid-template-rows: 1fr;
    grid-template-areas:
        "sidebar main";
}

.sidebar {
    grid-area: sidebar;
    /* Original total width was 280px.
       New width = 280px - (padding-left: 1rem) - (padding-right: 1rem) - (border-right: 1px)
                 = 280px - 16px - 16px - 1px = 247px */
    width: 280px;
    flex-shrink: 0;
    background-color: #eee;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.main-content {
    grid-area: main;
    flex-grow: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 2rem;
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

/* --- Sidebar Header & Footer --- */
.sidebar-header {
    text-align: center;
    padding: 18px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #212529;
    border-bottom: 1px solid #dee2e6;
    text-decoration: underline;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 20px 20px 18px 20px;
    border-top: 1px solid #dee2e6;
    flex-shrink: 0;
}
.sidebar-footer .form-group { margin-bottom: 15px; }
.sidebar-footer label {
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.85rem;
}
.sidebar-footer .text-muted {
    color: #6c757d;
    font-size: 0.9em;
    margin: 0;
}
.side-copyright { font-size: 0.9em; }
.theme-switch-cont { margin-bottom: 12px; }

/* --- Sidebar Navigation --- */
.sidebar-inner {
    padding: 0rem 1rem 0rem 1rem;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-group {
    margin-bottom: 1.5rem;
}

.nav-group-title {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #212529;
    opacity: 0.7;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.nav-group ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav-group li a {
    display: block;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: black;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}
.nav-group li a:hover {
    background-color: #ddd;
    color: black;
}
.nav-group li a.active {
    background-color: rgba(0, 101, 173, 0.11);
    color: black;
    font-weight: 600;
}

.side-link-section {
    flex-shrink: 0;
    border-top: 1px solid #dee2e6;
}
.side-link-small, .side-link-big, .side-link-legal {
    font-size: 13px;
    font-weight: 500;
    color: #212529;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}
.side-link-small { padding: 4px 20px; display: block; }
.side-link-big { padding: 8px 20px; display: block; }
.side-link-small:hover, .side-link-big:hover {
    background-color: #d5d5d5;
    color: black;
    text-decoration: none;
}
.side-link-legal {
	background: rgba(255, 255, 255, 0.0) !important;
	box-shadow: 0 0 !important;
    display: inline-block;
}
.side-link-legal:hover { color: #212529; }

/* --- Header Elements & Hamburger --- */
.site-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    text-decoration: none;
}

.hamburger-menu {
    display: none;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1001;
    background: #fff;
    border: 1px solid #dee2e6;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.hamburger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #343a40;
    margin: 5px 0;
    transition: all 0.3s;
}

/* --- Content Typography & Elements --- */
h1, h2, h3, h4, h5, h6 {
    color: #212529;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 1.5em;
    margin-bottom: 0em;
}
h1 { font-size: 2.5rem; padding-bottom: 0.2em; margin-top: 0; }
h2 { font-size: 2rem; margin-bottom: 0.4em; border-right: 3px solid #aaa; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

a { color: #0d6efd; text-decoration: none; }
a:hover { text-decoration: underline; color: #0a58ca; }
p { margin-top: 0.5rem; margin-bottom: 0.5rem; }
strong { font-weight: 600; }

ul, ol {
    padding-left: 20px;
	margin-top: 0.7rem;
    margin-bottom: 0.5rem;
}
li { margin-bottom: 0.5rem; }

code {
    background-color: #e9ecef;
	color: #141414;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 86%;
}

pre {
    /* To prevent overflow with content-box, width must account for padding and border.
       width = 100% of parent - (padding-left + padding-right) - (border-left + border-right)
             = 100% - (1rem + 1rem) - (1px + 1px) */
    width: calc(100% - 2rem - 2px);
    background-color: #f1f1f1;
    border: 1px solid #dee2e6;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

pre code {
    background: none;
    padding: 0;
    font-size: 0.9em;
    color: #212529;
}

table {
    width: 100%;
    border-collapse: collapse;
	margin-top: 0.75rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

th, td {
    border: 1px solid #dee2e6;
    padding: 0.75rem;
    text-align: left;
}

thead th {
    background-color: #f8f9fa;
    font-weight: 600;
}

tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* --- Theme Switcher --- */
#theme-switcher {
    width: 100%;
    padding: 5px 8px;
    border-radius: 4px;
    background-color: #fff;
    color: #212529;
    border: 1px solid #ced4da;
    box-sizing: border-box;
}

/* --- Dark Theme --- */
@media (prefers-color-scheme: dark) { html[data-theme='dark'] { color-scheme: dark; } }

html[data-theme='dark'] body {
    background-color: #303030;
    color: #e0e0e0;
}
html[data-theme='dark'] .sidebar {
    background-color: #222222;
    border-right-color: #333333;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.4);
}
html[data-theme='dark'] .sidebar-header {
    color: #e0e0e0;
    border-bottom-color: #333333;
}
html[data-theme='dark'] .sidebar-header:hover {
    color: #7fb6fe;
}
html[data-theme='dark'] .sidebar-footer {
    border-top-color: #333333;
}
html[data-theme='dark'] .sidebar-footer .text-muted {
    color: #a0a0a0;
}
html[data-theme='dark'] .nav-group-title {
	color: #fff;
}
html[data-theme='dark'] .nav-group li a {
    color: #ccc;
}
html[data-theme='dark'] .nav-group li a:hover {
    background-color: #333333;
    color: #fff;
}
html[data-theme='dark'] .nav-group li a.active {
    background-color: #333333;
    color: #fff;
}
html[data-theme='dark'] .site-title {
    color: #e0e0e0;
}
html[data-theme='dark'] .hamburger-menu {
    background-color: #222222;
    border-color: #333333;
}
html[data-theme='dark'] .hamburger-menu span {
    background-color: #e0e0e0;
}
html[data-theme='dark'] h1, 
html[data-theme='dark'] h2, 
html[data-theme='dark'] h3, 
html[data-theme='dark'] h4, 
html[data-theme='dark'] h5, 
html[data-theme='dark'] h6,
html[data-theme='dark'] span {
    color: #e0e0e0;
}
html[data-theme='dark'] h1, 
html[data-theme='dark'] h2 {
    border-bottom-color: #333333;
}
html[data-theme='dark'] a {
    color: #6ea8fe;
}
html[data-theme='dark'] a:hover {
    color: #9ec5fe;
}
html[data-theme='dark'] code {
    background-color: #333333;
    color: #ff7b72;
}
html[data-theme='dark'] pre {
    background-color: #2b2b2b;
    border-color: #333333;
}
html[data-theme='dark'] pre code {
    color: #e0e0e0;
}
html[data-theme='dark'] table {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
html[data-theme='dark'] th, 
html[data-theme='dark'] td {
    border-color: #444444;
}
html[data-theme='dark'] thead th {
    background-color: #2c2c2c;
}
html[data-theme='dark'] tbody tr:nth-child(odd) {
    background-color: #1a1a1a;
}
html[data-theme='dark'] tbody tr:nth-child(even) {
    background-color: #222222;
}
html[data-theme='dark'] .side-link-section {
    border-top-color: #333333;
}
html[data-theme='dark'] .side-link-small, 
html[data-theme='dark'] .side-link-big {
    color: #ccc;
}
html[data-theme='dark'] .side-link-small:hover, 
html[data-theme='dark'] .side-link-big:hover {
    background-color: #333333;
    color: #fff;
    text-decoration: none;
}
html[data-theme='dark'] .side-link-legal, 
html[data-theme='dark'] .side-link-legal:hover {
    color: #bbb;
}
html[data-theme='dark'] #theme-switcher {
    background-color: #333;
    border-color: #333;
    color: #e0e0e0;
}

/* --- Colorful Theme --- */
html[data-theme='colorful'] body {
	background: -webkit-radial-gradient(circle at 100%, #4CA2CD -50%, #38BF7D 50%, #67B281 75%, #11998E 110%);
    background: radial-gradient(circle at 100%, #4CA2CD -50%, #38BF7D 50%, #67B281 75%, #11998E 110%);
    color: #030509;
}
html[data-theme='colorful'] .sidebar {
	background: -webkit-linear-gradient(60deg, #517775 0%, #46c0fa 35%,  #9494ef 65%, #4b7896);
    background: linear-gradient(60deg, #517775 0%, #46c0fa 35%,  #9494ef 65%, #4b7896);
    border-right-color: #9aabbc;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
}
html[data-theme='colorful'] .sidebar-header {
    color: #111;
    border-bottom-color: #87ceeb;
    box-shadow: initial;
    background: initial;
    transition: text-shadow 0.12s ease;
}
html[data-theme='colorful'] .sidebar-header:hover {
    color: #111;
    text-shadow: 0px 0px 25px #222;
}
html[data-theme='colorful'] .sidebar-footer {
    border-top-color: #87ceeb;
}
html[data-theme='colorful'] .sidebar-footer .text-muted {
    color: #2d2d2d;
}
html[data-theme='colorful'] .nav-group-title {
	opacity: 1.0;
    color: #000;
}
html[data-theme='colorful'] .nav-group li a {
    color: #111;
    box-shadow: none;
	background: rgba(255, 255, 255, 0.04);
}
html[data-theme='colorful'] .nav-group li a:hover {
    outline: 4px solid #6D36D1;
	background-color: rgba(255, 255, 255, 0.0);
    box-shadow: 0 0 15px 5px rgba(0, 0, 0, 0.45);
    color: #000;
}
html[data-theme='colorful'] .nav-group li a.active {
	text-align: center;
    outline: 4px solid #775AC7;
	background-color: #333;
    color: #fff;
}
html[data-theme='colorful'] .site-title {
    color: #ffffff;
}
html[data-theme='colorful'] .hamburger-menu {
    background-color: rgba(255, 255, 255, 0.92);
    border-color: #87ceeb;
}
html[data-theme='colorful'] .hamburger-menu span {
    background-color: #010509;
}
html[data-theme='colorful'] h1, 
html[data-theme='colorful'] h2, 
html[data-theme='colorful'] h3, 
html[data-theme='colorful'] h4, 
html[data-theme='colorful'] h5, 
html[data-theme='colorful'] h6 {
    background: linear-gradient(60deg, #FFB88C, #EC6F66, #ee6e7f, #FFB88C);
	color: #333;
}
html[data-theme='colorful'] h1, 
html[data-theme='colorful'] h2 {
	border: 0px;
}
html[data-theme='colorful'] a {
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.85);
	background: radial-gradient(circle at 100%, #2980b9 -50%, #283E51 50%, #2c3e50 75%, #4B79A1 110%);
    color: #E0EAFC;
}
html[data-theme='colorful'] a:hover {
    color: #F0F2F0;
}
html[data-theme='colorful'] code {
    background-color: #fffacd;
    color: #8b0000;
}
html[data-theme='colorful'] pre {
    background-color: #efefc7;
    border-color: #3a6f9a;
}
html[data-theme='colorful'] pre code {
    color: #333;
}
html[data-theme='colorful'] table {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
html[data-theme='colorful'] th, 
html[data-theme='colorful'] td {
    border-color: #87ceeb;
}
html[data-theme='colorful'] thead th {
    background: radial-gradient(circle at 500%, #EECDA3 -50%, #C779D0 50%, #FEAC5E 75%, #EF629F 110%);
}
html[data-theme='colorful'] tbody tr:nth-child(odd) {
	background-color: #F7D79E;
}
html[data-theme='colorful'] tbody tr:nth-child(even) {
	background-color: #DFC2A0;
}
html[data-theme='colorful'] .side-link-section {
    border-top-color: #87ceeb;
}
html[data-theme='colorful'] .side-link-small, 
html[data-theme='colorful'] .side-link-big {
    color: #111111;
    box-shadow: initial;
    background: initial;
}
html[data-theme='colorful'] .side-link-small:hover, 
html[data-theme='colorful'] .side-link-big:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #000;
    text-decoration: none;
}
html[data-theme='colorful'] .side-link-legal,
html[data-theme='colorful'] .side-link-legal:hover {
    color: #212529;
}
html[data-theme='colorful'] #theme-switcher {
    background-color: rgba(255,255,255,0.5);
    color: #010509;
    border-color: #87ceeb;
}

/* --- Responsive Design --- */
@media (min-width: 993px) {
    .sidebar { z-index: 1; }
}

@media (max-width: 992px) {
    .site-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        grid-template-areas: "main";
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1030;
    }

    body.sidebar-is-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.25);
        z-index: 1025;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

    body.sidebar-is-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    .hamburger-menu {
        display: block;
    }
}

/* --- Accordion Section -------------------------------------------------- */
.accord-section {
    margin-top: 2rem;
    margin-bottom: 3rem;
}

.accord-section .intro {
    margin: 0.75rem 0 2rem;
    color: #495057;
    max-width: 720px;
}

/* --- Accordion Container ------------------------------------------------ */
.accordion {
    display: grid;
    gap: 0;
}

/* --- Accordion Item ----------------------------------------------------- */
.accord-item {
    border: 1px solid #ced4da;
    background-color: #ffffff;
    border-radius: 0;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.accord-item:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.accord-item:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.accord-item + .accord-item {
    border-top: 0;
}

.accord-item[open] {
    border-color: #ced4da;
    box-shadow: none;
}

/* --- Accordion Headers ------------------------------------------------- */
.faq-header,
.changelog-header {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.9rem 3rem 0.9rem 1.25rem;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    outline: none;
    background: linear-gradient(#f2f6f8 0%, #dbe9f1 49%, #c8dde9 51%, #b9d3e3 100%);
    border-top: 1px solid #ffffff;
    border-right: 1px solid #a3bfd3;
    border-bottom: 1px solid #a3bfd3;
    border-left: 1px solid #d3e4ef;
    margin-left: -1px;
    margin-right: -1px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.accord-item[open] > .faq-header,
.accord-item[open] > .changelog-header {
    background: linear-gradient(#e1ebf1 0%, #c6d8e4 49%, #b3cadd 51%, #a5bfd6 100%);
}

.faq-header::-webkit-details-marker,
.changelog-header::-webkit-details-marker {
    display: none;
}

.faq-header:focus-visible,
.changelog-header:focus-visible {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.35);
    border-radius: 4px;
}

.accord-item:first-child > .faq-header,
.accord-item:first-child > .changelog-header {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.accord-item:last-child > .faq-header,
.accord-item:last-child > .changelog-header {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.faq-header span:first-child,
.changelog-header span:first-child {
    flex: 1 1 auto;
    text-align: center;
    font-weight: 600;
}

.changelog-header span:first-child {
    text-align: left;
}

/* --- Accordion Icon ----------------------------------------------------- */
.accord-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    background: none;
    border: 0.4rem solid transparent;
    border-right: 0.6rem solid #0d6efd;
    transition: transform 0.25s ease, border-color 0.25s ease;
    border-radius: 0;
    box-shadow: none;
}

.accord-icon::before,
.accord-icon::after {
    display: none;
}

.accord-item[open] .accord-icon {
    transform: translateY(-35%) rotate(-90deg);
}

/* --- Accordion Body ----------------------------------------------------- */
.accord-body {
    padding: 0 1.35rem 0.35rem;
    color: #343a40;
}

.accord-body p {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

/* --- Toggler Section ---------------------------------------------------- */
.has-toggler {
    display: flex;
    align-items: center;
}

.toggler {
    margin: 0 10px 1px auto;
    display: inline-block;
    width: 0;
    height: 0;
    border-style: solid;
    border-color: transparent;
    border-width: 0.4rem 0 0.4rem 0.7rem; 
    border-left-color: #000;
    transform-origin: 33.33% 50%;
    transition: transform 0.25s ease, border-left-color 0.25s ease;
}

.toggler.open {
    transform: rotate(90deg);
}

.toggable {
    display: none;
}

.toggable.open {
    display: block;
}

/* --- Dark Theme Accordion ----------------------------------------------- */
html[data-theme='dark'] .accord-section .intro {
    color: #adb5bd;
}

html[data-theme='dark'] .accord-item {
    border-color: #3a3a3a;
    background-color: #1f1f1f;
}

html[data-theme='dark'] .accord-item[open] {
    border-color: #3a3a3a;
}

html[data-theme='dark'] .faq-header,
html[data-theme='dark'] .changelog-header {
    color: #e0e0e0;
    background: linear-gradient(#353535 0%, #2b2b2b 50%, #222222 100%);
    border-color: #444444;
}

html[data-theme='dark'] .accord-item[open] > .faq-header,
html[data-theme='dark'] .accord-item[open] > .changelog-header {
    background: linear-gradient(#2c2c2c 0%, #262626 50%, #202020 100%);
}
html[data-theme='dark'] .accord-icon {
    border-right-color: #6ea8fe;
}
html[data-theme='dark'] .accord-item[open] .accord-icon {
    border-right-color: #6ea8fe;
}
html[data-theme='dark'] .accord-body {
    color: #d0d0d0;
}
html[data-theme='dark'] .toggler {
    border-left-color: #eee;
}

/* --- Colorful Theme Accordion ------------------------------------------- */
html[data-theme='colorful'] .accord-section .intro {
    color: #2d2d2d;
}

html[data-theme='colorful'] .accord-item {
    border-color: #87ceeb;
    background-color: rgba(255, 255, 255, 0.92);
}

html[data-theme='colorful'] .accord-item[open] {
    border-color: #87ceeb;
}

html[data-theme='colorful'] .faq-header,
html[data-theme='colorful'] .changelog-header {
    color: #1a1a1a;
    background: linear-gradient(#e0f7ff 0%, #bdeaff 100%);
    border-color: #87ceeb;
}

html[data-theme='colorful'] .accord-item[open] > .faq-header,
html[data-theme='colorful'] .accord-item[open] > .changelog-header {
    background: linear-gradient(#d5f3ff 0%, #b7e7ff 100%);
}
html[data-theme='colorful'] .accord-icon {
    border-right-color: #676767;
}
html[data-theme='colorful'] .accord-item[open] .accord-icon {
    border-right-color: #676767;
}
html[data-theme='colorful'] .accord-body {
    color: #2d2d2d;
}
html[data-theme='colorful'] .toggler {
    border-left-color: #0d6efd;
}