@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
    --primary-bg: #f4f7f6;
    --container-bg: #ffffff;
    --text-color: #333;
    
    /* Original colors being kept for specific functions */
    --dont-know-color: #ffc107;
    --dont-know-hover: #e0a800;
    --next-color: #28a745; /* For green 'correct' status indicators */
    
    --border-color: #dee2e6;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);

    /* New Purple Palette for general UI */
    --dpt-purple-primary: #7B1FA2;
    --dpt-purple-hover: #6A1B9A;
    
    --dpt-purple-selected-option-bg: #D1C4E9; 
    --dpt-purple-selected-option-text: var(--dpt-purple-primary);

    /* Update original theme colors to use new purples for general UI */
    --primary-color: var(--dpt-purple-primary);
    --primary-hover: var(--dpt-purple-hover);
    
    /* Default --level-color (used by .level-indicator base if no specific class matches) can be a neutral or one of the original theme's level colors if preferred as a fallback.
       For now, let's make it a fairly neutral color from the original theme, as specific levels will override it.
    */
    --level-color: #17a2b8; /* Original teal, will be overridden by specific level styles below */

    /* Original Level Colors to be restored */
    --dpt-level-a1-text: #38761d;
    --dpt-level-a1-bg: #d9ead3;
    --dpt-level-a2-text: #274e13;
    --dpt-level-a2-bg: #c9dfc1;
    --dpt-level-b1-text: #b45f06;
    --dpt-level-b1-bg: #fce5cd;
    --dpt-level-b2-text: #a64d00;
    --dpt-level-b2-bg: #f9d5b4;
    --dpt-level-c1-text: #990000;
    --dpt-level-c1-bg: #f4cccc;
    --dpt-level-c2-text: #660000;
    --dpt-level-c2-bg: #ea9999;
    --dpt-level-pre-a1-text: #4a4a4a;
    --dpt-level-pre-a1-bg: #e0e0e0;
}

#dpt-placement-test-root { 
    font-family: 'Roboto', sans-serif;
    color: var(--text-color);
    box-sizing: border-box;
    width: 100%;
}

#dpt-placement-test-root .test-container {
    background-color: var(--container-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem 2.5rem;
    text-align: center;
    width: 100%; 
    max-width: 750px; 
    margin-left: auto; 
    margin-right: auto;
    box-sizing: border-box; 
}

#dpt-placement-test-root .test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Base style for level indicators - will be overridden by specific levels */
#dpt-placement-test-root .level-indicator {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
    color: var(--level-color); /* Fallback color */
    background-color: #e8f7fa; /* Fallback background */
}

/* --- Restored Original Level Colors --- */
#dpt-placement-test-root .level-indicator.level-a1 {
    color: var(--dpt-level-a1-text); 
    background-color: var(--dpt-level-a1-bg); 
}
#dpt-placement-test-root .level-indicator.level-a2 {
    color: var(--dpt-level-a2-text); 
    background-color: var(--dpt-level-a2-bg);
}
#dpt-placement-test-root .level-indicator.level-b1 {
    color: var(--dpt-level-b1-text); 
    background-color: var(--dpt-level-b1-bg);
}
#dpt-placement-test-root .level-indicator.level-b2 {
    color: var(--dpt-level-b2-text); 
    background-color: var(--dpt-level-b2-bg);
}
#dpt-placement-test-root .level-indicator.level-c1 {
    color: var(--dpt-level-c1-text); 
    background-color: var(--dpt-level-c1-bg);
}
#dpt-placement-test-root .level-indicator.level-c2 { 
    color: var(--dpt-level-c2-text); 
    background-color: var(--dpt-level-c2-bg);
}
#dpt-placement-test-root .level-indicator.level-pre-a1 {
    color: var(--dpt-level-pre-a1-text); 
    background-color: var(--dpt-level-pre-a1-bg);
}

#dpt-placement-test-root .progress-text {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

#dpt-placement-test-root .question-content-wrapper {
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}
#dpt-placement-test-root .question-content-wrapper.fade-out {
    opacity: 0;
    transform: translateY(-15px);
}

