/* Custom styles for E-Tutor Basic Math */

:root {
    --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Fira Code', monospace;
}

body {
    font-family: var(--font-main);
    background-color: #f8fafc;
    color: #1e293b;
    -webkit-font-smoothing: antialiased;
}

html.dark body {
    background-color: #020617;
    color: #f1f5f9;
}

/* Math Notation Styles */

.fraction-display {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    text-align: center;
    padding: 0 4px;
    line-height: 1;
    margin: 0 2px;
}

.fraction-numerator {
    border-bottom: 2px solid currentColor;
    padding: 0 2px 1px;
    font-size: 0.85em;
    font-weight: 700;
}

.fraction-denominator {
    padding: 1px 2px 0;
    font-size: 0.85em;
    font-weight: 700;
}

.mixed-whole {
    font-weight: 800;
    margin-right: 2px;
    display: inline-flex;
    align-items: center;
}

.exponent-base {
    font-size: 1em;
    font-weight: 800;
}

.exponent-power {
    font-size: 0.65em;
    vertical-align: super;
    font-weight: 700;
    color: #e11d48;
}

/* Live Math Answer Preview */
.answer-preview {
    font-family: var(--font-mono);
    min-height: 24px;
    transition: all 0.2s ease;
}

.answer-preview .fraction-display {
    vertical-align: middle;
}

/* Keyboard Accessibility & Focus Indicators (WCAG AA & R-32) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #0f766e;
    outline-offset: 2px;
}

html.dark a:focus-visible,
html.dark button:focus-visible,
html.dark input:focus-visible,
html.dark select:focus-visible,
html.dark textarea:focus-visible {
    outline: 2px solid #2dd4bf;
    outline-offset: 2px;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

html.dark ::-webkit-scrollbar-track {
    background: #0f172a;
}

html.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}

html.dark ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}


/* Question Input Focus & Locked States */
.answer-input {
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

.answer-input:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -2px rgba(15, 118, 110, 0.25);
    outline: 2px solid #0f766e;
    outline-offset: 1px;
}

.input-locked-correct {
    background-color: #f0fdf4 !important;
    border-color: #86efac !important;
    color: #166534 !important;
    font-weight: 700;
    cursor: not-allowed;
}

.input-locked-incorrect {
    background-color: #fff1f2 !important;
    border-color: #fca5a5 !important;
    color: #9f1239 !important;
    font-weight: 700;
}

html.dark .answer-input:focus {
    box-shadow: 0 4px 12px -2px rgba(45, 212, 191, 0.25);
    outline: 2px solid #2dd4bf;
}

html.dark .input-locked-correct {
    background-color: rgba(22, 101, 52, 0.25) !important;
    border-color: #166534 !important;
    color: #86efac !important;
}

html.dark .input-locked-incorrect {
    background-color: rgba(159, 18, 57, 0.25) !important;
    border-color: #9f1239 !important;
    color: #fca5a5 !important;
}

/* Anti-Extension & Anti-Plugin UI Suppression */
grammarly-extension,
grammarly-popups,
grammarly-desktop-integration,
[data-gramm="false"] + div,
#loom-companion-mv3,
#math-solver-widget,
.lt-toolbar__wrapper,
.goog-te-banner-frame,
#goog-gt-tt,
.skiptranslate {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    height: 0 !important;
    width: 0 !important;
}

/* Disable text selection on quiz content to prevent extension tooltip triggers */
.quiz-no-select {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* Canvas soal: pointer events none agar tidak bisa di-klik/drag oleh ekstensi */
canvas[data-qcanvas] {
    pointer-events: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Proteksi seluruh area kuis dari seleksi teks */
#screen-quiz,
#questions-container,
.question-card {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Input jawaban tetap bisa diketik: override user-select khusus input */
#screen-quiz input[type="text"] {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    user-select: text !important;
}

/* ═════════════════════════════════════════════════════════════
 * RESPONSIVE & MOBILE POLISH (Scoped to body.student-app)
 * ═════════════════════════════════════════════════════════════ */

/* Minimum 44px touch targets on mobile for interactive elements */
button,
input[type="text"],
input[type="email"],
input[type="password"],
select {
    min-height: 44px;
}

/* Reserve space for sticky bottom action docks so questions are never covered */
body.student-app main {
    padding-bottom: 5.5rem;
}

/* Localized horizontal scroll resilience for math formulas & tables */
.table-scroll-container,
.formula-scroll-container,
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

/* Mobile Breakpoint Adjustments (< 640px) */
@media (max-width: 639px) {
    body.student-app header {
        height: auto;
        min-height: 4rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    body.student-app .quiz-banner-header {
        padding: 1.25rem;
    }

    /* Avoid button squishing in mobile dialogs and docks */
    body.student-app .modal-action-dock {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    body.student-app .modal-action-dock > * {
        width: 100%;
    }
}


