/* Basic Reset & Defaults */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Palette - Reverted Nav Color */
    --bg-light: #f8f9fa;
    --bg-card: #ffffff;
    --text-primary: #212529;
    --text-secondary: #495057;
    --accent-primary: #0052cc; /* Atlassian Blue */
    --accent-primary-light: #ddeeff; /* Lighter blue for highlight */
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 82, 204, 0.08);
    --nav-bg: #212529; /* CORRECTED: Dark background */
    --nav-text: #f0f4f8;
    --nav-hover-bg: #343a40; /* CORRECTED: Darker hover */
    --highlight-border: #0041a3;
    --focus-ring-color: #75aaff;

    /* Fonts */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; /* Fallback fonts */
    --base-font-size: 16px;
    --transition-speed: 0.25s;
    --transition-easing: ease-in-out; /* Smoother easing */
}

html, body {
    font-family: var(--font-primary);
    color: var(--text-primary);
    background-color: var(--bg-light);
    line-height: 1.65; /* Improved readability */
    font-size: var(--base-font-size);
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased; /* Smoother fonts */
	-moz-osx-font-smoothing: grayscale;
}

/* Accessibility: Visually Hidden Class */
.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* Accessibility: Focus Styles */
*:focus-visible {
    outline: 3px solid var(--focus-ring-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.25);
    border-radius: 4px;
}
*:focus:not(:focus-visible) {
  outline: none;
}
.question input[type="radio"]:focus-visible {
     box-shadow: 0 0 0 3px var(--focus-ring-color);
     outline: none;
}
button:focus-visible {
    /* Use default focus-visible, looks good on buttons */
}


/* Header */
header {
    display: flex;
    align-items: center;
    padding: 0 5%; /* Padding handled by items */
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 100;
    height: 60px; /* Fixed height */
}

.menu-icon {
    font-size: 0; /* Hide text, use SVG */
    cursor: pointer;
    padding: 0.8rem; /* Adjusted tap area */
    margin-right: 0.5rem; /* Adjust space */
    color: var(--text-secondary);
    transition: background-color var(--transition-speed) ease;
    border: none;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Make it circular */
}
.menu-icon:hover {
    background-color: #f1f3f5; /* Subtle background on hover */
}
.menu-icon svg {
    width: 20px; /* Slightly smaller icon */
    height: 20px;
    stroke: var(--text-primary); /* Darker icon */
    stroke-width: 2.5; /* Slightly thicker */
}

.logo {
    font-weight: 600;
    font-size: 1.3rem; /* Adjusted size */
    color: var(--text-primary);
}

/* Side Navigation - Corrected Colors */
#side-nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 260px; /* Adjusted width */
    background-color: var(--nav-bg); /* CORRECTED */
    color: var(--nav-text);
    padding: 1rem 0; /* Reduced padding */
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1); /* Smoother ease */
    z-index: 1001; /* Above overlay */
    box-shadow: 4px 0px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

#side-nav.nav-open {
    transform: translateX(0);
}

.close-btn {
    position: absolute;
    top: 10px; /* Position relative to nav */
    right: 10px; /* Closer to edge */
    font-size: 2.2rem; /* Adjusted size */
    color: var(--nav-text);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 0.5;
    opacity: 0.7;
    transition: opacity var(--transition-speed) ease, background-color var(--transition-speed) ease;
    border-radius: 50%;
}
.close-btn:hover {
     opacity: 1;
     background-color: rgba(255, 255, 255, 0.1);
}

#side-nav ul {
    list-style: none;
    padding: 0;
    margin: 50px 0 0 0; /* Space for close button */
    flex-grow: 1;
}

#side-nav li {
    margin: 0 1rem; /* Indent links */
}

#side-nav .nav-link {
    display: block;
    background: none;
    border: none;
    color: #bdc3c7; /* Lighter grey for links */
    font-family: var(--font-primary);
    font-size: 0.95rem; /* Adjusted size */
    font-weight: 500;
    padding: 0.8rem 1rem; /* Adjusted padding */
    border-radius: 4px; /* Consistent radius */
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    margin-bottom: 0.3rem;
}