#dpt-placement-test-root .question-text {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 2rem;
    min-height: 60px;
    line-height: 1.5;
}

#dpt-placement-test-root .blank-line {
    display: inline-block;
    width: 3em; 
    height: 2px; 
    background-color: var(--dpt-purple-primary); 
    vertical-align: bottom; 
    margin-bottom: 0.1em; 
    border-radius: 1px; 
}

#dpt-placement-test-root .options-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 0.75rem; 
    margin-bottom: 2rem;
}

#dpt-placement-test-root .options-container.options-count-3 {
    grid-template-columns: repeat(3, 1fr); 
}
#dpt-placement-test-root .options-container.options-count-2 {
    grid-template-columns: repeat(2, 1fr);
}
#dpt-placement-test-root .options-container.options-count-1 {
    grid-template-columns: 1fr;
}

#dpt-placement-test-root .option-btn {
    background-color: transparent;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-color);
    font-weight: 500;
}

#dpt-placement-test-root .option-btn:hover {
    border-color: var(--dpt-purple-primary);
    background-color: #F3E5F5; /* Lightest purple for hover fill, can use --dpt-purple-level-bg if preferred */
}

#dpt-placement-test-root .option-btn.selected {
    background-color: var(--dpt-purple-selected-option-bg);
    color: var(--dpt-purple-selected-option-text);
    border-color: var(--dpt-purple-primary);
}

#dpt-placement-test-root .action-buttons-container {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: stretch; 
    gap: 1rem; 
}

#dpt-placement-test-root .dont-know-btn,
#dpt-placement-test-root .next-btn {
    padding-top: 0.8rem; 
    padding-bottom: 0.8rem; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    line-height: 1.2; 
    min-height: 45px; 
    box-sizing: border-box;
}

#dpt-placement-test-root .dont-know-btn {
    background-color: var(--dont-know-color);
    color: var(--text-color);
    border: none;
    flex-grow: 0;
}
#dpt-placement-test-root .dont-know-btn:hover {
    background-color: var(--dont-know-hover);
}
#dpt-placement-test-root .dont-know-btn.selected {
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.5);
    background-color: var(--dont-know-hover);
}

#dpt-placement-test-root .next-btn {
    background-color: var(--dpt-purple-primary); 
    color: white;
    border: none;
    padding: 0.8rem 2.5rem;
    flex-grow: 0;
}
#dpt-placement-test-root .next-btn:hover {
    background-color: var(--dpt-purple-hover); 
}
#dpt-placement-test-root .next-btn:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
}

/* Styles for Name Entry Screen */
#dpt-placement-test-root .name-entry-container h2 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}
#dpt-placement-test-root .name-entry-container p {
    margin-bottom: 1.5rem;
    font-size: 1rem;
}
#dpt-placement-test-root .student-name-input {
    max-width: 300px; 
    display: block; 
    margin-left: auto;
    margin-right: auto;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    text-align: center; 
    font-weight: bold; 
}
#dpt-placement-test-root .student-name-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(123,31,162,.25); 
}
#dpt-placement-test-root .start-test-btn { 
    margin-left: auto;
    margin-right: auto;
    display: block; 
    width: -moz-fit-content; 
    width: fit-content;   
}


/* Styles for Email Analysis Section on Results Screen */
#dpt-placement-test-root .results-container hr {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    border: 0;
    border-top: 1px solid var(--border-color);
}
#dpt-placement-test-root .teacher-message {
    font-style: italic;
    color: #555;
    margin-top: 1rem;
}
#dpt-placement-test-root .email-analysis-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}
#dpt-placement-test-root .email-analysis-section p {
    margin-bottom: 1rem;
    font-size: 1rem;
}
#dpt-placement-test-root .student-email-input {
    width: 100%;
    max-width: 450px; 
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    display: block; 
    margin-left: auto;
    margin-right: auto;
    text-align: center; 
    font-weight: bold; 
}
#dpt-placement-test-root .student-email-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(123,31,162,.25); 
}
#dpt-placement-test-root .email-analysis-btn {
    background-color: var(--dpt-purple-primary); 
    color: white;
    border: none;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}
