* {
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
}

body {
    background: var(--bg-light);
}

.app {
    background: var(--bg-white);
    width: 100%;
    max-width: 800px;
    margin: 50px auto;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: var(--box-shadow);
}

.app h1 {
    font-size: 1.8rem;
    color: var(--primary);
    font-weight: 600;
    text-align: center;
    margin-bottom: 2rem;
}

.quiz {
    width: 80%;
    max-width: calc(100% - 160px); /* Make space for wider vertical nav bar */
    margin: 0 auto;
    margin-top: 20px;
    margin-bottom: 90px;
    margin-right: 160px; /* Space for wider vertical nav bar with 2 columns */
    position: relative;  /* Add this to ensure proper positioning context */
}

#question {
    font-size: 18px;
    color: #333;
    font-weight: bold;
    margin-bottom: 20px;
    position: relative;
    padding-right: 70px;  /* Make space for points text */
}

#answer-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;  /* Add this to ensure proper positioning context */
}

/* Keep original multiple choice style */
.btn {
    background: #fff;
    color: #333;
    font-weight: 500;
    width: 100%;
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: all 0.05s;
    border-color: black;
}

.btn:hover {
    background: #355070;
    color: #fff;
    border-color: #355070;
}

.btn.selected {
    background: #6D597A;
    color: #fff !important;
    border-color: #6D597A;
}

.btn.selected:hover {
    background: #355070;
    color: #fff;
    border-color: #355070;
}

/* Modern gradient header */
.header {
    background: linear-gradient(135deg, #B56576, #6D597A);
    padding: 20px;
    margin-top: 50px !important;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    position: relative;
}

/* Modernized Navigation Bar - Vertical on Right */
.nav-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: fixed;
    top: 60px; /* Start below header */
    right: 0;
    height: calc(100vh - 60px); /* Fill remaining height */
    width: 140px; /* Wider navigation bar for 2 columns */
    background: #ffffff;
    padding: 1rem 0.5rem;
    box-shadow: -2px 0px 10px rgba(0, 0, 0, 0.1);
    z-index: 999; /* Below header but above content */
    gap: 0.75rem;
    overflow: hidden;
    border-radius: 0;
    box-sizing: border-box;
    justify-content: flex-start;
}

.nav-arrow {
    background: #ffffff;
    color: #355070;
    font-size: 1.1rem;  /* Slightly smaller font */
    border: 2px solid #355070;
    border-radius: 6px;
    width: 50px;  /* Adjusted for vertical layout */
    height: 40px;  /* Smaller height */
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    font-weight: 600;
    flex-shrink: 0;
}

.nav-arrow:hover {
    background: #355070;
    color: #ffffff;
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(53, 80, 112, 0.25);
}

/* Navigation circles - 2 column grid layout */
.page-numbers {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin: 0;
    justify-content: center;
    align-items: start;
    align-content: start;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: #cacaca #ffffff;
    width: 100%;
    grid-auto-rows: min-content;
    justify-items: stretch; /* Default: stretch to fill grid cells */
}

/* Custom scrollbar for webkit browsers */
.page-numbers::-webkit-scrollbar {
    width: 4px;
}

.page-numbers::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.page-numbers::-webkit-scrollbar-thumb {
    background: #cacaca;
    border-radius: 10px;
}

.page-numbers::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.page-circle {
    background: #ffffff;
    border: 1px solid #cacaca;
    color: #355070;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 0;
    height: fit-content;
}

/* Visited state */
.page-circle.visited {
    border: 2px solid #355070;
    background: #ffffff;
    color: #355070;
}

/* Selected/Answered state */
.page-circle.selected {
    background: #355070 !important;  /* Make answered questions themed */
    color: white !important;
    border-color: #355070 !important;
}
.page-circle.selected:hover {
    background: white;
    color: #355070;
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(181, 101, 118, 0.2);
}
/* Active/Current state */
.page-circle.active {
    background: white;
    color: #355070 !important;
    border: 2px solid #355070;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(181, 101, 118, 0.3);
}

