/* =================================================================
   ACTFL TEST ADMIN MODULE STYLES
   Bob and Mariel Ward School of Filipino Languages
   ================================================================= */

/* Main Container */
.module-actfl-admin {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.module-actfl-admin h1 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-color);
}

.module-actfl-admin h1 i {
    margin-right: 12px;
    color: var(--primary-color);
}

/* =================================================================
   TEST SELECTION VIEW
   ================================================================= */

.actfl-intro {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-muted);
}

.actfl-intro p {
    margin: 8px 0;
}

.actfl-note {
    background: rgba(var(--warning-rgb), 0.1);
    color: var(--warning-color);
    padding: 12px 16px;
    border-radius: 8px;
    display: inline-block;
    font-size: 14px;
}

.actfl-note i {
    margin-right: 8px;
}

.actfl-test-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.loading-tests {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Test Cards */
.actfl-test-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--surface-color);
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.2s;
}

.actfl-test-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.test-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.test-card-icon i {
    font-size: 24px;
    color: white;
}

.test-card-content {
    flex: 1;
}

.test-card-content .test-name {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text-color);
}

.test-card-content .test-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.test-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.test-card-action {
    flex-shrink: 0;
}

/* =================================================================
   STUDENT INFO VIEW
   ================================================================= */

.actfl-student-form {
    max-width: 500px;
    margin: 0 auto;
    padding: 32px;
    background: var(--surface-color);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.actfl-student-form h2 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-color);
}

.actfl-student-form .form-group {
    margin-bottom: 20px;
}

.actfl-student-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.actfl-student-form input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.actfl-student-form input:focus {
    border-color: var(--primary-color);
}

.selected-test-summary {
    padding: 16px;
    background: var(--surface-hover);
    border-radius: 8px;
    margin-bottom: 20px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    color: var(--text-muted);
}

.summary-value {
    font-weight: 600;
    color: var(--text-color);
}

.actfl-student-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* =================================================================
   TEST ADMINISTRATION VIEW
   ================================================================= */

.actfl-admin-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Progress Bar */
.actfl-progress-bar {
    height: 6px;
    background: var(--surface-hover);
    border-radius: 3px;
    overflow: hidden;
}

.actfl-progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
    transition: width 0.3s ease-out;
}

.actfl-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-muted);
}

.student-name-display {
    font-weight: 600;
    color: var(--text-color);
}

/* Question Card */
.actfl-question-card {
    background: var(--surface-color);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 24px;
}

/* Teacher Instructions */
.actfl-teacher-instructions {
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.instruction-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.actfl-teacher-instructions p {
    margin: 0;
    color: var(--text-color);
    font-size: 14px;
}

/* Cebuano Prompt */
.actfl-prompt-section {
    text-align: center;
    padding: 32px 16px;
    margin: 16px 0;
}

.actfl-prompt {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.4;
}

/* Cebuano Prompt - English translation */
.actfl-prompt-english {
    font-size: 16px;
    color: var(--text-muted);
    margin-top: 8px;
    font-style: italic;
}

.actfl-prompt-english.hidden {
    display: none;
}

/* Expected Response */
.actfl-expected-section {
    background: rgba(var(--success-rgb), 0.1);
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 16px;
}

.expected-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--success-color);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.expected-response-full {
    margin: 0;
    color: var(--text-color);
    font-size: 15px;
    font-style: italic;
}