#dpt-placement-test-root .email-analysis-btn:hover {
    background-color: var(--dpt-purple-hover); 
}
#dpt-placement-test-root .email-analysis-btn:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
}
#dpt-placement-test-root .email-analysis-section .error-message {
    color: #dc3545; 
    font-size: 0.9rem;
    margin-top: 0.5rem;
}


/* Responsive adjustments for smaller screens */
@media (max-width: 600px) {
    #dpt-placement-test-root .options-container,
    #dpt-placement-test-root .options-container.options-count-1,
    #dpt-placement-test-root .options-container.options-count-2,
    #dpt-placement-test-root .options-container.options-count-3,
    #dpt-placement-test-root .options-container.options-count-4 {
        grid-template-columns: 1fr !important; 
        gap: 0.5rem;
    }
    #dpt-placement-test-root .action-buttons-container {
        flex-direction: column; 
        align-items: stretch; 
    }
    #dpt-placement-test-root .dont-know-btn,
    #dpt-placement-test-root .next-btn {
        width: 100%; 
        margin-bottom: 0.5rem; 
    }
    #dpt-placement-test-root .dont-know-btn:last-child,
    #dpt-placement-test-root .next-btn:last-child {
        margin-bottom: 0;
    }
     #dpt-placement-test-root .dont-know-btn {
        font-size: 0.9rem; 
    }
    #dpt-placement-test-root .student-email-input {
        max-width: 100%; 
    }
}

@media (max-width: 400px) {
    #dpt-placement-test-root .dont-know-btn {
        font-size: 0.8rem; 
    }
    #dpt-placement-test-root .test-container {
        padding: 1.5rem 1rem; 
    }
    #dpt-placement-test-root .question-text {
        font-size: 1.2rem;
    }
}


#dpt-placement-test-root .results-container h1 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

#dpt-placement-test-root .results-container p {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

#dpt-placement-test-root .final-level {
    font-size: 3rem;
    font-weight: 700;
    color: var(--dpt-purple-primary); 
    padding: 1rem;
    background-color: var(--dpt-purple-level-bg); 
    border-radius: 8px;
}

/* Styles for [dpt_view_test_results] Shortcode */
#dpt-results-view-container {
    font-family: 'Roboto', sans-serif;
    color: var(--text-color);
    background-color: var(--primary-bg);
    padding: 15px; /* Updated padding */
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 2rem auto;
    border: 1px solid #ccc; /* Added border */
}

/* New Styles for Results Header */
.dpt-results-header {
    text-align: center; /* Center all content within the header */
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    /* flex-wrap: wrap; /* No longer flex, so not needed */
}

.dpt-results-student-info {
    /* flex-grow: 1; /* No longer flex item */
    text-align: center; /* Keep text centered */
    /* padding-right: 1rem; /* Not needed as it's full width now */
    margin-bottom: 0.75rem; /* Space before the level */
}

.dpt-results-student-info h2 {
    color: var(--dpt-purple-primary); 
    font-size: 2.2rem; /* Larger name */
    margin-top: 0;
    margin-bottom: 0.25rem;
    line-height: 1.2; /* Adjust line height for potentially long names */
}

.dpt-results-date {
    font-size: 1rem; /* Larger date */
    color: #555;
    margin-top: 0.25rem; /* Add space above the date */
    margin-bottom: 0; /* Remove bottom margin, student-info block has it */
}

.dpt-results-score {
    /* flex-basis: auto; REMOVE */
    /* flex-grow: 0; REMOVE */
    /* flex-shrink: 0; REMOVE */
    text-align: center; /* Center the score pill */
    /* padding-left: 1rem; REMOVE */
    /* display: flex; REMOVE */
    /* flex-direction: column; REMOVE */
    /* align-items: flex-end; REMOVE */
    margin-top: 0.5rem; /* Space above the score pill */
}

.dpt-final-score-label { /* This class is no longer output by PHP, but keeping style for safety */
    display: block;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.25rem;
}