/* Hover states - only change background for visited circles */
.page-circle.visited:hover {
    background: #355070;
    color: #ffffff;
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(181, 101, 118, 0.2);
}

/* Unvisited circles only get a slight transform on hover */
.page-circle:not(.visited):hover {
    transform: translateX(-2px);
    box-shadow: 0 2px 8px rgba(181, 101, 118, 0.1);
}

/* Mobile responsive styles */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        width: 100%;
        padding: 0 15px;
    }
    
    /* Make text more readable on small screens */
    p, h1, h2, h3, h4, h5, h6 {
        word-wrap: break-word;
    }

    .app {
        margin: 20px auto;
        border-radius: 10px;
    }

    .quiz {
        width: 90%;
        margin: 0 auto 100px auto;
        max-width: 100%;
        padding-right: 125px; /* Space for navbar (110px width + 15px gap) */
        box-sizing: border-box;
    }

    .nav-bar {
        width: 110px;
        padding: 0.8rem 0.4rem;
        height: calc(100vh - 60px);
        top: 60px;
    }

    #answer-buttons {
        padding-right: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .answer-option,
    .answer-container {
        max-width: 100%;
        box-sizing: border-box;
    }

    .nav-bar .timer {
        font-size: 0.9rem;
        padding: 0.6rem 0.4rem;
    }

    .nav-bar .timer span {
        font-size: 1.1rem;
        font-weight: 700;
    }

    .page-numbers {
        gap: 5px;
        flex: 1;
        min-height: 0;
        padding: 0.4rem;
    }

    .page-circle {
        font-size: 0.8rem;
    }

    .nav-arrow {
        width: 45px;
        height: 35px;
    }

    .auth-nav {
        top: 10px;
        right: 10px;
    }

    .auth-nav-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

    /* Make question title smaller for mobile */
    #question {
        font-size: 14px;
        line-height: 1.4;
        padding-top: 10px;
    }

    #question .question-text {
        font-size: 14px;
    }

    /* Make input box smaller for mobile */
    .input-box {
        font-size: 14px;
        padding: 6px;
        max-width: 100%;
    }

    .mathquill-input {
        font-size: 14px !important;
        padding: 6px !important;
    }

    .input-label {
        font-size: 14px;
    }

    /* Center and widen Results button in navbar for mobile */
    .nav-arrow.show-results {
        width: 100% !important;
        padding: 0 12px !important;
        height: 38px !important;
        font-size: 0.85rem !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 auto !important;
    }

    /* Make multiple-select checkboxes squared on mobile */
    .answer-checkbox {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        min-height: 20px !important;
        border-radius: 0 !important;
        flex-shrink: 0 !important;
    }

    .answer-checkbox:checked::before {
        font-size: 12px !important;
    }

    /* Make AI explain buttons smaller for mobile in seecorrectanswers */
    .explain-btn {
        font-size: 12px !important;
        margin-bottom: 8px !important;
    }

    .explain-btn .wrapper {
        min-width: 100px !important;
        padding: 8px 16px !important;
    }

    .explain-btn .wrapper span {
        font-size: 12px !important;
    }

    /* Make multiple choice and multiple select smaller for mobile in seecorrectanswers */
    .answer-option {
        padding: 8px 12px !important;
        margin: 3px 0 !important;
        font-size: 13px !important;
        border-radius: 4px !important;
    }

    .answer-container {
        padding: 8px 12px !important;
        font-size: 13px !important;
        border-radius: 4px !important;
    }

    .answer-label {
        font-size: 12px !important;
        padding-left: 8px !important;
    }

    /* Make grid containers smaller for image-based answers */
    /* Make grid containers smaller for image-based answers */
    .answer-grid-container {
        gap: 10px !important;
        margin: 10px 0 !important;
        max-width: 100% !important;
    }

    .answer-grid-container .answer-option {
        padding: 10px !important;
        font-size: 12px !important;
    }

    .answer-grid-container .answer-option img {
        max-height: 100px !important;
    }

    .answer-grid-container .answer-option span {
        font-size: 0.85em !important;
        margin-top: 8px !important;
    }

    .answer-grid-container .answer-option div[style*="position: absolute"] {
        font-size: 1em !important;
        top: 8px !important;
        right: 8px !important;
    }

    /* Center seecorrectanswers content and buttons for mobile */
    .results-header {
        justify-content: center !important;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .results-header > div {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem;
        width: 100%;
    }

    .back-btn {
        margin: 0 !important;
        padding-top: 20px !important;
    }

    .bottom-back-btn {
        display: block;
        margin: 20px auto 0 auto !important;
        padding-top: 20px !important;
    }

    /* Center question blocks in seecorrectanswers */
    #answer-buttons {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #answer-buttons > div {
        width: 100%;
        max-width: 100%;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    body {
        font-size: 14px;
    }
}

