/* General Styles */
:root {
    --primary-color: #004D40;
    --secondary-color: #E0F2F1;
    --accent-color: #D50000;
    --text-color: #333;
    --light-text-color: #555;
    --white-text-color: #FFF;
    --border-color: #CCC;
    --light-background: #F9F9F9;
    --header-height: 60px;
    --sidebar-width: 280px; /* Adjusted for a wider sidebar */
    --padding-base: 1.5rem;
    --line-height-base: 1.6;
    --font-size-base: 1rem;
    --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-sans);
    line-height: var(--line-height-base);
    color: var(--text-color);
    background-color: var(--light-background);
    font-size: var(--font-size-base);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Accessibility: Focus styles */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
    border-radius: 3px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease, background-color 0.3s ease;
}

a:hover,
a:focus {
    color: var(--accent-color);
    text-decoration: underline;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    line-height: 1.2;
    color: var(--primary-color);
}

h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5em;
    margin-top: 0;
}

h2 {
    font-size: 2rem;
    border-bottom: 1px solid var(--secondary-color);
    padding-bottom: 0.3em;
}

h3 {
    font-size: 1.75rem;
    color: var(--light-text-color);
}

h4 {
    font-size: 1.5rem;
    color: var(--light-text-color);
}

h5 {
    font-size: 1.25rem;
}

h6 {
    font-size: 1rem;
}

p {
    margin-bottom: 1em;
}

ul, ol {
    margin-left: 2em;
    margin-bottom: 1em;
}

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

strong {
    font-weight: bold;
}

em {
    font-style: italic;
}

/* Layout - Sidebar */
.page-container {
    display: flex;
    flex: 1; /* Allows main content to grow */
    width: 100%;
    max-width: 1400px; /* Constrain overall width */
    margin: 0 auto;
    padding: var(--padding-base) 0;
}

.main-content {
    flex-grow: 1;
    padding: 0 var(--padding-base);
    background-color: var(--white-text-color);
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    min-width: 0; /* Allow content to shrink */
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    padding: var(--padding-base);
    margin-right: var(--padding-base);
    background-color: var(--secondary-color);
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    order: -1; /* Place sidebar on the left */
}

/* Sidebar Navigation */
.sidebar nav h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

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

.sidebar nav li {
    margin-bottom: 0.5rem;
}

.sidebar nav a {
    display: block;
    padding: 0.75rem 1rem;
    background-color: transparent;
    color: var(--primary-color);
    border-radius: 3px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar nav a:hover,
.sidebar nav a:focus {
    background-color: var(--primary-color);
    color: var(--white-text-color);
    text-decoration: none;
}

.sidebar nav a.active {
    background-color: var(--primary-color);
    color: var(--white-text-color);
    font-weight: bold;
}

/* Utility Bar Navigation (Header) */
.utility-bar {
    background-color: var(--primary-color);
    color: var(--white-text-color);
    padding: 0.8rem var(--padding-base);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.utility-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.utility-bar .logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--white-text-color);
    text-decoration: none;
    margin-right: 2rem;
}

.utility-bar .logo:hover,
.utility-bar .logo:focus {
    color: var(--secondary-color);
    text-decoration: none;
}

.utility-bar nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.utility-bar nav li {
    margin-left: 1.5rem;
}

.utility-bar nav a {
    color: var(--white-text-color);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

.utility-bar nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background-color: var(--secondary-color);
    transition: width 0.3s ease;
}

.utility-bar nav a:hover::after,
.utility-bar nav a:focus::after {
    width: 100%;
}

.utility-bar nav a:hover,
.utility-bar nav a:focus {
    color: var(--secondary-color);
    text-decoration: none;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    color: var(--white-text-color);
    padding: 1rem var(--padding-base);
    text-align: center;
    z-index: 2000;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

.cookie-banner p {
    margin: 0;
    font-size: 0.95rem;
}

.cookie-banner a {
    color: var(--secondary-color);
    text-decoration: underline;
}

.cookie-banner button {
    background-color: var(--accent-color);
    color: var(--white-text-color);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.cookie-banner button:hover,
.cookie-banner button:focus {
    background-color: #C00000; /* Slightly darker accent */
}

/* Forms */
form {
    background-color: var(--white-text-color);
    padding: var(--padding-base);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: var(--padding-base);
}

form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

form input[type="text"],
form input[type="email"],
form input[type="tel"],
form textarea,
form select {
    width: 100%;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: var(--font-size-base);
    font-family: var(--font-family-sans);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

form input[type="text"]:focus,
form input[type="email"]:focus,
form input[type="tel"]:focus,
form textarea:focus,
form select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 77, 64, 0.2);
    outline: none;
}

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

form button[type="submit"] {
    background-color: var(--primary-color);
    color: var(--white-text-color);
    border: none;
    padding: 1rem 2rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

form button[type="submit"]:hover,
form button[type="submit"]:focus {
    background-color: #00332B; /* Darker primary */
    outline: none;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--padding-base);
    font-size: 0.95rem;
    background-color: var(--white-text-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 5px;
    overflow: hidden; /* Ensures rounded corners apply to content */
}

table thead {
    background-color: var(--primary-color);
    color: var(--white-text-color);
}

table th,
table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--secondary-color);
}

