/* ===================================================
   TERMINOLOGY QUIZ STYLES
   Desert Fox Tan Color Theme
   =================================================== */

:root {
    /* Desert Fox Tan Color Palette */
    --desert-tan: #D2B48C;
    --desert-tan-light: #E6D3B1;
    --desert-tan-lighter: #faf7ed;
    --desert-tan-dark: #B8956F;
    --desert-sand: #f9efe2;
    --desert-brown: #8B7355;
    --desert-shadow: #564632;
    --desert-fox: #CD853F;
    --desert-fox-dark: #c45e1e;
    --accent-warm: #DAA520;
    --accent-warning: #facd5c;
    --accent-error: #a33535;
    --accent-success: #6c931f;
    --text-primary: #2F2F2F;
    --text-secondary: #5D4E37;
    --text-light: #8B7355;
    --white: #FFFFFF;
    --light-shadow: rgba(139, 115, 85, 0.1);
    --medium-shadow: rgba(139, 115, 85, 0.2);
    --dark-shadow: rgba(107, 91, 71, 0.3);
}

/* ===================================================
   STICKY PROGRESS HEADER
   =================================================== */

.sticky-progress-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--desert-tan);
    border-bottom: 2px solid var(--desert-tan-dark);
    padding: 8px 16px;
    box-shadow: 0 2px 4px var(--light-shadow);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.progress-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.progress-text {
    font-weight: 500;
    white-space: nowrap;
    min-width: fit-content;
}