.dpt-final-score-value {
    display: inline-block; /* Changed to inline-block for padding and shaping */
    font-size: 1.8rem; /* Slightly reduced for better fit in pill */
    font-weight: 700;
    color: #ffffff; /* White text on purple background */
    background-color: var(--dpt-purple-primary); /* Purple background */
    padding: 0.5rem 1.25rem; /* Adjust padding to create pill shape */
    border-radius: 50px; /* Large radius for pill shape */
    line-height: 1; /* Ensure text is centered vertically */
    min-width: 60px; /* Ensure even small levels like A1 look good */
    text-align: center;
}

/* Responsive adjustments for the new header */
@media (max-width: 600px) {
    .dpt-results-header {
        flex-direction: column; /* Stack elements vertically */
        align-items: center; /* Center items horizontally */
        text-align: center; /* Ensure text within is centered */
    }
    .dpt-results-student-info {
        width: 100%; /* Allow full width for centering */
        text-align: center; /* Center text */
        padding-right: 0; /* Remove padding that might affect centering */
        margin-bottom: 0.5rem; /* Space between student info and score */
    }
    .dpt-results-score {
        width: auto; /* Allow pill to size naturally */
        text-align: center; /* Ensure pill itself is centered if it's inline-block */
        margin-top: 0.5rem; /* Consistent margin */
    }
    .dpt-results-student-info h2 {
        font-size: 1.6rem; /* Keep name size adjustment */
        margin-bottom: 0.1rem; /* Reduce space between name and date */
    }
    /* .dpt-results-date will be below name, aligned left by .dpt-results-student-info's text-align */
    
    .dpt-final-score-value {
        font-size: 1.6rem; /* Adjust for mobile */
        padding: 0.4rem 1rem;
    }
}


/* Original styles for #dpt-results-view-container h2 and p are now handled by the new specific classes or are default */
#dpt-results-view-container > p { /* This was for the old date paragraph, now handled by .dpt-results-date */
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #555;
}

