html {
    box-sizing: border-box;
    font-size: 16px;
    scroll-behavior: smooth;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: #333;
    background-color: #f8f8f8;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

:focus-visible {
    outline: 2px solid #00BFA5;
    outline-offset: 2px;
}

header {
    background-color: #4A148C;
    color: #F3E5F5;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.site-header h1 {
    margin: 0;
    font-size: 1.8rem;
}

.site-header h1 a {
    color: #F3E5F5;
    text-decoration: none;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #F3E5F5;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
}

.main-navigation {
    flex-grow: 1;
    text-align: right;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
}

.main-navigation li {
    position: relative;
}

.main-navigation a {
    color: #F3E5F5;
    text-decoration: none;
    padding: 0.5rem 0;
    display: block;
    white-space: nowrap;
}

.main-navigation a:hover,
.main-navigation a:focus {
    color: #00BFA5;
}

.mega-menu {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    background-color: #F3E5F5;
    color: #333;
    padding: 1.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    text-align: left;
    border-top: 3px solid #00BFA5;
}

.main-navigation li:hover .mega-menu,
.main-navigation li:focus-within .mega-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.mega-menu-column {
    flex: 1 1 250px;
    min-width: 200px;
}

.mega-menu-column h3 {
    color: #4A148C;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.5rem;
}

.mega-menu-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: block; /* Override flex for columns */
}

.mega-menu-column li {
    margin-bottom: 0.5rem;
}

.mega-menu-column a {
    color: #4A148C;
    text-decoration: none;
    padding: 0.25rem 0;
    display: block;
}

.mega-menu-column a:hover,
.mega-menu-column a:focus {
    color: #00BFA5;
    text-decoration: underline;
}

main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 0;
}