/* HTML5 Progress Element Styling */
.quiz-progress {
    flex: 1;
    height: 16px;
    border-radius: 8px;
    border: none;
    background-color: var(--desert-tan-lighter);
    overflow: hidden;
    /* Remove default styling */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* WebKit browsers (Chrome, Safari, Edge) */
.quiz-progress::-webkit-progress-bar {
    background-color: var(--desert-tan-lighter);
    border-radius: 8px;
    border: 1px solid var(--desert-tan-dark);
}

.quiz-progress::-webkit-progress-value,
.quiz-progress::-moz-progress-bar /* Firefox */ {
    background-color: var(--accent-warm);
    border-radius: 8px;
    transition: width 0.3s ease;
}

/* Progress states */
.quiz-progress.progress-none::-webkit-progress-value,
.quiz-progress.progress-none::-moz-progress-bar {
    background-color: var(--desert-tan-dark);
}

.quiz-progress.progress-partial::-webkit-progress-value,
.quiz-progress.progress-partial::-moz-progress-bar {
    background-color: var(--accent-warm);
}

.quiz-progress.progress-complete::-webkit-progress-value,
.quiz-progress.progress-complete::-moz-progress-ba {
    background-color: var(--accent-success);
}

/* Responsive design */
@media (max-width: 768px) {
    .sticky-progress-header {
        padding: 6px 12px;
    }
    
    .progress-container {
        gap: 8px;
        font-size: 0.8rem;
    }
    
    .quiz-progress {
        height: 14px;
    }
}

/* ===================================================
   GENERAL STYLES
   =================================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--desert-sand);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.poof {
    display: none !important;
}
svg.spinny {
    width: 1em;
    height: 1em;
    vertical-align: middle;
    margin-left: 0.5em;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===================================================
   HEADER STYLES
   =================================================== */

.page-header {
    background: linear-gradient(135deg, var(--desert-fox), var(--desert-tan));
    color: var(--white);
    padding: 1rem 0;
    box-shadow: 0 2px 8px var(--light-shadow);
}

.main-navigation {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
}

.homeLink {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.homeLink:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.course-identifier {
    font-size: 1.1rem;
    margin: 0 0 0 20px;
    opacity: 0.9;
    font-weight: 500;
}

/* ===================================================
   MAIN CONTENT STYLES
   =================================================== */

.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
    box-sizing: border-box;
}

/* ===================================================
   INSTRUCTIONS SECTION
   =================================================== */

.instructions-section {
    max-width: 800px;
    margin: 0 auto 3rem auto;
    background: var(--white);
    border-radius: 12px;
    padding: 4rem;
    box-shadow: 0 4px 12px var(--light-shadow);
    border: 2px solid var(--desert-tan-light);
}   

.quiz-title {
    color: var(--desert-brown);
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1.5rem 0;
    text-align: center;
    line-height: 1.3;
}

.instructions-content h2 {
    color: var(--desert-shadow);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    border-bottom: 2px solid var(--desert-tan-light);
    padding-bottom: 0.5rem;
}

.instructions-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.instructions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.instructions-list li {
    position: relative;
    padding: 0.75rem 0 0.75rem 3rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
    background: var(--desert-sand);
    border-radius: 8px;
    border-left: 4px solid var(--desert-fox);
}

.instructions-list li::before {
    content: "→";
    position: absolute;
    left: 0.75rem;
    color: var(--desert-fox);
    font-weight: bold;
    font-size: 1.1rem;
}

.instructions-list li strong {
    color: var(--desert-shadow);
    font-weight: 600;
}

.instructions-list li em {
    color: var(--desert-brown);
    font-style: italic;
}
.warning {
    background: var(--desert-shadow);
    border: 2px solid var(--accent-warning);
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
}
.warning p {
    padding: 0 2rem;
    color: var(--accent-warning);
    font-weight: 500;
}
.warning p::before {
    content: "⚠️";
    margin-right: 0.5rem;
}

/* ===================================================
   QUIZ SECTION
   =================================================== */

.quiz-section {
    margin-bottom: 2rem;
}

.quiz-section-title {
    color: var(--desert-brown);
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 2rem 0;
    text-align: center;
    padding: 1rem;
    background: var(--white);
    border-radius: 12px;
    border: 2px solid var(--desert-tan-light);
    box-shadow: 0 2px 8px var(--light-shadow);
}

/* ===================================================
   FOOTER STYLES
   =================================================== */

.page-footer {
    background: var(--desert-brown);
    color: var(--white);
    padding: 1.5rem 0;
    margin-top: auto;
    box-shadow: 0 -2px 8px var(--light-shadow);
}

.copyright-notice {
    text-align: center;
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===================================================
   QUIZ CONTAINER
   =================================================== */

#termQuiz {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.quiz-item {
    background: var(--white);
    border: 2px solid var(--desert-tan-light);
    border-radius: 12px;
    margin-bottom: 2rem;
    padding: 1.5rem;
    box-shadow: 0 4px 12px var(--light-shadow);
    transition: all 0.3s ease;
}

.quiz-item:hover {
    box-shadow: 0 6px 20px var(--medium-shadow);
    transform: translateY(-2px);
}

.quiz-item-header {
    border-bottom: 2px solid var(--desert-tan-light);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.quiz-item-header h3 {
    margin: 0;
    color: var(--desert-brown);
    font-size: 1.5rem;
    font-weight: 600;
}

.quiz-item-content {
    display: grid;
    gap: 1.5rem;
}

/* ===================================================
   SECTION STYLES
   =================================================== */

.stimulus-section,
.recording-section,
.answer-section {
    background: var(--desert-sand);
    border: 1px solid var(--desert-tan);
    border-radius: 8px;
    padding: 1.25rem;
}

.stimulus-section h4,
.recording-section h4,
.answer-section h4 {
    margin: 0 0 1rem 0;
    color: var(--desert-shadow);
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stimulus-section h4::before {
    content: "🔊";
    font-size: 1.2rem;
}

.recording-section h4::before {
    content: "🎤";
    font-size: 1.2rem;
}

.answer-section h4::before {
    content: "✓";
    font-size: 1.2rem;
    color: var(--accent-success);
}
.audio-heading {
  margin: 1rem 0 0 0;
  font-size: 1rem;
}

/* ===================================================
   AUDIO CONTROLS
   =================================================== */

.audio-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

audio {
    flex: 1;
    height: 40px;
    background: var(--white);
    border: 1px solid var(--desert-tan);
    border-radius: 6px;
}

audio::-webkit-media-controls-panel {
    background-color: var(--white);
}

audio::-webkit-media-controls-play-button,
audio::-webkit-media-controls-mute-button {
    background-color: var(--desert-fox);
    border-radius: 4px;
}

audio:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.answer-locked-message {
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
    margin: 0.5rem 0 0 0;
}

/* ===================================================
   SELF-ASSESSMENT FORM STYLES
   =================================================== */

.self-assessment-form {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--white);
    border: 2px solid var(--desert-tan-light);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--light-shadow);
}

.self-assessment-form h5 {
    margin: 0;
    color: var(--desert-shadow);
    font-size: 1.2rem;
    font-weight: 600;
}

.assessment-question {
    margin-bottom: 1rem;
}

.radio-group {
    display: flex;
    gap: 1rem;
    margin-left: 0.5rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--desert-tan);
    border-radius: 6px;
    background: var(--white);
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.radio-option:hover {
    border-color: var(--desert-fox);
    background: var(--desert-sand);
}

.radio-option input[type="radio"] {
    margin: 0;
    accent-color: var(--desert-fox);
}

.radio-option:has(input:checked) {
    border-color: var(--desert-fox);
    background: var(--desert-tan-light);
    color: var(--desert-shadow);
    font-weight: 500;
}

.points-display {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.points-text {
    margin: 0 0 0 1rem;
    font-weight: 600;
    color: var(--desert-brown);
    font-size: 0.95rem;
}

.points-value {
    color: var(--desert-fox);
    font-weight: 700;
}

/* ===================================================
   TOTAL SCORE DISPLAY
   =================================================== */

.total-score-display {
    margin-top: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--desert-fox), var(--desert-tan));
    color: var(--white);
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 6px 20px var(--medium-shadow);
}