.dpt-results-filter {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.dpt-results-filter label {
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
}

.dpt-results-filter input[type="radio"] {
    margin-right: 0.3rem;
    vertical-align: middle;
    accent-color: var(--dpt-purple-primary); 
}
.dpt-results-filter label:hover {
    background-color: #e9ecef;
}
.dpt-results-filter input[type="radio"]:checked + label {
    color: var(--dpt-purple-primary);
    font-weight: bold;
}

.dpt-results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dpt-result-item {
    background-color: var(--container-bg);
    border-radius: 8px;
    padding: 1rem;
    padding-left: 1.5rem; 
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    display: flex; 
    position: relative; 
    align-items: flex-start; 
    text-align: left;
    margin-bottom: 1rem; /* Add space between question items */
}

.dpt-result-indicator {
    width: 5px; 
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.dpt-result-item[data-status="correct"] .dpt-result-indicator {
    background-color: var(--next-color); 
}
.dpt-result-item[data-status="incorrect"] .dpt-result-indicator {
    background-color: #dc3545; 
}
.dpt-result-item[data-status="dont-know"] .dpt-result-indicator {
    background-color: var(--dont-know-color); 
}

.dpt-result-main-block { /* Replaces .dpt-result-content. This is the main flex row. */
    display: flex;
    flex-direction: row;
    align-items: flex-start; /* Align items to the top of their respective columns */
    gap: 20px; /* Space between left and right columns */
    width: 100%;
}

.dpt-left-column {
    flex: 2; /* Adjust ratio as needed, e.g., 60-70% for this column */
    display: flex;
    flex-direction: column;
    gap: 10px; /* Space between question text and explanation box */
    min-width: 0; /* Allow shrinking */
}

.dpt-result-question-details {
    width: 100%; /* Question details take full width of the left column */
}

.dpt-result-question-text {
    font-size: 0.95rem;
    line-height: 1.4;
    margin: 0;
}
.dpt-result-question-text strong {
    color: var(--primary-color);
}

.dpt-result-options {
    /* flex: 1; Removed, as it's now part of a column flow or a flex item in feedback container */
    /* min-width: 200px; Removed */
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.9rem;
}

.dpt-result-option {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
}

.dpt-result-option.selected-option {
    background-color: var(--dpt-purple-selected-option-bg); 
    color: var(--dpt-purple-selected-option-text);
    font-weight: bold;
    border-color: var(--dpt-purple-primary);
}

.dpt-result-option.correct-answer-option {
    color: var(--next-color); 
}
.dpt-result-option.selected-option.correct-answer-option {
    background-color: #d1e7dd; 
    border-color: var(--next-color);
    color: #0a3622;
}


.dpt-result-option.correct-answer-text { 
    margin-top: 0.3rem;
    font-style: italic;
    color: var(--next-color);
    background-color: transparent;
    border: none;
    padding-left: 0;
}

.dpt-error {
    color: #dc3545;
    text-align: center;
    padding: 1rem;
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    border-radius: 4px;
}

/* Responsive for results view */
@media (max-width: 768px) {
    .dpt-result-main-block {
        flex-direction: column; /* Stack left and right columns */
    }
    .dpt-left-column,
    .dpt-result-main-block > .dpt-result-options { /* Target options as direct child of main-block */
        flex-basis: auto; /* Reset flex basis */
        width: 100%;      /* Make them full width when stacked */
        flex: none;       /* Remove flex grow/shrink properties */
    }
    .dpt-result-question-details {
         min-width: 0; /* Ensure it doesn't overflow when stacked */
    }
    .dpt-result-main-block > .dpt-result-options {
        margin-top: 1rem; /* Add some space when options stack below left column */
    }
}

/* Styles for Level Headings in Results View - Reverted to original multi-color */
.dpt-level-heading {
    font-size: 1.1rem; 
    font-weight: 700; 
    padding: 0.3rem 0.8rem; 
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-radius: 20px; 
    display: inline-block; 
    transition: background-color 0.3s ease, color 0.3s ease; 
}

#dpt-results-view-container .dpt-level-heading.level-a1 {
    color: var(--dpt-level-a1-text); 
    background-color: var(--dpt-level-a1-bg); 
}
#dpt-results-view-container .dpt-level-heading.level-a2 {
    color: var(--dpt-level-a2-text); 
    background-color: var(--dpt-level-a2-bg);
}
#dpt-results-view-container .dpt-level-heading.level-b1 {
    color: var(--dpt-level-b1-text); 
    background-color: var(--dpt-level-b1-bg);
}
#dpt-results-view-container .dpt-level-heading.level-b2 {
    color: var(--dpt-level-b2-text); 
    background-color: var(--dpt-level-b2-bg);
}
#dpt-results-view-container .dpt-level-heading.level-c1 {
    color: var(--dpt-level-c1-text); 
    background-color: var(--dpt-level-c1-bg);
}
#dpt-results-view-container .dpt-level-heading.level-c2 { 
    color: var(--dpt-level-c2-text); 
    background-color: var(--dpt-level-c2-bg);
}
#dpt-results-view-container .dpt-level-heading.level-pre-a1 {
    color: var(--dpt-level-pre-a1-text); 
    background-color: var(--dpt-level-pre-a1-bg);
}

.dpt-level-heading {
    cursor: pointer; /* Indicate it's clickable */
    user-select: none; /* Prevent text selection on click */
}

.dpt-level-toggle-icon {
    display: inline-block;
    margin-left: 0.5em; /* Changed from margin-right */
    transition: transform 0.2s ease-in-out;
    transform: rotate(-90deg); /* Default: collapsed, pointing right */
}

.dpt-level-heading.expanded .dpt-level-toggle-icon {
    transform: rotate(0deg); /* Expanded: pointing down */
}

.dpt-level-question-group {
    /* Styles for the question group, e.g., padding, margin if needed */
    /* display: none; is set inline in PHP for default collapsed state */
    padding-left: 1.5rem; /* Indent questions under the heading */
    margin-top: 0.5rem; /* Space below heading */
    overflow: hidden; /* For smooth transition if using height animation (not used here) */
}


#dpt-placement-test-root .view-results-btn {
    margin-top: 1rem;
    display: inline-block;
    background-color: var(--dpt-purple-primary); 
    color: white !important;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
    font-weight: 500;
}