/* General container for correct answers */
.correct-answer {
    margin-bottom: 20px;
    padding: 15px;
    border: none;
    background-color: transparent;
}

/* Question text styling */
.correct-answer h4 {
    margin-bottom: 10px;
}

/* Answer option styling */
.answer-option {
    padding: 5px;
    margin: 5px 0;
    border: 1px solid #ddd;
    border-radius: 3px;
    background-color: #fff;
}

/* Highlight user's selected answer */
.answer-option.selected {
    background: #fee2e2;
    color: #991b1b;
}

/* Highlight correct answer */
.answer-option.correct {
    background: #dcfce7;
    color: #166534;
}

/* Feedback for correct and incorrect answers */
.correct-feedback {
    color: #4CAF50; /* Green */
    font-weight: bold;
}

.incorrect-feedback {
    color: #f44336; /* Red */
    font-weight: bold;
}

/* Score section */
h3 {
    text-align: center;
    margin-bottom: 20px;
}

.input-container {
    display: flex; /* Align items side by side */
    align-items: center; /* Vertically align label and input */
    gap: 10px; /* Space between label and input */
    margin: 10px 0; /* Space above and below the container */
}

.input-label {
    font-size: 16px; /* Adjust font size */
    font-weight: bold; /* Make label text bold */
    color: #333; /* Label text color */
    margin: 0; /* Remove default margin */
}

.input-box {
    flex: 1; /* Allow the input box to grow if needed */
    max-width: 400px; /* Maximum width for responsiveness */
    padding: 8px; /* Adds padding inside the input box */
    font-size: 16px; /* Adjust font size for better readability */
    border: 1px solid #ccc; /* Light gray border */
    border-radius: 5px; /* Rounded corners */
    border-color: black;
}

/* MathQuill input styling */
.mathquill-input {
    flex: 1;
    min-height: 40px;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 5px;
    border-color: black;
    background: #fff;
    padding: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

.mathquill-input .mq-editable-field {
    min-height: 24px;
    padding: 8px;
}

.mathquill-input .mq-editable-field.mq-focused {
    border: 2px solid #6D597A;
    border-radius: 3px;
}
.question-image {
    max-width: 40% !important;
    height: auto;
    margin-top: 10px;
    border-radius: 8px;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);
}

.subquestion-image {
    max-width: 35% !important;
    height: auto;
    margin-top: 8px;
    margin-bottom: 10px;
    border-radius: 6px;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);
}
.answer-image {
    max-width: 100%; /* Makes image responsive to container width */
    height: auto; /* Maintains aspect ratio */
    margin: 10px 0; /* Top/bottom margin only */
    display: block; /* Allows margin auto to work */
}