.total-score-display h3 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.score-summary {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.score-fraction {
    font-size: 2rem;
    font-weight: 700;
    color: var(--white);
}

.score-percentage {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--white);
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 25px;
}

/* ===================================================
   BUTTON STYLES
   =================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-evenly;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}

.btn:focus {
    outline: 2px solid var(--accent-warm);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--desert-fox);
    color: var(--white);
    border: 2px solid var(--desert-fox);
}

.btn-primary:hover:not(:disabled) {
    background: var(--desert-brown);
    border-color: var(--desert-brown);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--white);
    color: var(--desert-brown);
    border: 2px solid var(--desert-tan);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--desert-tan-light);
    border-color: var(--desert-tan-dark);
    transform: translateY(-1px);
}

.btn-record {
    background: var(--accent-error);
    color: var(--white);
    border: 2px solid var(--accent-error);
    width: 120px;
    text-align: center;
}

.btn-record:hover:not(:disabled) {
    background: #B22222;
    border-color: #B22222;
    transform: translateY(-1px);
}

.btn-stop {
    background: var(--desert-shadow);
    color: var(--white);
    border: 2px solid var(--desert-shadow);
    width: 120px;
    text-align: center;
}

.btn-stop:hover:not(:disabled) {
    background: #4A4A4A;
    border-color: #4A4A4A;
    transform: translateY(-1px);
}

/* ===================================================
   BUTTON ICONS
   =================================================== */

.record-icon::before {
    content: "●";
    color: currentColor;
}

.stop-icon::before {
    content: "■";
    color: currentColor;
}

.play-icon::before {
    content: "▶";
    color: currentColor;
}

/* ===================================================
   RECORDING CONTROLS
   =================================================== */

.recording-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.recording-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--white);
    border: 1px solid var(--desert-tan);
    border-radius: 6px;
}

.status-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.recording-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--desert-tan);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: var(--white);
    font-weight: bold;
}

.recording-indicator.recording {
    background: var(--accent-error);
    animation: pulse 1.5s infinite;
}

.recording-indicator.completed {
    background: var(--accent-success);
    border-radius: 3px;
    width: 16px;
    height: 16px;
    font-size: 10px;
}

.recording-indicator.completed::before {
    content: "✓";
    color: var(--white);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

/* ===================================================
   LOADING AND MICROPHONE MODAL
   =================================================== */
#initializingDialog {
    padding: 2rem;
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 50px var(--dark-shadow);
    background: var(--white);
    backdrop-filter: blur(4px);
}
#initializingDialog p {
    margin: 0;
    font-size: 1.4rem;
    color: var(--desert-brown);
    text-align: center;
}

.microphone-modal {
    max-width: 500px;
    width: 90vw;
    margin: auto;
    padding: 0;
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px var(--dark-shadow);
    background: var(--white);
    backdrop-filter: blur(4px);
}

.microphone-modal::backdrop,
#initializingDialog::backdrop {
    background: rgba(139, 115, 85, 0.4);
    backdrop-filter: blur(2px);
}

.modal-content {
    padding: 2rem;
}

.modal-content h3 {
    margin: 0 0 1rem 0;
    color: var(--desert-brown);
    font-size: 1.5rem;
    text-align: center;
}

.modal-message {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.microphone-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.microphone-form label {
    font-weight: 500;
    color: var(--desert-brown);
    margin-bottom: 0.5rem;
    display: block;
}

.microphone-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--desert-tan);
    border-radius: 6px;
    background: var(--white);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
}

.microphone-select:focus {
    outline: none;
    border-color: var(--accent-warm);
    box-shadow: 0 0 0 2px rgba(218, 165, 32, 0.2);
}