#dpt-placement-test-root .view-results-btn:hover {
    background-color: var(--dpt-purple-hover); 
}

/* Styles for Teacher Dashboard Shortcode [dpt_teacher_dashboard] */
.dpt-teacher-dashboard {
    font-family: 'Roboto', sans-serif;
    color: var(--text-color);
    background-color: var(--primary-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 2rem auto;
}

.dpt-teacher-dashboard h3 {
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}
.dpt-teacher-dashboard h3:first-of-type {
    margin-top: 0;
}

.dpt-teacher-dashboard p {
    margin-bottom: 0.5rem;
}

.dpt-teacher-link-area {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.dpt-teacher-link-area input[type="text"] {
    flex-grow: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    background-color: #fff; 
}

.dpt-button, 
#dpt_copy_teacher_link_button,
.dpt-view-results-btn { 
    background-color: var(--primary-color);
    color: white !important; 
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none; 
    display: inline-block; 
    transition: background-color 0.2s ease;
    text-align: center;
}

.dpt-button:hover,
#dpt_copy_teacher_link_button:hover,
.dpt-view-results-btn:hover {
    background-color: var(--primary-hover);
}

.dpt-teacher-submissions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.dpt-teacher-submissions-table th,
.dpt-teacher-submissions-table td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
    vertical-align: middle;
}

.dpt-teacher-submissions-table th {
    background-color: #e9ecef;
    font-weight: 700;
    color: var(--text-color);
}

.dpt-teacher-submissions-table tbody tr:nth-child(even) {
    background-color: var(--container-bg);
}
.dpt-teacher-submissions-table tbody tr:hover {
    background-color: #f1f3f5;
}

.dpt-teacher-submissions-table .dpt-view-results-btn {
    padding: 0.4rem 0.8rem; 
    font-size: 0.85rem;
    text-decoration: none !important;
    display: inline-block; 
}

.dpt-teacher-submissions-table td:last-child { 
    text-align: center; 
}

/* Color coding for levels in teacher dashboard table - Reverted to original theme colors */
.dpt-teacher-submissions-table .dpt-level-cell {
    font-weight: bold;
}
.dpt-teacher-submissions-table .level-a1-text-color { /* Renamed for clarity if needed, or map to original colors */
    color: var(--dpt-level-a1-text); /* This now points to original green */
}
.dpt-teacher-submissions-table .level-a2-text-color {
    color: var(--dpt-level-a2-text);
}
.dpt-teacher-submissions-table .level-b1-text-color {
    color: var(--dpt-level-b1-text);
}
.dpt-teacher-submissions-table .level-b2-text-color {
    color: var(--dpt-level-b2-text);
}
.dpt-teacher-submissions-table .level-c1-text-color {
    color: var(--dpt-level-c1-text);
}
.dpt-teacher-submissions-table .level-c2-text-color {
    color: var(--dpt-level-c2-text);
}
.dpt-teacher-submissions-table .level-pre-a1-text-color {
    color: var(--dpt-level-pre-a1-text);
}


#dpt_copy_link_feedback {
    color: var(--dpt-purple-primary); 
    font-size: 0.9rem;
}

/* Responsive for Teacher Dashboard */
@media (max-width: 600px) {
    .dpt-teacher-link-area {
        flex-direction: column;
        align-items: stretch;
    }
    .dpt-teacher-link-area input[type="text"] {
        width: 100%;
        margin-bottom: 10px; 
    }
    #dpt_copy_teacher_link_button {
        width: 100%;
    }
    .dpt-teacher-submissions-table th,
    .dpt-teacher-submissions-table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    .dpt-teacher-submissions-table .dpt-view-results-btn {
        width: 100%;
        display: block; 
    }
}

/* Transition styles for test to results screen */
#dpt-placement-test-root .test-container.test-fade-out {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

#dpt-placement-test-root .results-container.results-fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInFromBottom 0.4s ease-out forwards;
    animation-delay: 0.1s; 
}

@keyframes fadeInFromBottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
    transform: translateY(0);
    }
}