@media screen and (min-width: 768px) {
    .answer-image {
        max-width: 300px; /* Smaller on larger screens */
    }
}
.answer-container {
    background: #fff;
    display: flex;
    color: #333;
    font-weight: 500;
    width: 100%;
    border: 1px solid #ccc;
    padding: 13px;
    border-radius: 8px;
    text-align: left;
    align-items: center; /* Centers items vertically */
    cursor: pointer;
    transition: all 0.05s;
    border-color: black;
}
.answer-container.selected {
    background: #6D597A;
    color: white;
    border-color: #6D597A;
}
.answer-container:hover {
    background-color: #355070;
    color: #fff;
    border-color: #355070;
}
/* General checkbox styling */
.answer-checkbox {
    -webkit-appearance: none; /* Remove default checkbox styling */
    appearance: none;
    width: 20px;
    height: 20px;
    border: 1px solid #333; /* Blue border */
    border-radius: 4px; /* Slightly rounded corners */
    background: #fff; /* White background */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle; /* Aligns better with text */
    position: relative;
    transition: all 0.2s ease;
}
/* Checkbox tick styling */
.answer-checkbox:checked {
    border-color: #6D597A;
    background: #fff; /* Keep background white */
}
.answer-checkbox:checked::before {
    content: "✔"; /* Unicode tick symbol */
    font-size: 14px;
    color: #6D597A;
    position: absolute; /* Center the tick */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.answer-label {
    font-size: 14px;
    font-weight: 500;
    color: inherit; /* Use container's color for consistency */
    padding-left: 10px;
    padding-top: 2px;
}
/* Add this new class for answered questions */
.page-circle.visited {
    border-color: #355070;
    background: #ffffff;
    color: #355070;
}

/* For questions that are visited AND answered */
.page-circle.answered {
    background: #355070;
    color: #ffffff;
    border-color: #355070;
}

/* Active state (current question) - should override other states */
.page-circle.active {
    background: #ffffff !important;
    color: #355070 !important;
    border-color: #355070 !important;
    border-width: 2px !important;
}
/* Fix hover styles for active navigation circles */
.page-circle.active:hover {
    background: white !important;
    color: #355070 !important;
    border: 2px solid #355070 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 12px rgba(53, 80, 112, 0.3) !important;
}

/* Add these styles for radio circles */
.radio-circle {
    width: 16px;
    height: 16px;
    border: 1px solid black;
    border-radius: 50%;
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
    position: relative;
    background: white;
}

.btn.selected .radio-circle {
    border-color: #E56B6F;
    background: white;
}

.btn:hover .radio-circle {
    border-color: #B56576;
}

/* Style for the inner dot when selected */
.btn.selected .radio-circle::after {
    content: '';
    width: 7px;
    height: 7px;
    background: #E56B6F;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 0;
}

/* Add at the top of your file */
.auth-nav {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.auth-nav-btn {
    padding: 10px 24px;
    background: #E56B6F;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(229, 107, 111, 0.2);
}

.auth-nav-btn:hover {
    background: #B56576;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 107, 111, 0.3);
}

/* Style for the Results button (when it shows "Rezultatai") */
.nav-arrow.show-results {
    width: 100%;
    padding: 0 16px;  /* Smaller padding */
    height: 35px;  /* Smaller height */
    font-size: 0.9rem;  /* Smaller font */
    background: #ffffff;
    color: #355070;
    border: 2px solid #355070;
    box-sizing: border-box;
    margin: 0;
    align-self: stretch;
    text-align: center;
}

.nav-arrow.show-results:hover {
    background: #355070;
    color: #ffffff;
}

/* Formula button should be 100% width */
.formula-button {
    width: 100% !important;
    box-sizing: border-box;
    margin: 0;
    align-self: stretch;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-content h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.modal-btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.modal-btn.cancel {
    background: #f1f5f9;
    color: var(--text-primary);
    border: none;
}

.modal-btn.confirm {
    background: var(--primary);
    color: white;
    border: none;
}

.modal-btn:hover {
    transform: translateY(-2px);
}

.modal-btn.cancel:hover {
    background: #e2e8f0;
}

.modal-btn.confirm:hover {
    background: var(--primary-dark);
}

/* Timer styles */
.timer-container {
    position: sticky;
    top: 0;
    background: white;
    padding: 1rem;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    display: none; /* Hide old timer container */
}

/* Timer inside nav-bar */
.nav-bar .timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0.8rem 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

.nav-bar .timer span {
    font-size: 1.3rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Keep original timer styles for backward compatibility */
.timer {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.timer i {
    color: var(--primary);
}

.timer.warning {
    color: #e67e22;
}

.timer.danger {
    color: #e74c3c;
    animation: pulse 1s infinite;
}

/* Timer warning/danger states in nav-bar */
.nav-bar .timer.warning {
    color: #e67e22;
    background: #fff3cd;
}

.nav-bar .timer.danger {
    color: #e74c3c;
    background: #f8d7da;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.question-content {
    flex: 1;
    font-size: 18px;
    color: #333;
    font-weight: bold;
}

.points-indicator {
    background: var(--primary);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.points-indicator span {
    display: inline-block;
    vertical-align: middle;
}

.points-text {
    position: absolute;
    top: 0;
    right: 0;
    color: var(--primary);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Override for test history to avoid overlay */
.question-block .points-text {
    position: static;
    display: inline-block;
    margin-left: 10px;
    color: #666;
    font-size: 0.8em;
    font-weight: normal;
}

.question-dropdown {
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-header:hover {
    background: #f1f5f9;
}

.dropdown-header.open {
    border-bottom: 1px solid #e2e8f0;
}

.header-content {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.question-number {
    font-weight: 600;
    color: var(--text-primary);
}

.question-score {
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.question-score.correct {
    background: #dcfce7;
    color: #166534;
}

.question-score.partial {
    background: #fef3c7;
    color: #92400e;
}

.question-score.incorrect {
    background: #fee2e2;
    color: #991b1b;
}

.dropdown-content {
    padding: 1rem;
    background: white;
}

.dropdown-content .user-answer,
.dropdown-content .correct-answer {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.dropdown-content .answer-option,
.dropdown-content .answer-container {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.answer-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.total-score {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.user-answer, .correct-answer {
    margin: 0.5rem 0;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.points-feedback {
    margin-top: 0.5rem;
    font-weight: 500;
}

.correct-feedback, .incorrect-feedback {
    display: inline-block;
    margin-left: 0.5rem;
}

.correct-feedback {
    color: #16a34a;
}

.incorrect-feedback {
    color: #dc2626;
}

.back-btn {
    padding: 14px 20px !important; /* Reduce horizontal padding */
    font-size: 14px;
    background: #355070;
    color: #ffffff;
    border: 2px solid #355070;  /* Single border property */
    border-radius: 6px;
    cursor: pointer;
    margin-left: 0;
    transition: all 0.3s ease;
    font-weight: 600;
}

.back-btn:hover {
    background: #2a3f58;
    border-color: #2a3f58;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(53, 80, 112, 0.25);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.bottom-back-btn {
    display: block;
    padding: 14px 20px !important; /* Reduce horizontal padding */
    margin: 1rem auto;  /* Consistent spacing between buttons */
}

/* Add specific margin for first button */
#answer-buttons > .bottom-back-btn:first-of-type {
    margin-top: 2rem;
}

.score-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 2rem auto;
    max-width: 800px;
    padding: 0 1rem; /* Add padding for mobile */
}

.score-btn {
    width: 100% !important;
    padding: 14px 20px !important; /* Reduce horizontal padding */
    text-align: center;
    margin: 0;
    font-size: 1rem;
}

/* Update the score div styling to center it */
#answer-buttons > div > h3 {
    text-align: center;
    margin-bottom: 2rem;
}

.user-name {
    position: absolute;
    left: 20px;
    font-size: 16px;
    color: white;
    font-weight: normal;
}

.header {
    position: relative;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-welcome {
    text-align: center;
    font-size: 1.5rem;
    color: #6D597A;
    margin: 0.5rem 0;
    padding: 0.2rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.user-welcome.visible {
    opacity: 1;
    transform: translateY(0);
}

.user-welcome #userName {
    color: #B56576;
    font-weight: 600;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-text {
    color: #6D597A;
    font-size: 18px;
    font-weight: 500;
    margin-top: 40px;
}

/* Pencil animation - From Uiverse.io by AnnaVAnTiM */
.pencil {
    display: block;
    width: 10em;
    height: 10em;
    color: #6D597A;
}

.pencil__body1,
.pencil__body2,
.pencil__body3,
.pencil__eraser,
.pencil__eraser-skew,
.pencil__point,
.pencil__rotate,
.pencil__stroke {
    animation-duration: 3s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.pencil__body1,
.pencil__body2,
.pencil__body3 {
    transform: rotate(-90deg);
}

.pencil__body1 {
    animation-name: pencilBody1;
}

.pencil__body2 {
    animation-name: pencilBody2;
}

.pencil__body3 {
    animation-name: pencilBody3;
}

.pencil__eraser {
    animation-name: pencilEraser;
    transform: rotate(-90deg) translate(49px, 0);
}

.pencil__eraser-skew {
    animation-name: pencilEraserSkew;
    animation-timing-function: ease-in-out;
}

.pencil__point {
    animation-name: pencilPoint;
    transform: rotate(-90deg) translate(49px, -30px);
}

.pencil__rotate {
    animation-name: pencilRotate;
}

.pencil__stroke {
    animation-name: pencilStroke;
    transform: translate(100px, 100px) rotate(-113deg);
}

/* Animations */
@keyframes pencilBody1 {
    from,
    to {
        stroke-dashoffset: 351.86;
        transform: rotate(-90deg);
    }
    50% {
        stroke-dashoffset: 150.8;
        transform: rotate(-225deg);
    }
}

@keyframes pencilBody2 {
    from,
    to {
        stroke-dashoffset: 406.84;
        transform: rotate(-90deg);
    }
    50% {
        stroke-dashoffset: 174.36;
        transform: rotate(-225deg);
    }
}

@keyframes pencilBody3 {
    from,
    to {
        stroke-dashoffset: 296.88;
        transform: rotate(-90deg);
    }
    50% {
        stroke-dashoffset: 127.23;
        transform: rotate(-225deg);
    }
}

@keyframes pencilEraser {
    from,
    to {
        transform: rotate(-45deg) translate(49px, 0);
    }
    50% {
        transform: rotate(0deg) translate(49px, 0);
    }
}

@keyframes pencilEraserSkew {
    from,
    32.5%,
    67.5%,
    to {
        transform: skewX(0);
    }
    35%,
    65% {
        transform: skewX(-4deg);
    }
    37.5%,
    62.5% {
        transform: skewX(8deg);
    }
    40%,
    45%,
    50%,
    55%,
    60% {
        transform: skewX(-15deg);
    }
    42.5%,
    47.5%,
    52.5%,
    57.5% {
        transform: skewX(15deg);
    }
}

@keyframes pencilPoint {
    from,
    to {
        transform: rotate(-90deg) translate(49px, -30px);
    }
    50% {
        transform: rotate(-225deg) translate(49px, -30px);
    }
}

@keyframes pencilRotate {
    from {
        transform: translate(100px, 100px) rotate(0);
    }
    to {
        transform: translate(100px, 100px) rotate(720deg);
    }
}

@keyframes pencilStroke {
    from {
        stroke-dashoffset: 439.82;
        transform: translate(100px, 100px) rotate(-113deg);
    }
    50% {
        stroke-dashoffset: 164.93;
        transform: translate(100px, 100px) rotate(-113deg);
    }
    75%,
    to {
        stroke-dashoffset: 439.82;
        transform: translate(100px, 100px) rotate(112deg);
    }
}

/* Add styles for the access time display */
.access-time {
    text-align: center;
    padding: 10px;
    margin: 5px 0;
    background-color: #f8f9fa;
    border-radius: 5px;
    font-size: 1.1em;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.access-time.visible {
    opacity: 1;
}

.access-time.warning {
    background-color: #fff3cd;
    color: #856404;
}

.access-time.danger {
    background-color: #f8d7da;
    color: #721c24;
}

.access-time.subscription-active {
    background-color: #d4edda;
    color: #155724;
    font-weight: 600;
}

/* Mobile responsive styles */
@media screen and (max-width: 768px) {
    .score-buttons {
        padding: 0 15px;
        margin: 1.5rem auto;
    }

    .score-btn, 
    .bottom-back-btn {
        width: 100% !important;
        padding: 20px 15px 16px 15px !important;
        font-size: 1rem;
        height: auto;
        white-space: normal; /* Allow text to wrap */
        line-height: 1.3;
    }

    .back-btn {
        padding-top: 20px !important;
    }

    /* Increase touch target size */
    .nav-arrow {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    /* Adjust navigation bar for mobile */
    .nav-bar {
        padding: 0.8rem;
    }

    .page-numbers {
        gap: 6px;
        margin: 0 0.8rem;
    }

    .page-circle {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    /* Show results button specific styling */
    .nav-arrow.show-results {
        width: auto;
        padding: 0 15px;
        height: 44px;
        font-size: 1rem;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    .score-buttons {
        padding: 0 10px;
        margin: 1rem auto;
    }

    .score-btn, 
    .bottom-back-btn {
        padding: 14px 12px !important;
        font-size: 0.95rem;
    }

    .nav-arrow.show-results {
        padding: 0 12px;
        height: 40px;
        font-size: 0.95rem;
    }

    /* Make navigation more compact */
    .nav-bar {
        padding: 0.6rem 0.6rem 1rem 0.6rem;
    }

    .page-numbers {
        gap: 4px;
        margin: 0 0.6rem;
    }

    .page-circle {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }

    .nav-arrow {
        width: 40px;
        height: 40px;
    }
}

/* Updated sorting options styles */
.sorting-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin: 30px auto;
    max-width: 1200px;
    padding: 0 20px;
    text-align: center;
}

.sort-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 600px;
}

.sort-group label {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
    margin-bottom: 5px;
}

.sort-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sort-btn {
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 30px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.sort-btn:hover {
    transform: translateY(-2px);
    border-color: #6D597A;
}

.sort-btn.active {
    background-color: #6D597A;
    color: white;
    border-color: #6D597A;
    box-shadow: 0 4px 10px rgba(109, 89, 122, 0.3);
}

@media (max-width: 768px) {
    .sorting-options {
        gap: 15px;
    }
    
    .sort-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

/* Styles for the sorting loader */
.sorting-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.sorting-loader p {
    margin-top: 25px;
    color: #666;
    font-size: 0.9rem;
}

/* Hide tests container while loading */
.tests-container.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Add styles for the image answer grid */
.image-answer-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Two columns */
    gap: 10px;
    width: 100%;
    margin-bottom: 15px;
}

/* Style for buttons containing images */
.image-answer-container .btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
}

/* Make the radio circle position consistent */
.image-answer-container .radio-circle {
    align-self: flex-start;
}

/* Responsive adjustments */
@media screen and (max-width: 480px) {
    .image-answer-container {
        grid-template-columns: 1fr; /* Single column on very small screens */
    }
}

/* AI Evaluation Styles */
.ai-evaluation {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.ai-evaluation h4 {
    color: #495057;
    margin: 0 0 15px 0;
    font-size: 1.1em;
    font-weight: 600;
}

.ai-evaluation details {
    margin-top: 15px;
}

.ai-evaluation summary {
    cursor: pointer;
    color: #E56B6F;
    font-weight: 600;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.ai-evaluation summary:hover {
    color: #B56576;
}

.ai-evaluation details > div {
    margin-top: 10px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    line-height: 1.6;
}

/* Solution display styles */
.user-solution {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.solution-latex {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    margin-top: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

/* Points feedback for input-solution questions */
.points-feedback {
    margin-top: 15px;
    font-weight: 600;
    font-size: 1.1em;
}

.points-feedback.correct {
    color: #28a745;
}

.points-feedback.incorrect {
    color: #dc3545;
}

/* Enhanced formula buttons for input-solution */
.formula-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.formula-btn {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 35px;
    text-align: center;
}

.formula-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.formula-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* MathQuill input styling */
.mathquill-input {
    font-family: 'Times New Roman', serif;
    font-size: 16px;
    line-height: 1.5;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .ai-evaluation {
        padding: 15px;
        margin: 15px 0;
    }
    
    .formula-buttons-container {
        padding: 10px;
        gap: 6px;
    }
    
    .formula-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 30px;
    }
    
    .solution-latex {
        font-size: 14px;
        padding: 8px;
    }
}