.doc-layout {
    display: flex;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.sidebar {
    flex: 0 0 250px;
    padding-right: 1.5rem;
    border-right: 1px solid #eee;
    position: sticky;
    top: 2rem; /* Adjust based on header height */
    align-self: flex-start;
    max-height: calc(100vh - 4rem); /* Adjust based on header/footer */
    overflow-y: auto;
}

.sidebar h2 {
    color: #4A148C;
    font-size: 1.4rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

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

.sidebar ul li {
    margin-bottom: 0.75rem;
}

.sidebar ul li a {
    color: #4A148C;
    text-decoration: none;
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar ul li a:hover,
.sidebar ul li a:focus {
    background-color: #F3E5F5;
    color: #4A148C;
}

.sidebar ul li a.active {
    background-color: #4A148C;
    color: #F3E5F5;
    font-weight: bold;
}

.content-area {
    flex: 1;
    min-width: 0; /* Allows content to shrink */
}

h1, h2, h3, h4, h5, h6 {
    color: #4A148C;
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: #4A148C;
    text-decoration: underline;
}

a:hover, a:focus {
    color: #00BFA5;
    text-decoration: none;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem 0;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Lists */
ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

ul li, ol li {
    margin-bottom: 0.5rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden; /* Ensures rounded corners */
}

table th, table td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table thead th {
    background-color: #4A148C;
    color: #F3E5F5;
    font-weight: bold;
    border-bottom: 2px solid #4A148C;
}

table tbody tr:nth-child(even) {
    background-color: #F3E5F5;
}

table tbody tr:hover {
    background-color: #e0e0e0;
}

/* Forms */
form {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

form div {
    margin-bottom: 1.5rem;
}

form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #4A148C;
}

form input[type="text"],
form input[type="email"],
form input[type="tel"],
form textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

form input[type="text"]:focus,
form input[type="email"]:focus,
form input[type="tel"]:focus,
form textarea:focus {
    border-color: #00BFA5;
    box-shadow: 0 0 0 2px rgba(0, 191, 165, 0.2);
    outline: none;
}

form textarea {
    min-height: 120px;
    resize: vertical;
}

form button {
    background-color: #4A148C;
    color: #F3E5F5;
    padding: 1rem 2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

form button:hover,
form button:focus {
    background-color: #310E6F;
    outline: none;
}

/* Details/Summary */
details {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

details summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: bold;
    color: #4A148C;
    outline: none;
    list-style: none; /* Removes default arrow */
    position: relative;
}

details summary::-webkit-details-marker {
    display: none; /* Removes default arrow for webkit */
}

details summary::before {
    content: '+';
    position: absolute;
    right: 1.5rem;
    font-size: 1.2rem;
    color: #00BFA5;
    transition: transform 0.2s ease;
}

details[open] summary::before {
    content: '-';
    transform: rotate(0deg); /* No rotation needed for - */
}

details p {
    padding: 0 1.5rem 1.5rem;
    margin-bottom: 0;
    border-top: 1px solid #eee;
    margin-top: 0;
    padding-top: 1rem;
}

/* Aside */
aside {
    background-color: #F3E5F5;
    border-left: 5px solid #00BFA5;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

aside h3 {
    color: #4A148C;
    margin-top: 0;
    font-size: 1.25rem;
}

/* Blockquote */
blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background-color: #e0f2f1; /* Lighter shade of accent for contrast */
    border-left: 5px solid #00BFA5;
    font-style: italic;
    color: #212121;
    border-radius: 0 8px 8px 0;
}

blockquote p {
    margin-bottom: 0.5rem;
}

blockquote cite {
    display: block;
    margin-top: 1rem;
    font-style: normal;
    font-weight: bold;
    color: #4A148C;
}

/* Definition List */
dl {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

dt {
    font-weight: bold;
    color: #4A148C;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

dt:first-of-type {
    margin-top: 0;
}

dd {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed #eee;
}

dd:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

footer {
    background-color: #4A148C;
    color: #F3E5F5;
    padding: 2rem 0;
    margin-top: auto;
    text-align: center;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

footer p {
    margin: 0;
    font-size: 0.9rem;
}

footer .footer-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

footer .footer-nav a {
    color: #F3E5F5;
    text-decoration: none;
    font-size: 0.9rem;
}

footer .footer-nav a:hover,
footer .footer-nav a:focus {
    color: #00BFA5;
    text-decoration: underline;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(74, 20, 140, 0.95); /* Primary color with transparency */
    color: #F3E5F5;
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    display: none; /* Hidden by default, shown with JS */
    font-size: 0.9rem;
}

.cookie-banner.show {
    display: block;
}

.cookie-banner .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.cookie-banner p {
    margin: 0;
}

.cookie-banner p a {
    color: #00BFA5;
    text-decoration: underline;
}

.cookie-banner p a:hover,
.cookie-banner p a:focus {
    color: #F3E5F5;
}

.cookie-banner button {
    background-color: #00BFA5;
    color: #4A148C;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

.cookie-banner button:hover,
.cookie-banner button:focus {
    background-color: #00897B;
    outline: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .doc-layout {
        flex-direction: column;
    }

    .sidebar {
        position: static;
        width: 100%;
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid #eee;
        margin-bottom: 2rem;
        max-height: none;
        overflow-y: visible;
    }

    .sidebar h2 {
        text-align: center;
    }

    .sidebar ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1rem;
    }

    .sidebar ul li {
        margin-bottom: 0;
    }

    .sidebar ul li a {
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 768px) {
    .site-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-toggle {
        display: block;
        align-self: flex-end;
        position: absolute;
        top: 1rem;
        right: 1.5rem;
    }

    .main-navigation {
        width: 100%;
        text-align: left;
        margin-top: 1rem;
    }

    .main-navigation ul {
        flex-direction: column;
        display: none; /* Hidden by default for mobile */
        gap: 0;
        background-color: #310E6F; /* Darker primary for contrast */
        padding: 1rem 0;
    }

    .main-navigation ul.is-open {
        display: flex;
    }

    .main-navigation li {
        width: 100%;
    }

    .main-navigation a {
        padding: 0.8rem 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .main-navigation li:last-child a {
        border-bottom: none;
    }

    .mega-menu {
        position: static;
        box-shadow: none;
        border-top: none;
        padding: 1rem 1.5rem;
        background-color: #F3E5F5; /* Still light for mega-menu content */
        display: none !important; /* Force hide initially */
    }

    .main-navigation li.has-mega-menu.is-open .mega-menu {
        display: flex !important; /* Show mega menu when parent is open */
        flex-direction: column;
        gap: 1rem;
    }

    .mega-menu-column {
        flex: 1 1 100%;
    }

    .mega-menu-column h3 {
        margin-top: 1rem;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    .cookie-banner .container {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0 1.5rem;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 0.95rem;
    }

    .container {
        padding: 0 1rem;
    }

    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.3rem; }

    form {
        padding: 1.5rem;
    }

    form button {
        width: 100%;
        padding: 0.8rem 1rem;
    }

    .cookie-banner {
        padding: 1rem 0;
    }
}