@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette - Soft, modern, clean and institutional */
    --primary: #5c60f5; /* Royal Indigo */
    --primary-hover: #494cd9;
    --secondary: #10b981; /* Emerald Green */
    --secondary-hover: #059669;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    
    --background: linear-gradient(135deg, #f0f4ff 0%, #fdf2f8 50%, #fffbeb 100%);
    --surface: #ffffff; /* Solid White Card background */
    --surface-light: #f8fafc;
    
    --text-main: #0f172a; /* Dark Slate */
    --text-muted: #64748b; /* Slate 500 */
    --border: #e2e8f0; /* Light Slate Border */
    --border-light: #f1f5f9;
    
    /* Subject Colors */
    --color-historia: #f59e0b;
    --color-lenguaje: #f43f5e;
    --color-matematicas: #3b82f6;
    --color-ciencias: #10b981;
    
    /* Effects */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.01);
    --shadow-md: 0 4px 20px rgba(99, 102, 241, 0.04), 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 10px 30px rgba(99, 102, 241, 0.06), 0 8px 12px rgba(0, 0, 0, 0.03);
    --radius-sm: 0.375rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1.25rem;
    
    --transition: all 0.2s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--background);
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1; /* Slate 300 */
    border-radius: var(--radius-md);
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; /* Slate 400 */
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-right: 1px solid var(--border);
    padding: 2rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
    height: 100%;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    padding-left: 0.5rem;
}

.logo-icon-box {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #5c60f5, #7f56d9);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 10px rgba(92, 96, 245, 0.2);
}

.logo-container h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.025em;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: #475569;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    font-size: 0.9rem;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-item:hover {
    background-color: #f8fafc;
    color: var(--primary);
    transform: translateX(2px);
}

.nav-item.active {
    background-color: #eef2ff;
    color: #5c60f5;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    overflow: hidden;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-shrink: 0;
    background-color: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.6);
    padding: 1.5rem 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    z-index: 1;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background-color: #ffffff;
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: var(--transition);
}

.user-profile:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: #5c60f5;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
}

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

.btn-secondary {
    background-color: var(--surface-light);
    color: var(--text-main);
    border-color: var(--border-light);
}
.btn-secondary:hover {
    background-color: var(--border-light);
}

.btn-accent {
    background-color: var(--secondary);
    color: white;
}
.btn-accent:hover {
    background-color: var(--secondary-hover);
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}
.btn-danger:hover {
    background-color: #dc2626;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: rgba(92, 96, 245, 0.1);
    color: #5c60f5;
}

/* Cards / Grid (Dashboard) */
.subjects-section {
    background: none;
    border: none;
    box-shadow: none;
    padding: 1rem 0;
    flex-grow: 1;
    overflow-y: auto;
    z-index: 1;
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.subject-card {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-xl);
    padding: 2.25rem 1.5rem 1.75rem 1.5rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    border-radius: 6px 6px 0 0;
}

/* Color thematic per subject */
.subject-card[data-subject="Historia"]::before {
    background: var(--color-historia);
}
.subject-card[data-subject="Historia"]:hover {
    border-color: var(--color-historia);
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.08);
}
.subject-card[data-subject="Lenguaje"]::before {
    background: var(--color-lenguaje);
}
.subject-card[data-subject="Lenguaje"]:hover {
    border-color: var(--color-lenguaje);
    box-shadow: 0 10px 25px rgba(244, 63, 94, 0.08);
}
.subject-card[data-subject="Matemáticas"]::before {
    background: var(--color-matematicas);
}
.subject-card[data-subject="Matemáticas"]:hover {
    border-color: var(--color-matematicas);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.08);
}
.subject-card[data-subject="Ciencias Naturales"]::before {
    background: var(--color-ciencias);
}
.subject-card[data-subject="Ciencias Naturales"]:hover {
    border-color: var(--color-ciencias);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.08);
}

.subject-card:hover {
    transform: translateY(-5px);
    background-color: #ffffff;
}

/* Icons styling inside cards */
.card-icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.card-icon-historia {
    background-color: #fef3c7;
    color: #d97706;
}
.card-icon-lenguaje {
    background-color: #ffe4e6;
    color: #e11d48;
}
.card-icon-matematicas {
    background-color: #dbeafe;
    color: #2563eb;
}
.card-icon-ciencias {
    background-color: #d1fae5;
    color: #059669;
}