/* ===================================================
   VOLUME INDICATOR
   =================================================== */

.volume-indicator-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.volume-indicator {
    height: 20px;
    background: var(--desert-tan-light);
    border: 1px solid var(--desert-tan);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    width: 100%;
    --volume-width: 0%;
}

.volume-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--volume-width, 0%);
    background: linear-gradient(90deg, var(--accent-success), var(--desert-tan));
    border-radius: 10px;
    transition: width 0.1s ease;
}

/* ===================================================
   MODAL BUTTONS
   =================================================== */

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

/* ===================================================
   ERROR MESSAGES
   =================================================== */

.error-message {
    background: #FFF0F0;
    color: var(--accent-error);
    padding: 1rem;
    border: 1px solid #FFB6C1;
    border-radius: 6px;
    margin: 1rem 0;
    font-weight: 500;
    display: none;
}

.error-message:not(:empty) {
    display: block;
}

/* ===================================================
   RESPONSIVE DESIGN
   =================================================== */

@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0.5rem;
    }
    
    .instructions-section {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }
    
    .quiz-title {
        font-size: 1.75rem;
    }
    
    .instructions-content h2 {
        font-size: 1.25rem;
    }
    
    .instructions-content p {
        font-size: 1rem;
    }
    
    .instructions-list li {
        padding: 0.5rem 0.5rem 0.5rem 2rem;
        font-size: 0.95rem;
    }
    
    .instructions-list li::before {
        left: 0.5rem;
    }
    
    .quiz-section-title {
        font-size: 1.5rem;
        padding: 0.75rem;
    }
    
    .page-header {
        padding: 0.75rem 0;
    }
    
    .homeLink {
        font-size: 1.25rem;
        padding: 0.375rem 0.75rem;
    }
    
    .course-identifier {
        font-size: 0.8rem;
    }
    
    #termQuiz {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }
    
    .quiz-item {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    .self-assessment-form {
        padding: 1rem;
    }
    
    .total-score-display {
        padding: 1.5rem;
    }
    
    .score-summary {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem 0.2rem;
    }
    .quiz-title {
        font-size: 1.5rem;
    }
    
    .instructions-content h2 {
        font-size: 1.1rem;
    }
    #termQuiz {
        padding: 0 0.2rem;
    }
    
    .quiz-section-title {
        font-size: 1.25rem;
    }

    .quiz-item {
        padding: 0.5rem;
    }
    .quiz-item-header h3 {
        font-size: 1.25rem;
    }
    .stimulus-section,
    .recording-section,
    .answer-section {
        padding: 1.25rem 0.5rem;
    }
    
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .instructions-section {
        padding: 1rem;
    }
    
    .instructions-list li {
        font-size: 0.9rem;
    }
    
    .homeLink {
        font-size: 1.1rem;
    }
    
    .course-identifier {
        font-size: 0.75rem;
    }
    
    .self-assessment-form {
        padding: 0.75rem;
    }
    
    .radio-option {
        padding: 0.375rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .total-score-display {
        padding: 1rem;
    }
    
    .total-score-display h3 {
        font-size: 1.25rem;
    }
    
    .score-fraction {
        font-size: 1.5rem;
    }
    
    .score-percentage {
        font-size: 1.25rem;
    }
}

@media (max-width: 380px) {
    .main-navigation {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .course-identifier {
        font-size: 0.8rem;
    }
}

/* ===================================================
   ACCESSIBILITY ENHANCEMENTS
   =================================================== */

@media (prefers-reduced-motion: reduce) {
    .quiz-item,
    .btn,
    .recording-indicator {
        transition: none;
    }
    
    .recording-indicator.recording {
        animation: none;
    }
    
    .quiz-item:hover {
        transform: none;
    }
    
    .btn:hover:not(:disabled) {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --desert-tan: #8B4513;
        --desert-tan-light: #CD853F;
        --desert-tan-dark: #654321;
        --desert-sand: #FFF8DC;
        --desert-brown: #5D4037;
        --text-primary: #000000;
        --text-secondary: #333333;
    }
    
    .btn {
        border-width: 3px;
    }
    
    audio,
    .microphone-select {
        border-width: 3px;
    }
}

/* Focus visible enhancement */
.btn:focus-visible,
.microphone-select:focus-visible,
audio:focus-visible {
    outline: 3px solid var(--accent-warm);
    outline-offset: 2px;
}