/* Styles for Saving Results Loader */
#dpt-placement-test-root .saving-results-section {
    padding: 2rem 0;
    text-align: center;
}

#dpt-placement-test-root .dpt-loading-spinner {
    border: 4px solid #f3f3f3; /* Light grey */
    border-top: 4px solid var(--dpt-purple-primary); /* Purple */
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto; /* Center it and add margin below */
}

#dpt-placement-test-root .saving-results-section p {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Chart Styles */
.dpt-charts-container {
    display: grid;
    grid-template-columns: 1fr; /* Default to single column for mobile-first */
    gap: 1.5rem; /* 24px */
    margin: 2rem 0; /* 32px */
    align-items: flex-start; /* Align items to the start for varying heights */
}

.dpt-chart-wrapper {
    background-color: #f8f9fa;
    padding: 1.25rem; /* 20px */
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    /* overflow: hidden; Prevent content from breaking out, might affect tooltips if too restrictive */
}

.dpt-charts-container > .dpt-chart-wrapper:nth-child(2) {
    /* Attempt to constrain the bar chart wrapper if it's getting too wide */
    /* max-width: 600px; /* Example: Adjust as needed */
    /* Or, if it should take a certain proportion but not exceed a limit */
    /* width: 100%; /* Ensure it tries to fill its grid area */
    /* max-width: calc(1.5 * (100% / 2.5)); /* If 1fr 1.5fr, this is 1.5/2.5 = 60% of parent */
    /* This is complex, let's try a simpler max-width first if needed, or rely on parent constraints.
       For now, let's assume the grid handles proportions and the issue is overall container width.
       If the .test-container's max-width: 750px is respected, this might not be needed.
       If the problem is specific to the bar chart being too wide *within* its allocated grid space,
       then a max-width here could help.
    */
}

.dpt-chart-wrapper h3,
.dpt-chart-wrapper h3.dpt-chart-title-view { /* Ensure titles in view results also get styled */
    text-align: center;
    margin-bottom: 1rem; /* 16px */
    color: #495057;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Styles for the canvas container inside chart components */
.dpt-chart-container {
    position: relative;
    width: 100%;
    /* height will be set inline in the component for responsiveness, e.g., height: 300px for pie, 400px for bar */
}

.dpt-chart-container canvas {
    max-width: 100%; /* Ensure canvas does not overflow its container */
}


@media (min-width: 768px) {
    .dpt-charts-container {
        grid-template-columns: 1fr 1.5fr; /* Pie chart smaller, bar chart larger */
        gap: 2rem; /* 32px */
    }
}

@media (min-width: 992px) {
    .dpt-charts-container {
        grid-template-columns: 1fr 2fr; /* Even more space for bar chart on larger screens */
    }
}

/* Styles for Explanation Box and Topic Link */
/* .dpt-feedback-and-options-container styles are removed as the class is no longer used. */

.dpt-explanation-box {
    background-color: #e0f2f7; /* Light blue */
    padding: 15px;
    border: 1px solid #b0dff2;
    border-radius: 5px;
    font-size: 0.9em;
    line-height: 1.5;
    margin-top: 10px; /* Space below the question text, within the left column */
    width: 100%; /* Takes full width of its parent (.dpt-left-column) */
    box-sizing: border-box;
}

/* Styles for .dpt-result-options when it's the right column */
.dpt-result-main-block > .dpt-result-options {
    flex: 1; /* Adjust ratio as needed, e.g., 30-40% for this column */
    min-width: 0; /* Allow shrinking */
    /* align-self: flex-start; /* Ensures it aligns to the top with the question text */
}

.dpt-topic-link-button {
    display: inline-block;
    background-color: #6a0dad; /* Purple */
    color: white !important; /* Ensure text is white */
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85em;
    margin-top: 10px; /* Space from explanation text */
    transition: background-color 0.3s ease;
}
.dpt-topic-link-button:hover,
.dpt-topic-link-button:focus {
    background-color: #50077e; /* Darker purple */
    color: white !important;
    text-decoration: none;
}

/* Responsive Adjustments for Explanation and Options are handled by .dpt-result-main-block's media query */