.expected-response-min {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

.expected-response-min.hidden {
    display: none;
}

/* Badges Row */
.actfl-badges-row {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.actfl-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.actfl-badge.hidden {
    display: none;
}

.actfl-badge-category {
    background: var(--surface-hover);
    color: var(--text-muted);
}

.actfl-badge-type {
    background: rgba(33, 150, 243, 0.1);
    color: #2196f3;
}

.actfl-badge-lesson {
    background: rgba(156, 39, 176, 0.1);
    color: #9c27b0;
}

/* Timer Section */
.actfl-timer-section {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.actfl-start-timer-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 48px;
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.actfl-start-timer-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.actfl-start-timer-btn i {
    font-size: 28px;
}

.actfl-timer-display {
    display: flex;
    justify-content: center;
}

.timer-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--surface-hover);
    border: 4px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.timer-value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

.timer-unit {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.timer-circle.timer-warning {
    border-color: var(--warning-color);
    background: rgba(var(--warning-rgb), 0.1);
}

.timer-circle.timer-warning .timer-value {
    color: var(--warning-color);
}

.timer-circle.timer-critical {
    border-color: var(--error-color);
    background: rgba(var(--error-rgb), 0.1);
    animation: shake 0.5s ease-in-out infinite;
}

.timer-circle.timer-critical .timer-value {
    color: var(--error-color);
}

.timer-circle.timer-expired {
    border-color: var(--error-color);
    background: rgba(var(--error-rgb), 0.2);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* Scoring Section - Vertical Slider with Rubric */
.actfl-scoring-section {
    padding: 20px;
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.scoring-label {
    text-align: center;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-color);
}

/* Scoring Panel - Slider + Rubric side by side */
.actfl-scoring-panel {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: stretch;
    min-height: 340px;
}

/* Vertical Score Slider (10 at top, 1 at bottom) */
.actfl-score-slider {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
    width: 48px;
}

.score-box {
    width: 48px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid transparent;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Score box colors */
.score-box.score-poor {
    background: linear-gradient(135deg, #f44336, #e53935);
    color: white;
}

.score-box.score-fair {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
}

.score-box.score-good {
    background: linear-gradient(135deg, #4caf50, #43a047);
    color: white;
}

.score-box:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.score-box.selected {
    border-color: var(--text-color);
    transform: scale(1.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

/* Rubric Stack - 3 bands aligned to score ranges */
.actfl-rubric-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    max-width: 500px;
}

.actfl-rubric-band {
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

/* Rubric band sizes proportional to score ranges: 4/3/3 */
.actfl-rubric-high {
    flex: 4;
    background: rgba(76, 175, 80, 0.06);
    border-color: rgba(76, 175, 80, 0.2);
}

.actfl-rubric-mid {
    flex: 3;
    background: rgba(255, 152, 0, 0.06);
    border-color: rgba(255, 152, 0, 0.2);
}

.actfl-rubric-low {
    flex: 3;
    background: rgba(244, 67, 54, 0.06);
    border-color: rgba(244, 67, 54, 0.2);
}

.rubric-band-label {
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
}

.actfl-rubric-high .rubric-band-label { color: #4caf50; }
.actfl-rubric-mid .rubric-band-label { color: #ff9800; }
.actfl-rubric-low .rubric-band-label { color: #f44336; }

.rubric-band-text {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-color);
}

/* Active rubric band (matches selected score) */
.actfl-rubric-band.rubric-active {
    border-width: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.actfl-rubric-high.rubric-active {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.12);
}

.actfl-rubric-mid.rubric-active {
    border-color: #ff9800;
    background: rgba(255, 152, 0, 0.12);
}

.actfl-rubric-low.rubric-active {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.12);
}

/* Custom rubric indicator (question-level override) */
.actfl-rubric-band.rubric-custom .rubric-band-label::after {
    content: ' *';
    font-size: 11px;
    opacity: 0.7;
}

/* Selected score display */
.actfl-score-selected {
    text-align: center;
    margin-top: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    min-height: 24px;
}

/* Navigation */
.actfl-nav-section {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.actfl-exit-section {
    text-align: center;
}

.actfl-exit-section .btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
}

.actfl-exit-section .btn-link:hover {
    color: var(--error-color);
}

/* =================================================================
   RESULTS VIEW
   ================================================================= */

.actfl-results-view {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.results-header {
    text-align: center;
    padding: 20px;
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.results-header h2 {
    margin: 0 0 16px 0;
    color: var(--text-color);
}

.results-student, .results-test, .results-date {
    margin: 4px 0;
    color: var(--text-muted);
}

/* Score Summary */
.results-summary {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 32px;
    padding: 32px;
    background: var(--surface-color);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.score-gauge {
    text-align: center;
}

.gauge-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 6px solid;
}

.gauge-circle.level-failure {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.1);
}

.gauge-circle.level-improving {
    border-color: #ff9800;
    background: rgba(255, 152, 0, 0.1);
}

.gauge-circle.level-pass {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.gauge-circle.level-outstanding {
    border-color: #2196f3;
    background: rgba(33, 150, 243, 0.1);
}

.gauge-percentage {
    font-size: 36px;
    font-weight: 700;
}

.level-failure .gauge-percentage { color: #f44336; }
.level-improving .gauge-percentage { color: #ff9800; }
.level-pass .gauge-percentage { color: #4caf50; }
.level-outstanding .gauge-percentage { color: #2196f3; }

.gauge-label {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.proficiency-level {
    text-align: center;
}

.level-badge {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 700;
}

.level-badge.level-failure {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

.level-badge.level-improving {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
}

.level-badge.level-pass {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

.level-badge.level-outstanding {
    background: rgba(33, 150, 243, 0.1);
    color: #2196f3;
}

/* Breakdown Stats */
.results-breakdown {
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
}

.results-breakdown h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-muted);
}

.breakdown-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    background: var(--surface-hover);
    border-radius: 8px;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Questions Grid */
.results-questions {
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
}

.results-questions h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-muted);
}

.questions-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.question-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid;
}

.question-result-item.score-poor {
    background: rgba(244, 67, 54, 0.05);
    border-left-color: #f44336;
}

.question-result-item.score-fair {
    background: rgba(255, 152, 0, 0.05);
    border-left-color: #ff9800;
}

.question-result-item.score-good {
    background: rgba(76, 175, 80, 0.05);
    border-left-color: #4caf50;
}

.question-result-item.score-skipped {
    background: var(--surface-hover);
    border-left-color: var(--text-muted);
}

.result-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.result-content {
    flex: 1;
    min-width: 0;
}

.result-prompt {
    font-size: 14px;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-meta {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.result-category {
    font-size: 11px;
    color: var(--text-muted);
}

.result-type {
    font-size: 11px;
    color: #2196f3;
}

.result-score {
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.result-score .skipped {
    color: var(--text-muted);
    font-style: italic;
}

.score-poor .result-score .score-value { color: #f44336; }
.score-fair .result-score .score-value { color: #ff9800; }
.score-good .result-score .score-value { color: #4caf50; }

/* Category Breakdown */
.results-category-breakdown {
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
}

.results-category-breakdown h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-muted);
}

.category-breakdown-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-breakdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cat-name {
    width: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
    text-transform: capitalize;
    flex-shrink: 0;
}

.cat-bar-container {
    flex: 1;
    height: 16px;
    background: var(--surface-hover);
    border-radius: 8px;
    overflow: hidden;
}

.cat-bar {
    height: 100%;
    border-radius: 8px;
    transition: width 0.3s ease;
}

.cat-bar.bar-poor { background: #f44336; }
.cat-bar.bar-fair { background: #ff9800; }
.cat-bar.bar-good { background: #4caf50; }

.cat-avg {
    width: 36px;
    text-align: right;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
    flex-shrink: 0;
}

.cat-count {
    width: 40px;
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Results Actions */
.results-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* =================================================================
   EMPTY STATE
   ================================================================= */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-color);
}

.empty-state p {
    margin: 4px 0;
}

/* =================================================================
   PRINT STYLES
   ================================================================= */

@media print {
    .actfl-results-view {
        display: block !important;
    }

    .results-actions {
        display: none;
    }

    .module-actfl-admin h1,
    .actfl-selection-view,
    .actfl-student-view,
    .actfl-admin-view {
        display: none !important;
    }

    .questions-grid {
        max-height: none;
        overflow: visible;
    }
}

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

@media (max-width: 768px) {
    .module-actfl-admin {
        padding: 12px;
    }

    .actfl-test-card {
        flex-direction: column;
        text-align: center;
    }

    .test-card-content .test-meta {
        justify-content: center;
    }

    .actfl-prompt {
        font-size: 24px;
    }

    .actfl-scoring-panel {
        min-height: 280px;
    }

    .score-box {
        height: 26px;
        font-size: 14px;
    }

    .rubric-band-text {
        font-size: 12px;
    }

    .results-summary {
        flex-direction: column;
        gap: 20px;
    }

    .breakdown-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .actfl-nav-section {
        flex-direction: column;
    }

    .actfl-nav-section .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .actfl-scoring-panel {
        flex-direction: column;
        min-height: auto;
    }

    .actfl-score-slider {
        flex-direction: row;
        width: auto;
        justify-content: center;
    }

    .score-box {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .actfl-rubric-stack {
        max-width: none;
    }

    .actfl-rubric-band {
        padding: 8px 12px;
    }

    .actfl-start-timer-btn {
        padding: 16px 32px;
        font-size: 18px;
    }
}