#side-nav .nav-link:hover,
#side-nav .nav-link.active-nav-link { /* Style for active link */
    background-color: var(--nav-hover-bg); /* CORRECTED */
    color: #ffffff;
}

.nav-footer {
    padding: 1rem 2rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4); /* Dimmer footer text */
    margin-top: auto; /* Push to bottom */
    text-align: center;
}


/* Overlay */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(23, 43, 77, 0.6); /* Slightly darker overlay */
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) var(--transition-easing), visibility 0s var(--transition-speed) linear;
    z-index: 1000; /* Below nav, above main content */
}
#overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-speed) var(--transition-easing), visibility 0s 0s linear;
}


/* Main Content & Sections */
main {
    padding: 2rem 5%;
    transition: filter var(--transition-speed) ease;
}

.main-content-area {
    display: none;
}
.main-content-area.active {
    display: block;
    animation: fadeIn 0.5s ease forwards; /* Fade in content area */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); } /* Slight move up */
    to { opacity: 1; transform: translateY(0); }
}

.assessment-section {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem 0 3rem 0; /* Adjusted padding */
    text-align: center;
    opacity: 0;
}

.assessment-section.active {
    display: flex;
    opacity: 1;
}

.content {
    max-width: 760px; /* Slightly narrower for focus */
    width: 100%;
    padding: 2.5rem;
}

#welcome .content {
     background-color: transparent;
     box-shadow: none;
     padding-top: 5rem;
     padding-bottom: 5rem;
     text-align: center;
}

.card {
    background-color: var(--bg-card);
    padding: 2.5rem 3rem; /* More horizontal padding */
    border-radius: 6px; /* Slightly less round */
    box-shadow: 0 2px 5px var(--shadow-color); /* Refined shadow */
    border: 1px solid var(--border-color);
    margin: 2rem auto;
}


h1 {
    font-size: 2.2rem; /* Adjusted size */
    font-weight: 600; /* Slightly less bold */
    margin-bottom: 1rem;
    line-height: 1.3;
    color: var(--text-primary);
}

/* Category Header Alignment - Corrected */
.category-header {
    display: flex;
    align-items: flex-start; /* Align number top */
    margin-bottom: 2.5rem; /* Increased space */
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.category-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent-primary-light);
    color: var(--accent-primary);
    border-radius: 50%;
    width: 36px; /* Larger circle */
    height: 36px;
    font-size: 1.2rem; /* Larger number */
    font-weight: 600;
    margin-right: 1rem; /* More space */
    flex-shrink: 0; /* Prevent shrinking */
    margin-top: 0.1em; /* Align top edge */
}

.category-text {
    flex-grow: 1;
    /* Removed top padding, alignment handled by parent flex */
}

.category-title {
    font-size: 1.4rem; /* Adjusted size */
    font-weight: 600;
    margin-bottom: 0.25rem; /* Less space between title/desc */
    color: var(--text-primary); /* Darker title */
    padding-top: 0;
}

.category-description {
    margin-bottom: 0;
    font-size: 0.95rem; /* Adjusted size */
    color: var(--text-secondary);
}

.subtle-text {
    color: var(--text-secondary);
    max-width: 600px; /* Adjusted width */
    margin-left: auto;
    margin-right: auto;
    font-size: 1rem; /* Slightly larger desc */
    line-height: 1.6;
}

/* Assessment Form Styling */
#assessment-form {
    width: 100%;
}

.assessment-category .content {
    text-align: left;
}

.question {
    margin-bottom: 1.8rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f3f5; /* Lighter separator */
}
.question:last-of-type {
    border-bottom: none;
     margin-bottom: 1.5rem;
}

.question p {
    font-weight: 600; /* Make question slightly bolder */
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1rem; /* Adjusted size */
    line-height: 1.5;
}