table th {
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

table tbody tr:nth-child(even) {
    background-color: var(--light-background);
}

table tbody tr:hover {
    background-color: var(--secondary-color);
    cursor: pointer;
}

/* Details/Summary */
details {
    background-color: var(--light-background);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 1rem;
    overflow: hidden;
}

details summary {
    display: block; /* Ensures full width click area */
    padding: 1rem var(--padding-base);
    background-color: var(--secondary-color);
    color: var(--primary-color);
    font-weight: bold;
    cursor: pointer;
    outline: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    user-select: none; /* Prevent text selection on click */
}

details summary:hover,
details summary:focus {
    background-color: var(--primary-color);
    color: var(--white-text-color);
}

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

details summary::before {
    content: '+';
    display: inline-block;
    width: 1.5em;
    font-size: 1.2em;
    margin-right: 0.5em;
    transform: rotate(0deg);
    transition: transform 0.2s ease;
}

details[open] summary::before {
    content: '-';
    transform: rotate(180deg);
}

details .details-content {
    padding: var(--padding-base);
    border-top: 1px solid var(--border-color);
    background-color: var(--white-text-color);
}

/* Aside */
aside {
    background-color: var(--secondary-color);
    border-left: 5px solid var(--primary-color);
    padding: 1.5rem;
    margin-bottom: var(--padding-base);
    border-radius: 0 5px 5px 0;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.05);
}

aside h3 {
    color: var(--primary-color);
    margin-top: 0;
    border-bottom: 1px solid rgba(0, 77, 64, 0.3);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

aside p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--light-text-color);
}

/* Blockquote */
blockquote {
    background-color: var(--light-background);
    border-left: 4px solid var(--accent-color);
    padding: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--light-text-color);
    border-radius: 0 5px 5px 0;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.05);
}

blockquote p {
    margin-bottom: 0.5rem;
}

blockquote footer {
    margin-top: 0.5rem;
    font-size: 0.9em;
    text-align: right;
    color: var(--text-color);
}

/* Definition List */
dl {
    margin-bottom: var(--padding-base);
}

dt {
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 1rem;
    font-size: 1.1rem;
}

dd {
    margin-left: 1.5rem;
    margin-bottom: 0.8rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--secondary-color);
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: var(--white-text-color);
    padding: var(--padding-base);
    text-align: center;
    margin-top: auto; /* Pushes footer to the bottom */
    box-shadow: 0 -2px 5px rgba(0,0,0,0.2);
}

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

footer a {
    color: var(--secondary-color);
    text-decoration: none;
}

footer a:hover,
footer a:focus {
    text-decoration: underline;
    color: var(--white-text-color);
}

/* Responsive Design */
@media (max-width: 992px) {
    .page-container {
        flex-direction: column;
        padding: var(--padding-base); /* Add side padding for smaller screens */
    }

    .sidebar {
        width: 100%;
        margin-right: 0;
        margin-bottom: var(--padding-base);
        order: initial; /* Reset order */
    }

    .main-content {
        padding: var(--padding-base);
    }
}

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

    .utility-bar .logo {
        margin-bottom: 1rem;
    }

    .utility-bar nav ul {
        flex-direction: column;
        width: 100%;
    }

    .utility-bar nav li {
        margin-left: 0;
        margin-bottom: 0.5rem;
        width: 100%;
    }

    .utility-bar nav a {
        display: block;
        padding: 0.75rem 1rem;
        border-radius: 3px;
        background-color: rgba(255,255,255,0.1);
    }

    .utility-bar nav a:hover,
    .utility-bar nav a:focus {
        background-color: rgba(255,255,255,0.2);
    }

    .utility-bar nav a::after {
        display: none; /* Hide underline effect on mobile for block links */
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    .cookie-banner {
        flex-direction: column;
        gap: 0.5rem;
    }
}

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

    .utility-bar {
        padding: 0.5rem var(--padding-base);
    }

    .utility-bar .logo {
        font-size: 1.5rem;
    }

    .page-container {
        padding: 1rem;
    }

    .sidebar, .main-content {
        padding: 1rem;
    }

    form button[type="submit"] {
        width: 100%;
        padding: 0.8rem 1rem;
    }

    table th, table td {
        padding: 0.75rem;
    }
}