/* Bottom Pills for subjects */
.card-bottom-pill {
    margin-top: 0.75rem;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pill-historia { background-color: #fffbeb; color: #d97706; }
.pill-lenguaje { background-color: #fff1f2; color: #e11d48; }
.pill-matematicas { background-color: #eff6ff; color: #2563eb; }
.pill-ciencias { background-color: #ecfdf5; color: #059669; }

.subject-title {
    font-size: 1.15rem;
    margin-bottom: 0.15rem;
    color: var(--text-main);
    font-weight: 600;
}

.subject-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

/* Watermarks */
.watermark {
    position: absolute;
    z-index: 0;
    pointer-events: none;
}
.watermark-airplane {
    top: 12%;
    right: 22%;
    transform: rotate(-10deg);
}
.watermark-pencil {
    top: 25%;
    right: 4%;
    transform: rotate(20deg);
}
.watermark-globe {
    bottom: 2%;
    left: 2%;
    transform: rotate(5deg);
}
.watermark-beaker {
    bottom: 2%;
    right: 4%;
}

/* Sidebar decorative footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}
.sidebar-decor {
    max-width: 150px;
    height: auto;
}

/* ==========================================================================
   CREATOR VIEW STYLES
   ========================================================================== */

.creator-section {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    height: 100%;
    min-height: 0;
}

.creator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.75rem 1.25rem;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.creator-workspace {
    display: flex;
    gap: 1.5rem;
    flex-grow: 1;
    overflow: hidden;
    height: 0;
    min-height: 0;
}

/* Left Panel: Form */
.creator-form-panel {
    width: 45%;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: var(--shadow-md);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-control {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Image Upload Grid */
.image-upload-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.image-upload-box {
    position: relative;
    background-color: #ffffff;
    border: 1.5px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70px;
}

.image-upload-box:hover {
    border-color: var(--primary);
    color: var(--text-main);
}

.image-upload-box .file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.image-upload-box.has-file {
    border-style: solid;
    border-color: var(--secondary);
    background-color: rgba(16, 185, 129, 0.05);
    color: var(--secondary);
}

/* Symbols Gallery */
.symbols-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 0.5rem;
    background-color: #ffffff;
    border: 1px solid var(--border);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    max-height: 140px;
    overflow-y: auto;
}

.symbol-item {
    background-color: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    height: 38px;
}

.symbol-item:hover {
    border-color: var(--primary);
    background-color: rgba(99, 102, 241, 0.08);
    transform: scale(1.05);
}

.symbol-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Question List & Items */
.questions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.question-item {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.question-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-remove-question {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-question:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.question-row-inputs {
    display: flex;
    gap: 0.5rem;
}

.question-text-input {
    flex-grow: 1;
}

.question-points-input {
    width: 70px;
}

.question-image-select {
    width: 130px;
    font-size: 0.75rem;
}

/* Right Panel: Previsualización */
.creator-preview-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
}

/* A4 Container styling */
.a4-container {
    background-color: #ffffff;
    color: #000000;
    width: 100%;
    max-width: 595px; /* A4 Ratio */
    aspect-ratio: 1 / 1.4142;
    margin: 0 auto;
    padding: 2.5rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    font-size: 0.75rem;
    line-height: 1.4;
}

.a4-container h1, .a4-container h2, .a4-container h3, .a4-container h4, .a4-container p, .a4-container strong {
    color: #000000;
}

.school-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #000000;
    padding-bottom: 0.75rem;
}

.logo-placeholder {
    width: 60px;
    height: 60px;
    border: 1px dashed #666666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: #666666;
    text-align: center;
    border-radius: 4px;
}

.school-info {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.evaluation-title {
    text-align: center;
    margin-top: 0.5rem;
}

.evaluation-title h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.a4-student-info {
    border: 1px solid #000000;
    padding: 0.625rem;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.preview-images-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin: 0.25rem 0;
}

.preview-image-wrap {
    border: 1px solid #cccccc;
    padding: 0.25rem;
    border-radius: 4px;
    text-align: center;
    background-color: #fafafa;
}

.preview-image-wrap img {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
}

.preview-image-caption {
    font-size: 0.6rem;
    color: #555555;
    margin-top: 0.25rem;
    font-style: italic;
}

.a4-content {
    flex-grow: 1;
}

.preview-questions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-questions-notice {
    color: #666666;
    font-style: italic;
    text-align: center;
    margin-top: 3rem;
}

.preview-question-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-question-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.preview-question-image-box {
    text-align: center;
    margin: 0.25rem 0;
}

.preview-question-image-box img {
    max-width: 80%;
    max-height: 120px;
    object-fit: contain;
    border: 1px solid #eeeeee;
    padding: 0.15rem;
}

.preview-question-lines {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.preview-question-line {
    border-bottom: 1px dotted #888888;
    height: 1.2rem;
}

/* Glassmorphism utility */
.glass {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.4);
}

@media (max-width: 1024px) {
    .creator-workspace {
        flex-direction: column;
        overflow-y: auto;
    }
    
    .creator-form-panel {
        width: 100%;
        overflow-y: visible;
    }
    
    .creator-preview-panel {
        width: 100%;
        overflow-y: visible;
    }
    
    .a4-container {
        max-width: 100%;
    }
}

/* Spinner de carga */
.spinner-circle {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(245, 158, 11, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Nuevos tipos de preguntas - Formulario */
.question-type-select {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    height: 32px;
}

.item-options-editor {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--border-light);
}

.option-edit-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.option-edit-row input {
    flex-grow: 1;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
}

.item-image-uploader-box {
    margin-top: 0.5rem;
}

.matching-pairs-editor {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--border-light);
}

.matching-pair-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.matching-pair-row input {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
}

/* Nuevos tipos de preguntas - Previsualización A4 */
.preview-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-left: 1.25rem;
}

.preview-option-item {
    font-size: 0.7rem;
    color: #333333;
}

.preview-vf-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-vf-indicator {
    font-weight: bold;
    border: 1px solid #000000;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    flex-shrink: 0;
}

.preview-justification-line {
    margin-top: 0.4rem;
    padding-left: 1.5rem;
    font-style: italic;
    font-size: 0.65rem;
    color: #555555;
}

.preview-matching-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 0.75rem;
    position: relative;
}

.preview-matching-column {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.preview-matching-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.7rem;
}

.preview-matching-index {
    font-weight: bold;
    min-width: 18px;
}

.preview-matching-parenthesis {
    font-weight: bold;
    min-width: 25px;
}

.item-visual-support {
    text-align: center;
    margin: 0.5rem 0;
}

.item-visual-support img {
    max-width: 60%;
    max-height: 120px;
    object-fit: contain;
    border: 1px solid #cccccc;
    padding: 2px;
    border-radius: 4px;
}

.preview-completacion-text {
    line-height: 1.6;
    font-size: 0.7rem;
}

/* ==========================================================================
   PREVIEW TABS AND ANSWER KEY HIGHLIGHTS
   ========================================================================== */

.preview-tabs {
    display: inline-flex;
    background-color: #f1f5f9;
    padding: 0.2rem;
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
}

.preview-tab {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: var(--transition);
}

.preview-tab:hover {
    background-color: #ffffff;
    color: var(--text-main);
}

.preview-tab.active {
    background-color: #ffffff;
    color: var(--primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* A4 Section Formatting */
.a4-section-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: #000000 !important;
    margin-top: 1.5rem;
    margin-bottom: 0.35rem;
    border-bottom: 1.5px solid #000000;
    padding-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    justify-content: space-between;
}

.a4-section-instructions {
    font-size: 0.68rem;
    font-style: italic;
    color: #334155 !important;
    margin-bottom: 0.85rem;
    line-height: 1.45;
}

/* True/False Clean Row Layout */
.preview-vf-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.preview-vf-line {
    border-bottom: 1px solid #000000;
    width: 32px;
    height: 1.1rem;
    text-align: center;
    font-weight: 700;
    color: #15803d !important;
    font-size: 0.75rem;
    display: inline-block;
    flex-shrink: 0;
    margin-right: 0.25rem;
    padding-bottom: 1px;
}

/* Highlights for correct answers inside the A4 container */
.preview-correct-option {
    color: #15803d !important;
    font-weight: 700;
    background-color: #f0fdf4;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    border: 1px dashed #b91c1c;
}

.preview-correct-option-text {
    color: #15803d !important;
    font-weight: 700;
    background-color: #f0fdf4;
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    display: inline-block;
}

.preview-correct-completion-word {
    color: #1d4ed8 !important;
    font-weight: 700;
    text-decoration: underline;
    padding: 0 0.2rem;
}

.preview-correct-open-criteria {
    background-color: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-top: 0.4rem;
    font-style: italic;
    color: #475569 !important;
    font-size: 0.7rem;
    line-height: 1.4;
}

.preview-correct-matching-key {
    background-color: #eff6ff;
    border: 1px dashed #bfdbfe;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.4rem;
    font-size: 0.65rem;
    color: #1d4ed8 !important;
    font-weight: 600;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS (SCREENS <= 768px)
   ========================================================================== */

/* Toggle buttons styling (hidden on desktop) */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    padding: 0.5rem;
    margin-right: 0.25rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background-color: var(--border-light);
}

/* Sidebar overlay background */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    body {
        overflow: auto;
        height: auto;
    }

    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .sidebar-toggle {
        display: flex;
    }

    /* Fixed slide-out sidebar on mobile */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        box-shadow: var(--shadow-lg);
        background-color: #ffffff !important;
        border-right: 1px solid var(--border);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Main Content full width */
    .main-content {
        width: 100%;
        padding: 1rem;
        height: auto;
        overflow: visible;
    }

    .header {
        padding: 1rem;
        margin-bottom: 1.25rem;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    #header-text h1 {
        font-size: 1.25rem;
    }

    #header-text p {
        font-size: 0.8rem;
    }

    .user-profile {
        padding: 0.25rem 0.5rem;
    }

    .user-profile span {
        display: none; /* Hide user name on headers, only show avatar */
    }

    /* Creator workspace responsiveness */
    .creator-workspace {
        flex-direction: column;
        height: auto;
        overflow: visible;
        gap: 1rem;
    }

    .creator-form-panel, 
    .creator-preview-panel {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .creator-header {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    .creator-header .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Force inline grid columns to single column on mobile */
    .creator-form-panel [style*="grid-template-columns"],
    .creator-form-panel [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Autocomplete images or previews */
    .a4-container {
        padding: 1.25rem !important;
        aspect-ratio: auto !important;
        height: auto !important;
        min-height: 500px;
    }

    .preview-tabs {
        width: 100%;
        justify-content: center;
        margin-bottom: 1rem;
    }
}