.question label {
    display: flex;
    align-items: center; /* Center align radio and text vertically */
    margin-bottom: 0.8rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: color var(--transition-speed) ease, background-color var(--transition-speed) ease;
    padding: 0.6rem 0.8rem; /* Adjusted padding */
    border-radius: 4px;
    border: 1px solid transparent; /* Add border for hover effect */
}

.question label:hover {
    color: var(--text-primary);
    background-color: #f8f9fa;
    border-color: var(--border-color); /* Show border on hover */
}

.question input[type="radio"] {
    margin-right: 0.9rem; /* More space */
    flex-shrink: 0;
    accent-color: var(--accent-primary);
    height: 18px; /* Slightly larger */
    width: 18px;
    cursor: pointer;
    appearance: none; /* Allow custom styling */
    border: 2px solid #adb5bd; /* Grey border */
    border-radius: 50%;
    position: relative; /* For custom dot */
    transition: border-color 0.2s ease;
    vertical-align: middle; /* Better alignment */
}
.question input[type="radio"]:checked {
    border-color: var(--accent-primary); /* Blue border when checked */
}
.question input[type="radio"]:checked::after { /* Custom dot */
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent-primary);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.question input[type="radio"]:hover {
     border-color: #6c757d;
}
.question input[type="radio"]:checked:hover {
     border-color: var(--highlight-border);
}


/* Buttons */
button {
    font-family: var(--font-primary);
    border: none;
    padding: 0.8rem 1.8rem; /* Adjusted padding */
    font-size: 0.95rem;
    font-weight: 500; /* Medium weight */
    border-radius: 6px; /* Match card radius */
    cursor: pointer;
    transition: background-color var(--transition-speed) ease, transform 0.1s ease, box-shadow var(--transition-speed) ease;
    margin-top: 1.5rem;
}
button.primary-button { /* Distinct primary style */
     background-color: var(--accent-primary);
     color: #ffffff;
     box-shadow: 0 2px 4px rgba(0, 82, 204, 0.2);
}
button.primary-button:hover {
    background-color: #0041a3; /* Slightly darker hover */
    box-shadow: 0 3px 6px rgba(0, 82, 204, 0.3);
}
button.secondary-button,
button.restart-button,
.next-btn { /* Group secondary styles */
    background-color: #f1f3f5; /* Lighter grey */
    color: var(--text-primary);
    border: 1px solid #ced4da; /* Subtle border */
}
button.secondary-button:hover,
button.restart-button:hover,
.next-btn:hover {
     background-color: #e9ecef; /* Darker grey */
     border-color: #adb5bd;
}


button:active {
    transform: translateY(1px) scale(0.99); /* More subtle press */
    box-shadow: none; /* Remove shadow on press */
}

.next-btn {
    display: block;
    margin-left: auto;
    margin-right: 0;
}


/* Framework Table Styling - Corrected */
.framework-header {
    background: none;
    box-shadow: none;
    border: none;
    text-align: center;
    padding-bottom: 0.5rem;
    margin-bottom: 0;
}
.framework-header h1 {
    font-size: 2rem;
}

.table-container {
    overflow-x: auto;
    margin: 1.5rem auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-card);
    box-shadow: 0 3px 10px var(--shadow-color);
    max-width: 1150px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    table-layout: fixed; /* Force column widths */
    border: none;
}

th, td {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.2rem;
    text-align: left;
    vertical-align: top; /* Keep top align */
    transition: background-color var(--transition-speed) ease;
}
tbody tr:last-child td,
tbody tr:last-child th {
    border-bottom: none;
}
/* Add subtle row hover */
tbody tr:hover td, tbody tr:hover th.category-name-cell {
    background-color: #f8f9fa;
}


