:root {
    --primary-color: #132934;
    --primary-hover: #0F538A;
    --bg-main: #f8f9fa;
    --bg-sidebar: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --text-main: #333333;
    --text-muted: #6c757d;
    --accent-red: #dc3545;
    --glass-border: rgba(0, 0, 0, 0.08);
    --font-family: 'Open Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
/* Sidebar Styling */
nav#sidebar {
    width: min(320px, 25vw);
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--glass-border);
    padding: 1.5rem;
    z-index: 100;
    transition: padding 0.3s;
}

main#content {
    flex: 1;
    min-width: 0;
    padding: 3rem;
    background: var(--bg-main);
}


nav#sidebar::-webkit-scrollbar {
    width: 4px;
}

nav#sidebar::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

nav#sidebar h2 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

nav#sidebar ul {
    list-style: none;
}

nav#sidebar li {
    margin-bottom: 0.25rem;
}

nav#sidebar a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 450;
    transition: all 0.2s ease;
    display: block;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    line-height: 1.4;
}

nav#sidebar a:hover {
    color: var(--primary-color);
    background: rgba(19, 41, 52, 0.05); /* Using primary color with low alpha */
    transform: translateX(3px);
}

nav#sidebar a.active {
    color: #ffffff;
    background: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(19, 41, 52, 0.2);
}

/* Collapsible Sections */
.collapsible {
    cursor: pointer;
    user-select: none;
    color: var(--primary-color);
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    transition: background 0.2s;
    border-radius: 6px;
}

.collapsible:hover {
    background: rgba(19, 41, 52, 0.03);
}

.collapsible::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid var(--text-muted);
    transition: transform 0.3s;
    opacity: 0.5;
    margin-left: auto;
}

.collapsible.expanded::after {
    transform: rotate(90deg);
}

.collapsible-content {
    margin-left: 0.5rem;
    padding-left: 0.5rem;
    border-left: 2px solid rgba(19, 41, 52, 0.05);
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.collapsible-content li {
    margin-bottom: 0.15rem;
}

.legacy-msg {
    margin-top: 2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    opacity: 0.6;
}

.collapsible-content li {
    margin-bottom: 0.25rem;
}

/* Legacy Content Overrides */
#dynamic-content table {
    color: var(--text-main) !important;
    border-collapse: collapse;
    width: 100% !important;
    margin-bottom: 2rem;
    background: #f8fafc !important;
    border: 1px solid var(--glass-border);
}

#dynamic-content td,
#dynamic-content th {
    background: transparent !important;
    color: inherit !important;
    border: 1px solid var(--glass-border) !important;
    padding: 0.75rem !important;
}

#dynamic-content font {
    color: inherit !important;
    font-family: var(--font-family) !important;
}

#dynamic-content p,
#dynamic-content div {
    color: inherit !important;
}

#dynamic-content center {
    display: block;
    width: 100%;
    text-align: center;
}

#dynamic-content P {
    margin-bottom: 1rem;
    text-align: justify;
    line-height: 1.7;
}

#dynamic-content h1, 
#dynamic-content h2,
#dynamic-content h3 {
    color: var(--primary-color);
    margin: 1.5rem 0 1rem;
}

#dynamic-content h1:first-child,
#dynamic-content h2:first-child {
    margin-top: 0;
}

#dynamic-content .czarne {
    color: #1a1a1a !important;
}

#dynamic-content .podpunkt {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 2rem 0 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

#dynamic-content hr {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 2rem 0;
}

#dynamic-content ul, 
#dynamic-content ol {
    margin: 1rem 0 1rem 2rem;
}

#dynamic-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

#dynamic-content a {
    color: var(--primary-color);
    text-decoration: underline;
    transition: color 0.2s ease;
}

#dynamic-content a:hover {
    color: var(--primary-hover);
}

#dynamic-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

img.profile {
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    margin: 0 2.5rem 2rem 0;
    float: left;
    border: 1px solid var(--glass-border);
}

/* New PHP Page Structure */
.page-meta {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.author-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.content-section h2 {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.content-section h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.toc {
    background: #f8fafc;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.toc h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-align: center;
}

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

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.toc a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.back-to-top {
    text-align: right;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.back-to-top a {
    color: var(--text-muted);
    font-size: 0.9rem;
}

section p {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-main);
    text-align: justify;
}

iframe {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Responsive */
button#hamburger {
    display: none;
}

@media (max-width: 1400px) {
    nav#sidebar {
        padding: 1rem;
    }
}

@media (max-width: 1024px) {
    main#content {
        padding: 2.5rem;
    }
    nav#sidebar {
        padding: 0.75rem;
    }
}

@media (max-width: 900px) {
    body {
        flex-direction: column;
    }

    button#hamburger {
        display: flex !important;
        flex-direction: column;
        justify-content: space-around;
        width: 32px;
        height: 28px;
        background: transparent;
        border: none;
        cursor: pointer;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 1000;
        padding: 4px;
    }

    button#hamburger span {
        display: block;
        width: 100%;
        height: 3px;
        background: var(--primary-color);
        border-radius: 2px;
        transition: all 0.3s;
    }

    button#hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    button#hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    button#hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    nav#sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        padding: 4rem 1.5rem 1.5rem;
        border-right: none;
        border-bottom: none;
        box-shadow: 4px 0 10px rgba(0,0,0,0.1);
        transition: left 0.3s ease;
        z-index: 999;
    }

    nav#sidebar.open {
        left: 0;
    }

    nav#sidebar h2 {
        margin-bottom: 1.5rem;
    }

    nav#sidebar ul {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    main#content {
        margin-left: 0;
        padding: 4rem 1.5rem 2rem;
    }

    img.profile {
        float: none;
        display: block;
        margin: 0 auto 2rem;
    }
}