@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-main: #0b1120;
    --bg-card: rgba(15, 23, 42, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --border-color: rgba(56, 189, 248, 0.15);
    --border-glow: rgba(56, 189, 248, 0.4);
    --primary: #38bdf8;
    --primary-hover: #0284c7;
    --indigo: #6366f1;
    --indigo-hover: #4f46e5;
    --accent: #818cf8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-cairo: 'Cairo', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-cairo);
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.08) 0%, transparent 45%),
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.glass-panel:hover {
    border-color: var(--border-glow);
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Math Glyphs Background Animation */
.math-symbol-float {
    position: absolute;
    color: rgba(56, 189, 248, 0.04);
    font-family: 'Times New Roman', serif;
    font-style: italic;
    user-select: none;
    pointer-events: none;
    z-index: 0;
}

@media (max-width: 768px) {
    .math-symbol-float {
        display: none !important;
    }
}

/* KaTeX custom overrides */
.katex {
    direction: ltr !important;
    text-align: left !important;
    font-size: 1.15em;
    color: #38bdf8 !important;
}

.katex-display {
    direction: ltr !important;
    margin: 0.75rem 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #0f172a;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-easy {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-medium {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-hard {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-ministerial {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
    color: #fde68a;
    border: 1px solid rgba(245, 158, 11, 0.5);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

/* Question Option Selectable */
.quiz-option {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.6);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quiz-option:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.quiz-option.selected {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
}

.quiz-option.correct {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.25);
}

.quiz-option.incorrect {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: #ef4444 !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.25);
}

/* Math Toolbar Buttons */
.math-tool-btn {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.math-tool-btn:hover {
    background: var(--primary);
    color: #0b1120;
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Watermark Overlay for Secure Documents */
.watermarked-viewer {
    position: relative;
    overflow: hidden;
}

.watermark-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-35deg);
    font-size: 2.5rem;
    font-weight: 800;
    color: rgba(56, 189, 248, 0.12);
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    z-index: 10;
}

/* Pulsing Timer Animation */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(56, 189, 248, 0.7);
    }
}

.timer-active {
    animation: pulse-glow 2s infinite;
}