thead th {
    background-color: #f8f9fa;
    color: var(--text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
    text-align: left; /* Align level headers left */
    border-bottom: 2px solid var(--border-color); /* Thicker header bottom border */
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}
thead th:first-child {
     min-width: 160px;
     width: 18%; /* Adjusted width */
     z-index: 11; /* Above other headers */
     border-left: none;
     text-align: left; /* Align left */
     padding-left: 1.2rem;
     font-weight: 500;
     color: var(--text-secondary);
}
/* Corrected Widths for 4 Level Columns + 1 Category Column */
thead th:not(:first-child) {
    width: 20.5%; /* (100 - 18) / 4 */
}
thead th:last-child {
    border-right: none;
}


tbody th.category-name-cell {
     background-color: #f8f9fa; /* Match header bg */
     font-weight: 600;
     vertical-align: top; /* Align top */
     padding-top: 1rem;
     text-align: left;
     padding-right: 1.5rem;
     color: var(--text-primary);
     position: sticky;
     left: 0;
     z-index: 5; /* Keep category sticky */
     border-right: 1px solid var(--border-color); /* Vertical separator */
     border-left: none;
     min-width: 160px; /* Match header */
     width: 18%; /* Match header */
}

td ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

td li {
    margin-bottom: 0.6rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
td li:last-child {
    margin-bottom: 0;
}

/* Highlight Style */
.highlighted-level {
    background-color: var(--accent-primary-light) !important;
    position: relative;
}
.highlighted-level::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--accent-primary);
    border-radius: 0 2px 2px 0;
}

.highlighted-level ul li {
     color: #0747a6 !important;
     font-weight: 500;
}


/* Restart Button Styling (in Framework) */
.framework-footer {
    text-align: center;
    padding: 0;
    background: none;
    box-shadow: none;
    border: none;
}
.restart-button {
    display: inline-block;
    margin: 2.5rem auto 1rem auto;
    max-width: 200px;
    width: auto;
}


/* Footer */
footer {
    text-align: center;
    padding: 2rem 5%;
    margin-top: 4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}


/* Animations */
.animate-in {
    opacity: 0;
    transform: translateY(15px);
    animation: fadeInUp 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

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

/* Responsive */
@media (max-width: 992px) {
     #framework-section .content {
        max-width: 95%;
     }
     tbody th.category-name-cell {
        padding-right: 1rem;
        font-size: 0.8rem;
        min-width: 140px;
        width: 20%;
    }
    thead th:first-child {
         min-width: 140px;
         width: 20%;
    }
     thead th:not(:first-child) {
        width: 20%;
    }

    th, td {
        padding: 0.7rem 0.9rem;
        font-size: 0.82rem;
    }
}


@media (max-width: 768px) {
    header, main, footer {
        padding-left: 4%;
        padding-right: 4%;
    }
    h1 {
        font-size: 1.8rem;
    }
    .category-title {
        font-size: 1.3rem;
    }
    .content, .card {
        padding: 1.5rem;
    }
    .question label {
        font-size: 0.9rem;
    }
    #side-nav {
        width: 250px;
    }
    tbody th.category-name-cell {
        width: auto; /* Let it wrap */
        text-align: left;
        padding-right: 0.8rem;
        font-size: 0.8rem;
        vertical-align: top;
        background-color: #fff;
        border-right: 1px solid var(--border-color);
        min-width: 100px; /* Minimum width */
    }
    thead th:first-child {
         min-width: 100px;
    }
    thead th, tbody th.category-name-cell {
        position: sticky;
        left: 0;
        z-index: 5;
    }
    thead th:first-child, tbody th.category-name-cell {
         z-index: 6;
         border-left: none;
    }

    th, td {
        padding: 0.6rem 0.8rem;
        font-size: 0.78rem;
    }
    thead th {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
     h1 {
        font-size: 1.6rem;
    }
    .category-title {
        font-size: 1.2rem;
    }
    .category-number {
        width: 24px; height: 24px; line-height: 24px; font-size: 0.9rem; margin-right: 0.5rem;
    }
    button {
        width: 100%;
        padding: 0.9rem 1rem;
    }
    .next-btn {
        width: auto; /* Allow next button to size naturally */
        float: right;
    }
     #side-nav {
        width: 85%;
    }
     /* Ensure sticky header works on mobile */
     thead th, tbody th.category-name-cell {
        background-color: #f8f9fa; /* Match bg */
     }
}