:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #64748b;
    --accent: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

h1, h2, h3 {
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--secondary); color: white; }

.input-group { margin-bottom: 1.5rem; }
.input-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-main); }
.input-group input, .input-group select, .input-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

/* Student Side Option Buttons */
.option-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    text-align: left;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    color: var(--text-main);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.option-btn:hover { border-color: var(--primary); background: #f8faff; transform: translateX(4px); }
.option-btn.selected { background: var(--primary); color: white; border-color: var(--primary); }

.option-label {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.selected .option-label { background: rgba(255, 255, 255, 0.2); color: white; }

/* KaTeX Adjustment */
.katex { font-size: 1.1em; }

/* Option Input Styling (Creation/Edit) */
.option-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: #fff;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    cursor: pointer;
}

.option-row:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.option-row.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.option-row input[type="radio"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Quill Styling Integration */
.ql-toolbar.ql-snow {
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    background: #f8fafc;
    border-radius: 8px 8px 0 0;
    opacity: 0;
    visibility: hidden;
    height: 0;
    padding: 0 !important;
    transition: all 0.2s ease;
}

.is-focused .ql-toolbar.ql-snow {
    opacity: 1;
    visibility: visible;
    height: auto;
    padding: 8px !important;
    margin-bottom: 4px;
}

/* Quill Tooltip Fix (Formula Bar) */
.ql-tooltip {
    z-index: 9999 !important;
    left: 10px !important;
    top: 0 !important;
}

.ql-container.ql-snow {
    border: none !important;
    font-family: inherit !important;
    overflow: visible !important; /* Ensure formula popup is not clipped */
}

.ql-editor {
    min-height: 40px;
    padding: 8px 0 !important;
    font-size: 1rem;
}

.ql-editor p, .option-content p, .question-text p {
    margin: 0 !important;
    padding: 0 !important;
}

.editor-container {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.2s;
}

.editor-container.is-focused {
    border-color: var(--primary);
}

/* Dashboard & Misc */
.badge { padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.875rem; font-weight: 500; }
.badge-draft { background: #fee2e2; color: #991b1b; }
.badge-ready { background: #dcfce7; color: #166534; }

.dashboard { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: #1e293b; color: white; padding: 2rem; }
.main-content { padding: 2rem; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease-out forwards; }
