/* ========================================
   Math Placement Test - Stylesheet
   ======================================== */

/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success-color: #16a34a;
    --success-light: #dcfce7;
    --warning-color: #ca8a04;
    --warning-light: #fef9c3;
    --danger-color: #dc2626;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Courier New', monospace;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-lg: 12px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-family);
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: var(--radius-lg);
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.header .subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Info Cards */
.info-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 25px 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.info-card h2 {
    font-size: 1.3rem;
    color: var(--gray-800);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gray-100);
}

.info-card p {
    color: var(--gray-600);
}

.info-card ul, .info-card ol {
    color: var(--gray-600);
    padding-left: 25px;
}

.info-card li {
    margin-bottom: 8px;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.info-item {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.info-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.info-item h3 {
    font-size: 1rem;
    color: var(--gray-700);
    margin-bottom: 5px;
}

.info-item p {
    font-size: 0.9rem;
    color: var(--gray-500);
}

/* Skills Grid */
.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.skill-tag {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Form Styles */
.start-form {
    background: white;
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #15803d;
}

.btn-large {
    width: 100%;
    padding: 16px 32px;
    font-size: 1.1rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* ========================================
   Test Page Styles
   ======================================== */

.test-header {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    position: sticky;
    top: 10px;
    z-index: 100;
}

.test-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.student-name {
    font-weight: 600;
    color: var(--gray-700);
}

.timer {
    background: var(--gray-100);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-700);
}

.timer.warning {
    background: var(--warning-light);
    color: var(--warning-color);
}

.timer.danger {
    background: var(--danger-light);
    color: var(--danger-color);
}

.progress-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-text {
    font-size: 0.9rem;
    color: var(--gray-600);
    white-space: nowrap;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

/* Question Card */
.question-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: none;
}

.question-card.active {
    display: block;
}

.question-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.question-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-skill {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge-grade {
    background: var(--gray-100);
    color: var(--gray-600);
}

.question-number {
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-bottom: 10px;
}

.question-text {
    font-size: 1.2rem;
    color: var(--gray-800);
    margin-bottom: 25px;
    line-height: 1.7;
}

.question-text code {
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
}

/* Answer Options */
.options-list {
    list-style: none;
}

.option-item {
    margin-bottom: 12px;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.option-label:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.option-label input {
    display: none;
}

.option-label input:checked + .option-text {
    color: var(--primary-dark);
    font-weight: 600;
}

.option-label:has(input:checked) {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.option-marker {
    width: 28px;
    height: 28px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-weight: 600;
    color: var(--gray-500);
    flex-shrink: 0;
    transition: all 0.2s;
}

.option-label:has(input:checked) .option-marker {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.option-text {
    flex: 1;
    color: var(--gray-700);
}

/* Numeric Input */
.numeric-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.numeric-input input {
    width: 150px;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-family: var(--font-mono);
    text-align: center;
}

.numeric-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Navigation */
.question-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.nav-hint {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.nav-buttons {
    display: flex;
    gap: 10px;
}

/* Question Navigator */
.question-navigator {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.navigator-title {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 15px;
}

.navigator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: 8px;
}

.nav-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    background: white;
    color: var(--gray-600);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    border-color: var(--primary-color);
}

.nav-btn.answered {
    background: var(--success-light);
    border-color: var(--success-color);
    color: var(--success-color);
}

.nav-btn.current {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.nav-btn.flagged {
    background: var(--warning-light);
    border-color: var(--warning-color);
}

/* Submit Section */
.submit-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 25px 30px;
    box-shadow: var(--shadow);
    text-align: center;
}

.submit-section p {
    color: var(--gray-600);
    margin-bottom: 20px;
}

.unanswered-warning {
    background: var(--warning-light);
    color: var(--warning-color);
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

/* ========================================
   Results Page Styles
   ======================================== */

.results-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-bottom: 30px;
    text-align: center;
}

.results-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.results-header .student-info {
    opacity: 0.9;
    margin-bottom: 20px;
}

.score-display {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

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

.score-value {
    font-size: 3rem;
    font-weight: 700;
    display: block;
}

.score-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Summary Cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow);
}

.summary-card h3 {
    font-size: 1.1rem;
    color: var(--gray-700);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-card h3 .icon {
    font-size: 1.3rem;
}

/* Skill Breakdown */
.skill-breakdown {
    margin-bottom: 30px;
}

.skill-row {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--gray-100);
}

.skill-row:last-child {
    border-bottom: none;
}

.skill-info {
    flex: 1;
    min-width: 0;
}

.skill-name {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.skill-grade {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.skill-score {
    display: flex;
    align-items: center;
    gap: 15px;
}

.skill-bar {
    width: 100px;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.skill-fill.excellent {
    background: var(--success-color);
}

.skill-fill.good {
    background: #22c55e;
}

.skill-fill.needs-work {
    background: var(--warning-color);
}

.skill-fill.struggling {
    background: var(--danger-color);
}

.skill-percent {
    font-weight: 600;
    min-width: 45px;
    text-align: right;
}

.skill-percent.excellent {
    color: var(--success-color);
}

.skill-percent.good {
    color: #22c55e;
}

.skill-percent.needs-work {
    color: var(--warning-color);
}

.skill-percent.struggling {
    color: var(--danger-color);
}

/* Grade Level Indicator */
.grade-indicator {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.grade-scale {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    position: relative;
}

.grade-scale::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    transform: translateY(-50%);
    z-index: 0;
}

.grade-mark {
    background: white;
    padding: 5px 10px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--gray-600);
    position: relative;
    z-index: 1;
}

.grade-mark.current {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.grade-marker {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    margin: 10px auto;
    position: relative;
}

/* Recommendations */
.recommendations {
    background: white;
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.recommendations h2 {
    font-size: 1.3rem;
    color: var(--gray-800);
    margin-bottom: 20px;
}

.recommendation-item {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
}

.recommendation-item.priority-high {
    border-left-color: var(--danger-color);
    background: var(--danger-light);
}

.recommendation-item.priority-medium {
    border-left-color: var(--warning-color);
    background: var(--warning-light);
}

.recommendation-item.priority-low {
    border-left-color: var(--success-color);
    background: var(--success-light);
}

.rec-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.rec-content h4 {
    font-size: 1rem;
    color: var(--gray-800);
    margin-bottom: 5px;
}

.rec-content p {
    font-size: 0.9rem;
    color: var(--gray-600);
}

.rec-standard {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 8px;
    font-style: italic;
}

/* Detailed Results */
.detailed-results {
    background: white;
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.detailed-results h2 {
    font-size: 1.3rem;
    color: var(--gray-800);
    margin-bottom: 20px;
}

.results-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    background: white;
    color: var(--gray-600);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.result-item {
    padding: 20px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 15px;
}

.result-item.correct {
    border-left: 4px solid var(--success-color);
}

.result-item.incorrect {
    border-left: 4px solid var(--danger-color);
    background: var(--danger-light);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.result-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.result-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.result-status.correct {
    background: var(--success-light);
    color: var(--success-color);
}

.result-status.incorrect {
    background: var(--danger-light);
    color: var(--danger-color);
}

.result-question {
    font-size: 1rem;
    color: var(--gray-800);
    margin-bottom: 15px;
    line-height: 1.6;
}

.result-answers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.answer-box {
    padding: 12px 15px;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.answer-box.student-answer {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
}

.answer-box.student-answer.wrong {
    background: var(--danger-light);
    border-color: var(--danger-color);
}

.answer-box.correct-answer {
    background: var(--success-light);
    border: 1px solid var(--success-color);
}

.answer-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.answer-value {
    font-weight: 600;
    color: var(--gray-800);
}

.result-standard {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-200);
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* Print Button */
.print-section {
    text-align: center;
    margin-bottom: 30px;
}

.print-section .btn {
    margin: 0 10px;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    body {
        background: white;
        font-size: 11pt;
        line-height: 1.4;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .no-print {
        display: none !important;
    }

    .results-header {
        background: var(--gray-800) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        page-break-after: avoid;
    }

    .summary-card,
    .recommendations,
    .detailed-results {
        box-shadow: none;
        border: 1px solid var(--gray-300);
        page-break-inside: avoid;
    }

    .result-item {
        page-break-inside: avoid;
    }

    .skill-fill,
    .progress-fill {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .recommendation-item {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    h2, h3 {
        page-break-after: avoid;
    }

    .print-section {
        display: none;
    }

    @page {
        margin: 0.75in;
    }
}

/* ========================================
   Responsive Styles
   ======================================== */

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .test-header {
        position: relative;
        top: 0;
    }

    .test-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .progress-section {
        width: 100%;
    }

    .progress-bar {
        flex: 1;
    }

    .question-nav {
        flex-direction: column;
        gap: 15px;
    }

    .nav-buttons {
        width: 100%;
    }

    .nav-buttons .btn {
        flex: 1;
    }

    .score-display {
        gap: 20px;
    }

    .score-value {
        font-size: 2rem;
    }

    .result-answers {
        grid-template-columns: 1fr;
    }
}

/* Math notation helpers */
.math {
    font-family: var(--font-mono);
}

.fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 4px;
}

.fraction .num {
    border-bottom: 1px solid currentColor;
    padding: 0 4px 2px;
}

.fraction .den {
    padding: 2px 4px 0;
}

sup, sub {
    font-size: 0.75em;
}
