/* Universal box-sizing for consistent layout */
        * {
            box-sizing: border-box;
        }

        /* Custom styles for rounded corners and Inter font */
        body {
            font-family: "Inter", sans-serif;
            background-color: #f3f4f6; /* Light gray background */
            font-size: 15px; /* Even smaller base font */
        }
        .container {
            max-width: 98%; /* Even more fluid width */
            margin: 1rem auto; /* Reduced margin */
            padding: 0.8rem; /* Reduced padding */
            background-color: #ffffff;
            border-radius: 8px; /* Smaller rounded corners */
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); /* Lighter shadow */
        }
        .question-card {
            margin-bottom: 0.75rem; /* Reduced margin */
            padding: 0.8rem; /* Reduced padding */
            border: 1px solid #e5e7eb; /* Light border */
            border-radius: 5px; /* Smaller rounded corners */
            background-color: #f9fafb; /* Slightly darker background for cards */
            transition: background-color 0.3s ease; /* Smooth transition for color change */
            position: relative; /* Needed for absolute positioning of points display */
        }
        .question-card.answered-question {
            background-color: #dcfce7; /* Light green background for answered questions */
            border-color: #22c55e; /* Green border */
        }
        .question-text {
            font-weight: 600; /* Semi-bold */
            margin-bottom: 0.4rem; /* Reduced margin */
            color: #1f2937; /* Darker text for questions */
            font-size: 0.9rem; /* Smaller question text */
        }
        .option-label {
            display: flex;
            align-items: center;
            margin-bottom: 0.2rem; /* Reduced margin */
            cursor: pointer;
            padding: 0.3rem; /* Reduced padding */
            border-radius: 3px; /* Smaller rounded corners for options */
            transition: background-color 0.2s ease;
            font-size: 0.8rem; /* Smaller option text */
        }
        .option-label:hover {
            background-color: #e0e7ff; /* Light blue on hover */
        }
        .option-label input[type="radio"] {
            margin-right: 0.5rem; /* Reduced margin */
            accent-color: #4f46e5; /* Purple accent for radio buttons */
        }
        .action-button {
            padding: 0.5rem 1rem; /* Reduced padding */
            color: white;
            border: none;
            border-radius: 5px; /* Smaller rounded corners */
            cursor: pointer; /* Ensure cursor is pointer */
            font-size: 0.8rem; /* Smaller button text */
            font-weight: 600;
            transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.1s ease; /* Added box-shadow transition */

            /* Added properties for robust clickable area */
            display: inline-flex; /* Use flexbox for internal alignment */
            align-items: center; /* Center content vertically */
            justify-content: center; /* Center content horizontally */
            min-width: 100px; /* Ensure a minimum width */
            min-height: 36px; /* Ensure a minimum height (based on padding and font-size) */
        }
        .primary-button {
            background-color: #4f46e5; /* Purple button */
        }
        .primary-button:hover {
            background-color: #4338ca; /* Darker purple on hover */
            transform: translateY(-1px);
        }
        .primary-button:active {
            transform: translateY(1px); /* Make it sink slightly */
            box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); /* Add a subtle inset shadow */
        }
        .secondary-button {
            background-color: #6b7280; /* Gray button */
        }
        .secondary-button:hover {
            background-color: #4b5563; /* Darker gray on hover */
            transform: translateY(-1px);
        }
        .secondary-button:active {
            transform: translateY(1px); /* Make it sink slightly */
            box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); /* Add a subtle inset inset shadow */
        }
        .clear-button {
            background-color: #ef4444; /* Red button */
        }
        .clear-button:hover {
            background-color: #dc2626; /* Darker red on hover */
            transform: translateY(-1px);
        }
        .clear-button:active {
            transform: translateY(1px); /* Make it sink slightly */
            box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); /* Add a subtle inset shadow */
        }
        /* New PDF button style */
        .pdf-button {
            background-color: #10b981; /* Green for PDF button */
        }
        .pdf-button:hover {
            background-color: #059669; /* Darker green on hover */
            transform: translateY(-1px);
        }
        .pdf-button:active {
            transform: translateY(1px); /* Make it sink slightly */
            box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); /* Add a subtle inset shadow */
        }
        /* CSV button style */
        .csv-button {
            background-color: #3B82F6; /* Blue for CSV button */
        }
        .csv-button:hover {
            background-color: #2563EB; /* Darker blue on hover */
            transform: translateY(-1px);
        }
        .csv-button:active {
            transform: translateY(1px);
            box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); /* Add a subtle inset shadow */
        }

        /* New button styles for Export/Import Database */
        .export-button {
            background-color: #f59e0b; /* Orange for Export */
        }
        .export-button:hover {
            background-color: #d97706; /* Darker orange */
        }
        .import-button {
            background-color: #6366f1; /* Indigo for Import */
        }
        .import-button:hover {
            background-color: #4f46e5; /* Darker indigo */
        }
        /* New style for the Data Management navigation button */
        .data-management-nav-button-color {
            background-color: #ea580c; /* Deep orange */
        }
        .data-management-nav-button-color:hover {
            background-color: #c2410c; /* Darker deep orange on hover */
            transform: translateY(-1px);
        }
        .data-management-nav-button-color:active {
            transform: translateY(1px); /* Make it sink slightly */
            box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); /* Add a subtle inset shadow */
        }

        /* New style for encrypted export button */
        .encrypted-export-button {
            background-color: #8b5cf6; /* Purple-ish for encrypted export */
        }
        .encrypted-export-button:hover {
            background-color: #7c3aed; /* Darker purple-ish on hover */
            transform: translateY(-1px);
        }
        .encrypted-export-button:active {
            transform: translateY(1px); /* Make it sink slightly */
            box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); /* Add a subtle inset shadow */
        }


        .results-container {
            margin-top: 1rem; /* Reduced margin */
            padding: 1rem; /* Reduced padding */
            border: 2px solid #6366f1; /* Purple border */
            border-radius: 8px; /* Smaller rounded corners */
            background-color: #eef2ff; /* Light purple background */
            display: flex; /* Use flexbox for layout */
            flex-direction: column; /* Stack children vertically */
            align-items: center; /* Center items horizontally */
            text-align: center;
        }
        .results-container h2 {
            font-size: 1.3rem; /* Increased font size for Results heading */
            color: #4f46e5; /* Purple heading */
            margin-bottom: 0.6rem; /* Reduced margin */
        }
        /* New class for the "Total Score:" label */
        .score-label {
            font-weight: bold;
            font-size: 1.2em; /* Slightly larger font for the label */
            color: #1f2937; /* Dark gray for the label */
        }
        /* Existing class for the numerical score, adjusted */
        .total-score-number { /* Renamed from .total-score for clarity and specific targeting */
            font-weight: bold;
            font-size: 1.5em; /* Slightly larger font for the number */
            color: #10b981; /* Green color for the number */
        }
        /* New wrapper for all questionnaire controls (action and pagination) */
        #main-controls-container {
            display: flex;
            flex-direction: column; /* Stack children vertically */
            align-items: center; /* Center content horizontally */
            gap: 0.8rem; /* Space between the two rows of buttons */
            margin-top: 1rem;
            margin-bottom: 1rem;
            width: 100%; /* Ensure it takes full width to allow centering */
        }
        /* Container for save/load/clear buttons */
        .main-action-buttons {
            display: flex;
            flex-wrap: wrap; /* Allow buttons to wrap */
            justify-content: space-between; /* Changed to space-between to push groups apart */
            gap: 0.6rem; /* This gap might need adjustment or be applied to inner divs */
            width: 100%;
        }
        /* New styles for the two button groups */
        .button-group-left {
            display: flex;
            flex-wrap: wrap;
            gap: 0.6rem; /* Apply gap here */
            justify-content: flex-start; /* Align to the left */
        }
        .button-group-right {
            display: flex;
            flex-wrap: wrap;
            gap: 0.6rem; /* Apply gap here */
            justify-content: flex-end; /* Align to the right */
        }

        /* Reverted style for the button group at the top left to center */
        .top-left-buttons-group {
            display: flex;
            flex-wrap: wrap;
            justify-content: center; /* Center buttons */
            gap: 0.6rem;
            width: 100%; /* Take full width to apply justify-content */
        }


      .pagination-controls {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping */
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
}
        .pagination-button {
            padding: 0.35rem 0.7rem; /* Reduced padding */
            background-color: #6b7280; /* Gray for pagination buttons */
            color: white;
            border: none;
            border-radius: 4px; /* Smaller rounded corners */
            cursor: pointer;
            font-size: 0.8rem; /* Smaller font */
            transition: background-color 0.2s ease;
        }
        .pagination-button:hover:not(:disabled) {
            background-color: #4b5563;
        }
        .pagination-button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
        .page-info {
            font-size: 0.8rem; /* Smaller font */
            color: #374151;
        }
        /* Progress Bar Styles */
        .progress-bar-container {
            width: 100%;
            background-color: #e0e0e0;
            border-radius: 4px;
            height: 18px; /* Reduced height of the bar */
            overflow: hidden; /* Ensures inner bar respects border-radius */
            margin-top: 0.8rem; /* Reduced margin */
        }
        .progress-bar-fill {
            height: 100%;
            width: 0%; /* Initial width */
            background-color: #4f46e5; /* Purple fill */
            border-radius: 4px;
            text-align: center;
            color: white;
            line-height: 18px; /* Center text vertically */
            transition: width 0.5s ease-in-out; /* Smooth transition for width changes */
            font-size: 0.75rem; /* Smaller font */
        }
        .message-box {
            position: fixed;
            top: 1rem; /* Changed from bottom to top */
            left: 50%;
            transform: translateX(-50%);
            background-color: #333;
            color: white;
            padding: 0.75rem 1.25rem;
            border-radius: 8px;
            font-size: 0.9rem;
            z-index: 1000;
            opacity: 0;
            transition: opacity 0.3s ease-in-out;
            border: 1px solid #6366f1; /* Added border */
        }
        .message-box.show {
            opacity: 1;
        }
        /* Section Heading Style */
        .section-heading {
            font-size: 1.2rem;
            font-weight: bold;
            color: #374151; /* Dark gray */
            margin-top: 1.5rem;
            margin-bottom: 1rem;
            text-align: center;
            padding: 0.5rem;
            background-color: #eef2ff; /* Light purple background */
            border-radius: 5px;
            border: 1px solid #c7d2fe; /* Light purple border */
        }
        /* Styles for the results page */
        .results-page {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1.5rem;
            padding: 1.5rem;
        }
        .chart-container {
            width: 100%;
            max-width: 250px; /* Reduced max-width for smaller charts */
            background-color: #ffffff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
            padding: 0.8rem; /* Reduced padding */
        }
        .chart-container h3 {
            font-size: 0.8rem; /* Smaller font size for chart titles */
            font-weight: bold;
            text-align: center;
            margin-bottom: 0.6rem; /* Reduced margin */
            color: #374151;
        }
        .section-charts-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* Responsive grid for charts, adjusted minmax */
            gap: 1rem; /* Reduced gap */
            width: 100%;
            justify-items: center;
        }
        /* Styles for results page action buttons at the top */
        .results-top-actions {
            display: flex;
            flex-wrap: wrap; /* Allow buttons to wrap */
            justify-content: center; /* Centered buttons */
            gap: 0.6rem;
            margin-bottom: 1rem; /* Add some space below the buttons */
            width: 100%; /* Ensure it takes full width to align content */
        }
        /* Hide the "Overall Results" title */
        .results-page .hidden-title {
            display: none;
        }
        /* New styles for risk level display */
        .risk-level-display {
            font-size: 1.1rem; /* Slightly smaller font for risk level */
            font-weight: bold;
            margin-top: 0.4rem; /* Reduced margin */
            padding: 0.3rem 0.6rem; /* Reduced padding */
            border-radius: 5px;
            color: white; /* Text color for risk levels */
            text-align: center; /* Center text within the box */
            margin-left: auto; /* Center the block itself */
            margin-right: auto; /* Center the block itself */
        }
        .risk-low { background-color: #3B82F6; } /* Blue */
        .risk-medium { background-color: #10B981; } /* Green */
        .risk-high { background-color: #F59E0B; } /* Orange */
        .risk-critical { background-color: #EF4444; } /* Red */

        /* New style for the data management page */
        #data-management-page {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1.5rem;
            padding: 1.5rem;
            border: 2px solid #4f46e5;
            border-radius: 8px;
            background-color: #eef2ff;
            margin-top: 1rem;
        }
        #data-management-page h2 {
            font-size: 1.3rem;
            font-weight: bold;
            color: #4f46e5;
            margin-bottom: 0.6rem;
        }
        #data-management-page .button-group {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 0.6rem;
            width: 100%;
        }
        /* New style for section groups within data management */
        .section-group {
            padding: 1rem;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            background-color: #ffffff;
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
            width: 100%;
            max-width: 400px; /* Constrain width for better appearance */
            margin-bottom: 1rem; /* Space between groups */
        }
        .section-group h3 {
            font-size: 1.1rem;
            font-weight: 600;
            color: #374151;
            margin-bottom: 0.8rem;
            text-align: center;
        }

        /* Modal Styles */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.6);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1001;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.3s ease, visibility 0.3s ease;
        }
        .modal-overlay.show {
            opacity: 1;
            visibility: visible;
        }
        .modal-content {
            background-color: #ffffff;
            padding: 2rem;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
            text-align: center;
            max-width: 400px;
            width: 90%;
            transform: translateY(-20px);
            transition: transform 0.3s ease;
        }
        .modal-overlay.show .modal-content {
            transform: translateY(0);
        }
        .modal-content h3 {
            font-size: 1.2rem;
            font-weight: bold;
            color: #1f2937;
            margin-bottom: 1rem;
        }
        .modal-content p {
            margin-bottom: 1.5rem;
            color: #4b5563;
        }
        .modal-buttons {
            display: flex;
            justify-content: center;
            gap: 1rem;
        }
        .question-points-display {
            position: absolute;
            bottom: 5px; /* Adjust as needed */
            right: 8px; /* Adjust as needed */
            font-size: 0.7em;
            color: #6b7280; /* Gray color */
            font-weight: bold;
            background-color: #e0e0e0; /* Light background for visibility */
            padding: 2px 5px;
            border-radius: 3px;
        }
        /* Styles for the intro page */
        #intro-page {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            padding: 3rem 2rem;
            gap: 1.5rem;
            background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
            min-height: 100vh;
            box-sizing: border-box;
        }
        #intro-page h2 {
            font-size: 1.8rem;
            font-weight: 700;
            color: #1e293b;
            margin-top: 0.5rem !important;
            margin-bottom: 0 !important;
            line-height: 1.3;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
            letter-spacing: -0.025em;
        }
        /* Apply the target font size and line height to all paragraphs and list items directly within #intro-page */
        #intro-page p,
        #intro-page ul li {
            font-size: 0.85rem;
            color: #475569;
            line-height: 1.6;
            max-width: 900px;
            margin-bottom: 0.1rem;
            font-weight: 400;
        }
        #intro-page ul {
            list-style: none;
            padding-left: 0;
            text-align: left;
            max-width: 900px;
            margin-top: 0.2rem;
            margin-bottom: 0.2rem;
            color: #475569;
        }
        #intro-page ul li {
            position: relative;
            padding-left: 1.5rem;
            margin-bottom: 0.2rem;
        }
        #intro-page ul li:before {
            content: "•";
            color: #3b82f6;
            font-weight: bold;
            position: absolute;
            left: 0;
            font-size: 1.2rem;
        }
        #intro-page p b,
        #intro-page p i {
            margin-bottom: 0.05rem !important;
        }
        #intro-page ul + p {
            margin-top: 0 !important;
        }
        #intro-page p:last-of-type {
            margin-bottom: 0.2rem !important;
        }
        #intro-page .start-button {
            margin-top: 1rem;
            padding: 1.2rem 3rem;
            font-size: 1.3rem;
            font-weight: 600;
            background: linear-gradient(135deg, #64748b 0%, #475569 100%);
            color: white;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(100, 116, 139, 0.3);
            letter-spacing: 0.025em;
        }
        #intro-page .start-button:hover {
            background: linear-gradient(135deg, #475569 0%, #334155 100%);
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(100, 116, 139, 0.4);
        }
        #intro-page .start-button:active {
            transform: translateY(-1px);
            box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
        }
        /* Styles for the new thematic units lists */
        #thematic-units-container {
            margin-top: 0.2rem;
            margin-bottom: 0.2rem;
            width: 100%;
            max-width: 800px;
            margin-left: auto;
            margin-right: auto;
            border: 1px solid #e2e8f0;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
            background: white;
            padding: 0;
        }
        .thematic-units-heading {
            font-size: 1.1rem;
            font-weight: 600;
            color: #ffffff;
            margin-bottom: 0;
            padding: 0.8rem 1rem;
            background: linear-gradient(135deg, #64748b 0%, #475569 100%);
            border-bottom: 1px solid #334155;
            text-align: center;
            border-radius: 12px 12px 0 0;
            letter-spacing: 0.025em;
        }
        .thematic-units-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1rem;
            padding: 1rem;
        }
        .thematic-list {
            list-style: none;
            padding-left: 0;
            margin: 0;
        }
        .thematic-list li {
            font-size: 0.8rem !important;
            color: #475569 !important;
            margin-bottom: 0.15rem !important;
            line-height: 1.1 !important;
            padding: 0.1rem 0 !important;
            border-bottom: 1px solid #f1f5f9;
            transition: all 0.2s ease;
            list-style: none !important;
        }
        .thematic-list li:before {
            display: none !important;
        }
        .thematic-list li:hover {
            color: #1e293b;
            background-color: #f8fafc;
            padding-left: 0.3rem;
            border-radius: 4px;
        }
        .thematic-list li:last-child {
            border-bottom: none;
        }
        /* Style for underlined titles */
        .underlined-title {
            font-weight: 600;
            font-size: 1.1rem;
            color: #1e293b;
            text-decoration: none;
            margin-top: 0.5rem;
            margin-bottom: 0.3rem;
            padding: 1rem 1.5rem;
            background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
            border-left: 4px solid #3b82f6;
            border-radius: 8px;
            display: inline-block;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }
        /* Styles for the logo container */
        #logo-container {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            padding: 1rem 0; /* Add some vertical padding */
            margin-bottom: 1rem; /* Space below logos */
        }
        #logo-container img {
            height: 50px; /* Fixed height for logos */
            max-width: 48%; /* Ensure logos don't overflow on smaller screens */
            object-fit: contain; /* Maintain aspect ratio */
        } 
		
		#export-db-button,
#import-db-button,
#export-csv-button {
    display: none !important;
}

@media (max-width: 768px) {
    .thematic-units-grid {
        grid-template-columns: 1fr; /* Switch to one column */
    }
}

@media (max-width: 600px) {
    #section-select {
        width: 100%;
        max-width: 300px;
    }
}