/* Google Fonts: Inter (400,500,600,700) and Lato (700,900) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lato:wght@700;900&display=swap');

:root {
    /* Modern Premium Palette */
    --ink: #0f172a;
    /* Slate 900 */
    --ink-light: #334155;
    /* Slate 700 */
    --ink-muted: #64748b;
    /* Slate 500 */

    --surface: #f8fafc;
    /* Slate 50 */
    --surface-raised: #ffffff;
    --surface-sunken: #f1f5f9;
    /* Slate 100 */

    --border: #e2e8f0;
    /* Slate 200 */
    --border-strong: #cbd5e1;
    /* Slate 300 */

    --accent: #6366f1;
    /* Indigo 500 */
    --accent-hover: #4f46e5;
    /* Indigo 600 */
    --accent-subtle: #eef2ff;
    /* Indigo 50 */
    --accent-text: #4338ca;
    /* Indigo 700 */

    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-text: #047857;

    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;

    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-text: #b91c1c;

    --info: #0ea5e9;
    --info-bg: #f0f9ff;

    /* Typography */
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Lato', sans-serif;

    /* Spacing System */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;

    /* Layout */
    --sidebar-w: 280px;
    --sidebar-collapsed-w: 88px;
    --topbar-h: 64px;

    /* Sidebar theming (overridable por tenant) */
    --sidebar-bg: var(--ink);
    --sidebar-fg: #ffffff;
    --sidebar-fg-muted:   color-mix(in srgb, var(--sidebar-fg) 60%, var(--sidebar-bg));
    --sidebar-fg-subtle:  color-mix(in srgb, var(--sidebar-fg) 8%,  var(--sidebar-bg));
    --sidebar-border:     color-mix(in srgb, var(--sidebar-fg) 6%,  var(--sidebar-bg));
    --sidebar-footer-bg:  color-mix(in srgb, black 20%, var(--sidebar-bg));

    /* Effects */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-focus: 0 0 0 4px rgba(99, 102, 241, 0.2);

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 200ms;
}

/* Glassmorphism Classes */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animation Classes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeInUp 0.4s var(--ease) forwards;
}

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

html {
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--surface);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}

a:hover {
    color: var(--accent-hover);
}

::selection {
    background: var(--accent);
    color: #fff;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    color: var(--ink);
    line-height: 1.25;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.35rem;
    font-weight: 600;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.text-muted {
    color: var(--ink-muted);
}

.text-sm {
    font-size: 0.85rem;
}

/* ── Layout Components ── */
.layout-app {
    display: flex;
    min-height: 100vh;
    background: var(--surface);
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.3s var(--ease), transform 0.3s var(--ease);
    overflow-x: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-w);
}

.sidebar.collapsed>*,
.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .sidebar-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar-header {
    padding: var(--sp-4) var(--sp-4);
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--topbar-h);
}

.sidebar.collapsed .sidebar-header {
    flex-direction: column;
    padding: var(--sp-4) 0;
    gap: var(--sp-4);
}

.btn-sidebar-collapse {
    background: var(--sidebar-fg-subtle);
    border: none;
    color: var(--sidebar-fg-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sidebar-collapse:hover {
    background: color-mix(in srgb, var(--sidebar-fg) 12%, var(--sidebar-bg));
    color: var(--sidebar-fg);
}

.sidebar.collapsed #sidebarCollapseBtn svg {
    transform: rotate(180deg);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding-left: 8px;
    gap: 12px;
}

.sidebar-brand img {
    height: 44px;
    width: auto;
    filter: brightness(0) invert(1);
    transition: all 0.3s var(--ease);
    opacity: 0.98;
}

.brand-text {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--sidebar-fg);
    letter-spacing: -0.02em;
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.sidebar.collapsed .brand-text {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: translateX(10px);
}

.sidebar.collapsed .sidebar-brand {
    padding-left: 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-brand img {
    height: 36px;
}

.sidebar-logo {
    max-height: 40px;
    max-width: 140px;
    width: auto;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-4) var(--sp-3);
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
    display: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-fg-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--duration) var(--ease);
    text-decoration: none;
    position: relative;
}

.nav-link:hover {
    color: var(--sidebar-fg);
    background: var(--sidebar-fg-subtle);
}

.nav-item.active .nav-link {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    opacity: 0.8;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2px;
}

.nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 20px;
    height: 20px;
    opacity: 0.4;
    transition: transform 0.2s;
}

.nav-arrow svg {
    width: 14px;
    height: 14px;
    stroke-width: 3px;
}

.nav-item.active .nav-arrow {
    transform: rotate(90deg);
    opacity: 0.8;
}

.nav-children {
    padding: 4px 12px 8px 46px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link span:not(.nav-icon) {
    transition: opacity 0.2s, visibility 0.2s;
}

.sidebar.collapsed .nav-link span:not(.nav-icon) {
    opacity: 0;
    visibility: hidden;
    width: 0;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
}

.sidebar.collapsed .nav-link span:not(.nav-icon) {
    opacity: 0;
    visibility: hidden;
    width: 0;
    margin: 0;
}

.sidebar.collapsed .nav-icon {
    margin: 0;
}

.sidebar.collapsed .nav-children {
    display: none !important;
}

.sidebar.collapsed .user-info,
.sidebar.collapsed #logoutForm span {
    display: none;
}

.sidebar.collapsed .sidebar-footer {
    justify-content: center;
    padding: var(--sp-4) 0;
}

.nav-child-link {
    font-size: 0.875rem;
    color: color-mix(in srgb, var(--sidebar-fg) 40%, var(--sidebar-bg));
    padding: 6px 0;
    border-radius: 4px;
    transition: color 0.2s;
    text-decoration: none;
}

.nav-child-link:hover {
    color: var(--sidebar-fg);
}

.sidebar-footer {
    padding: var(--sp-4) var(--sp-5);
    background: var(--sidebar-footer-bg);
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sidebar-fg);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 0.75rem;
    color: color-mix(in srgb, var(--sidebar-fg) 40%, var(--sidebar-bg));
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.btn-logout {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-fg-subtle);
    color: var(--sidebar-fg-muted);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.btn-logout:hover {
    background: var(--danger);
    color: #fff;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    position: relative;
    transition: margin-left 0.3s var(--ease);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed-w);
}

.topbar {
    height: var(--topbar-h);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-8);
    position: sticky;
    top: 0;
    z-index: 90;
    overflow: hidden;
}

.sidebar-toggle {
    display: none;
    background: var(--surface-sunken);
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    color: var(--ink);
    border-radius: 10px;
}

.topbar-logo {
    display: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

.notifications-bell {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--ink-muted);
    transition: all 0.2s;
}

.notifications-bell:hover {
    background: var(--surface-sunken);
    color: var(--ink);
}

.notifications-bell .icon {
    font-size: 1.4rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 6px;
    text-transform: uppercase;
    white-space: nowrap;
    background: var(--surface-sunken);
    color: var(--ink-muted);
}

.badge-primary {
    background: var(--accent-subtle) !important;
    color: var(--accent-text) !important;
}

.badge-success {
    background: var(--success-bg) !important;
    color: var(--success-text) !important;
}

.badge-warning {
    background: var(--warning-bg) !important;
    color: var(--warning-text) !important;
}

.badge-danger {
    background: var(--danger-bg) !important;
    color: var(--danger-text) !important;
}

/* Notification specific */
.notifications-bell .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger) !important;
    color: #fff !important;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid #fff;
    transform: translate(25%, -25%);
    z-index: 1;
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px 6px 6px;
    border-radius: 14px;
    transition: background 0.2s;
    color: var(--ink);
    text-decoration: none;
}

.topbar-user:hover {
    background: var(--surface-sunken);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.user-meta .name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
}

.user-meta .role {
    font-size: 0.75rem;
    color: var(--ink-muted);
}

.page-content {
    padding: var(--sp-8) var(--sp-10);
    max-width: 1400px;
    margin: 0;
    flex: 1;
}

/* ── UI Components ── */
.flash-container {
    padding: 16px 40px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 500;
}

.alert-icon {
    font-size: 1.2rem;
}

.alert-content {
    flex: 1;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: rgba(239, 68, 68, 0.2);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: rgba(14, 165, 233, 0.2);
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    color: currentColor;
}

.alert-close:hover {
    opacity: 1;
}

.card {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: all 0.3s var(--ease);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
}

.card-body {
    padding: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    border: 1px solid transparent;
    text-decoration: none;
}

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

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

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

.btn-secondary {
    background: #fff;
    border-color: var(--border-strong);
    color: var(--ink-light);
}

.btn-secondary:hover {
    background: var(--surface-sunken);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

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

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: 10px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-light);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--ink);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

.form-input[type="file"] {
    padding: 10px 14px;
    cursor: pointer;
    color: var(--ink-muted);
}

.form-input[type="file"]::file-selector-button {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    background: var(--surface-sunken);
    color: var(--ink-light);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-right: 12px;
    transition: background 0.2s, border-color 0.2s;
}

.form-input[type="file"]::file-selector-button:hover {
    background: var(--border);
    border-color: var(--border-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
    background: #fff;
}

.form-input::placeholder {
    color: var(--ink-muted);
    opacity: 0.5;
}

/* ── Custom Tabs ── */
.tabs-container {
    margin-bottom: var(--sp-6);
}

.tabs-header {
    display: flex;
    gap: var(--sp-4);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--sp-6);
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-btn {
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--ink);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-panel {
    display: none;
    animation: fadeInUp 0.3s var(--ease);
}

.tab-panel.active {
    display: block;
}

/* ── Tables ── */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    background: var(--surface-sunken);
    padding: 14px 20px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
    vertical-align: middle;
}

.table tr:hover td {
    background: var(--accent-subtle);
}

.table tr:last-child td {
    border-bottom: none;
}

/* ── Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

/* ── Responsive 2-column grid ── */
.g2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-muted);
    margin-top: 4px;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    opacity: 0.3;
}

.stat-card:nth-child(2)::before {
    background: var(--success);
}

.stat-card:nth-child(3)::before {
    background: var(--warning);
}

.stat-card:nth-child(4)::before {
    background: var(--info);
}

/* ── Progress ── */
.progress {
    background: var(--surface-sunken);
    border-radius: 99px;
    height: 8px;
    overflow: hidden;
}

.progress-sm {
    height: 5px;
}

.progress-bar {
    height: 100%;
    border-radius: 99px;
    background: var(--accent);
    transition: width 600ms var(--ease);
}

.progress-bar.success {
    background: var(--success);
}

/* ── Badges ── */
.badge-pill {
    display: inline-flex;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-active,
.badge-published {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-draft,
.badge-pending {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.badge-inactive,
.badge-archived {
    background: var(--surface-sunken);
    color: var(--ink-muted);
}

.badge-suspended {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.badge-admin {
    background: var(--accent-subtle);
    color: var(--accent-text);
}

.badge-instructor {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-student {
    background: var(--surface-sunken);
    color: var(--ink-muted);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 0 3px var(--success-bg);
}

.status-dot.inactive {
    background: var(--border-strong);
}

.status-active    { background: var(--success); }
.status-inactive  { background: var(--gray-300, #d1d5db); }
.status-suspended { background: var(--danger); }
.status-pending   { background: var(--warning); }

/* ── Pagination ── */
.pagination {
    display: flex;
    gap: var(--sp-1);
    justify-content: center;
    margin-top: var(--sp-5);
}

.pagination a,
.pagination span {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border);
    color: var(--ink-light);
    transition: all var(--duration);
}

.pagination a:hover {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.pagination .active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: var(--sp-16) var(--sp-8);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--sp-4);
    opacity: 0.3;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink-light);
    margin-bottom: var(--sp-2);
}

.empty-state-text {
    color: var(--ink-muted);
    font-size: 0.9rem;
    margin-bottom: var(--sp-5);
    max-width: 360px;
    margin-inline: auto;
}

/* ── Course Cards ── */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--sp-5);
}

.course-card {
    transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}

.course-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.course-thumb {
    height: 140px;
    background: linear-gradient(135deg, var(--accent) 0%, #7209b7 100%);
    position: relative;
    overflow: hidden;
}

.course-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-badge {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.course-badge.published {
    background: rgba(6, 214, 160, 0.9);
    color: #fff;
}

.course-badge.draft {
    background: rgba(252, 163, 17, 0.9);
    color: #fff;
}

/* ── Wizard Steps ── */
.wizard-steps {
    display: flex;
    gap: var(--sp-2);
    margin-bottom: var(--sp-8);
    counter-reset: step;
}

.wizard-step {
    flex: 1;
    text-align: center;
    position: relative;
    padding: var(--sp-3) var(--sp-2);
}

.wizard-step::before {
    counter-increment: step;
    content: counter(step);
    display: flex;
    width: 32px;
    height: 32px;
    margin: 0 auto var(--sp-2);
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--surface-sunken);
    color: var(--ink-muted);
    border: 2px solid var(--border);
}

.wizard-step.active::before {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.wizard-step.done::before {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
    content: '✓';
}

.wizard-step-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.wizard-step.active .wizard-step-label {
    color: var(--accent);
}

/* ── Content Builder ── */
.content-module {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--sp-4);
    background: var(--surface-raised);
    overflow: hidden;
}

.content-module-header {
    padding: var(--sp-3) var(--sp-5);
    background: var(--surface-sunken);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.content-module-title {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.drag-handle {
    color: var(--ink-muted);
    cursor: grab;
    opacity: 0.4;
}

.lesson-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-5);
    border-bottom: 1px solid var(--border);
    transition: background var(--duration);
}

.lesson-item:last-child {
    border-bottom: none;
}

.lesson-item:hover {
    background: rgba(67, 97, 238, 0.02);
}

.lesson-icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.lesson-info {
    flex: 1;
}

.lesson-title {
    font-weight: 500;
    font-size: 0.9rem;
}

.lesson-meta {
    font-size: 0.78rem;
    color: var(--ink-muted);
    display: flex;
    gap: var(--sp-3);
    margin-top: 1px;
}

.lesson-actions {
    display: flex;
    gap: var(--sp-1);
    opacity: 0;
    transition: opacity var(--duration);
}

.lesson-item:hover .lesson-actions {
    opacity: 1;
}

/* ── Type Picker ── */
.type-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: var(--sp-3);
}

.type-option {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4) var(--sp-3);
    text-align: center;
    cursor: pointer;
    transition: all var(--duration);
}

.type-option:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.type-option.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
    box-shadow: var(--shadow-focus);
}

.type-option-icon {
    font-size: 1.8rem;
    margin-bottom: var(--sp-2);
}

.type-option-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-light);
}

/* ── Question Builder ── */
.option-row {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
    margin-bottom: var(--sp-2);
}

.option-row input[type="text"] {
    flex: 1;
}

.correct-toggle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all var(--duration);
}

.correct-toggle.active {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

/* ── Classroom ── */
.classroom-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--sp-5);
}

.classroom-sidebar {
    position: sticky;
    top: calc(var(--topbar-h) + var(--sp-4));
    align-self: start;
    max-height: calc(100vh - var(--topbar-h) - 40px);
    overflow-y: auto;
}

.classroom-lesson-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: all var(--duration);
    text-decoration: none;
    color: var(--ink-light);
}

.classroom-lesson-link:hover {
    background: var(--accent-subtle);
    text-decoration: none;
}

.classroom-lesson-link.completed {
    color: var(--success-text);
}

.classroom-lesson-link.current {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 600;
}

.classroom-lesson-link.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.lesson-status-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.lesson-status-icon.completed {
    background: var(--success-bg);
    color: var(--success-text);
}

.lesson-status-icon.in-progress {
    background: var(--accent-subtle);
    color: var(--accent);
}

.lesson-status-icon.not-started {
    background: var(--surface-sunken);
    color: var(--ink-muted);
    border: 1.5px solid var(--border);
}

/* ── Exam ── */
.exam-question-card {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--sp-6);
    margin-bottom: var(--sp-5);
    border: 1px solid var(--border);
}

.exam-option {
    padding: var(--sp-3) var(--sp-4);
    margin: var(--sp-2) 0;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--duration);
    font-size: 0.95rem;
}

.exam-option:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.exam-option.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
    box-shadow: var(--shadow-focus);
}

/* ── Backoffice badge ── */
.backoffice-badge {
    background: var(--warning);
    color: #000;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: var(--sp-2);
    font-family: var(--font-body);
}

/* ── Premium Auth Layout ── */
.layout-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #4f46e5, #050b33);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    padding: 20px;
}

.layout-auth::before {
    content: '';
    position: absolute;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2), transparent);
    top: -25vw;
    right: -25vw;
}

.auth-brand {
    text-align: center;
    margin-bottom: 40px;
    color: #fff;
}

.auth-logo-text {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 4px;
    background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0.6));
    outline: none;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-tagline {
    font-size: 0.85rem;
    opacity: 0.7;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 32px;
    padding: 48px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 10;
}

.auth-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 8px;
    text-align: center;
}

.auth-subtitle {
    font-size: 1rem;
    color: var(--ink-muted);
    margin-bottom: 32px;
    text-align: center;
    font-weight: 400;
}

.auth-form .btn {
    border-radius: 16px;
    font-weight: 700;
    letter-spacing: -0.5px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-form .btn:active {
    transform: scale(0.98);
}

.auth-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.auth-logo {
    max-height: 80px;
    max-width: 200px;
    width: auto;
    display: block;
    margin: 0 auto var(--sp-3);
    object-fit: contain;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--ink);
}

.auth-subtitle {
    font-size: 1rem;
    color: var(--ink-muted);
    margin-bottom: var(--sp-6);
    text-align: center;
}

.auth-links {
    text-align: center;
    margin-top: var(--sp-4);
}

.auth-links a {
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.auth-footer {
    text-align: center;
    margin-top: var(--sp-6);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

/* ── Interactive Type Cards ── */
.type-grid {
    display: grid;
    gap: var(--sp-4);
    margin: var(--sp-3) 0;
}

.type-card {
    cursor: pointer;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4);
    transition: all var(--duration) var(--ease);
    background: var(--surface-raised);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    user-select: none;
}

.type-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.type-card.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.type-card.selected::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--accent);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
}

.type-card-icon {
    font-size: 1.75rem;
    margin-bottom: var(--sp-2);
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-muted);
    transition: color var(--duration) var(--ease);
}

.type-card.selected .type-card-icon {
    color: var(--accent);
}

.type-card-label {
    font-weight: 600;
    color: var(--ink);
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.type-card-desc {
    font-size: 0.8rem;
    color: var(--ink-muted);
    line-height: 1.3;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .form-grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .classroom-layout {
        grid-template-columns: 240px 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .topbar-logo {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 1;
    }
    .topbar-logo img {
        height: 34px;
        width: auto;
        max-width: 120px;
        object-fit: contain;
        display: block;
    }
    .topbar-brand-text {
        font-size: 1.2rem;
        font-weight: 700;
        color: var(--ink);
        letter-spacing: -0.02em;
    }

    .btn-sidebar-collapse {
        display: flex;
    }
    .btn-sidebar-collapse svg {
        transform: none !important;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 99;
        background: rgba(0, 0, 0, 0.45);
    }
    .sidebar-overlay.active {
        display: block;
    }

    .page-content {
        padding: var(--sp-5);
    }

    .page-header {
        flex-direction: column;
    }

    .form-grid-2,
    .form-grid-3,
    .g2 {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .course-grid {
        grid-template-columns: 1fr;
    }

    .classroom-layout {
        grid-template-columns: 1fr;
    }

    .classroom-sidebar {
        position: static;
        max-height: none;
    }
}

/* ============================================================
   Utilities
   ============================================================ */

/* Layout */
.flex         { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; align-items: center; }
.flex-col     { display: flex; flex-direction: column; }
.hidden       { display: none; }

/* Spacing */
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
.mb-6 { margin-bottom: var(--sp-6); }
.p-0  { padding: 0; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

/* Typography */
.font-medium { font-weight: 500; }
.font-bold   { font-weight: 700; }
.text-center { text-align: center; }
.text-muted  { color: var(--ink-muted); }

/* Icons */
.icon-sm,
.icon-sm svg { width: 14px; height: 14px; }

/* ──────────────────────────────────────────────────────────
   Document Block Editor (instructor view)
   ────────────────────────────────────────────────────────── */
.doc-block-wrapper {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    gap: 6px;
    align-items: start;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 6px 4px;
    margin-bottom: 4px;
    transition: border-color 0.15s, background 0.15s;
}
.doc-block-wrapper:hover {
    border-color: var(--gray-200, #e5e7eb);
    background: var(--gray-50, #f9fafb);
}
.doc-block-wrapper.dragging {
    opacity: 0.45;
    border-color: var(--brand, #6366f1) !important;
    background: var(--accent-subtle, #eff6ff) !important;
}
.doc-block-wrapper.drag-over {
    border-color: var(--brand, #6366f1) !important;
    background: var(--accent-subtle, #eff6ff) !important;
    box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}
.doc-block-drag-handle {
    cursor: grab;
    color: var(--gray-300, #d1d5db);
    font-size: 1rem;
    padding-top: 7px;
    user-select: none;
    line-height: 1;
    transition: color 0.15s;
}
.doc-block-wrapper:hover .doc-block-drag-handle {
    color: var(--gray-400, #9ca3af);
}
.doc-block-content {
    min-width: 0;
}
.doc-block-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.doc-block-wrapper:hover .doc-block-controls {
    opacity: 1;
}
.doc-block-text {
    min-height: 48px;
    outline: none;
    line-height: 1.8;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.doc-block-text:empty::before {
    content: 'Escribe aquí...';
    color: var(--ink-muted, #9ca3af);
    font-style: italic;
    pointer-events: none;
}
.doc-block-download {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 8px;
    background: var(--gray-50, #f9fafb);
}

/* Inline Toolbar */
#docInlineToolbar {
    position: fixed;
    background: #1e293b;
    color: #fff;
    border-radius: 8px;
    padding: 5px 7px;
    display: none;
    gap: 3px;
    align-items: center;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
#docInlineToolbar button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
    line-height: 1;
}
#docInlineToolbar button:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* ──────────────────────────────────────────────────────────
   Document Block Viewer (student view)
   ────────────────────────────────────────────────────────── */
.doc-block-quick-check {
    border: 2px solid var(--brand-light, #93c5fd);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    background: var(--accent-subtle, #eff6ff);
}
.doc-block-quick-check .qc-trigger-btn {
    margin-top: 8px;
}

/* Quick Check Modal */
.qc-question {
    margin-bottom: 18px;
}
.qc-option-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 12px;
    border: 1.5px solid var(--gray-200, #e5e7eb);
    border-radius: 7px;
    cursor: pointer;
    margin-bottom: 6px;
    font-size: 0.9rem;
    transition: background 0.12s, border-color 0.12s;
}
.qc-option-label:hover {
    background: var(--gray-50, #f9fafb);
    border-color: var(--gray-300, #d1d5db);
}
.qc-option-label input[type="radio"] {
    margin-top: 2px;
    flex-shrink: 0;
}

/* ──────────────────────────────────────────────────────────
   Assignment submission (student view)
   ────────────────────────────────────────────────────────── */
#assignmentDropzone {
    border: 2px dashed var(--gray-300, #d1d5db);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
#assignmentDropzone:hover {
    border-color: var(--brand, #6366f1);
    background: var(--accent-subtle, #eff6ff);
}
#assignmentFileList > div {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 7px;
    margin-bottom: 6px;
    background: var(--gray-50, #f9fafb);
}

/* ──────────────────────────────────────────────────────────
   Assignment reference file dropzone (instructor view)
   ────────────────────────────────────────────────────────── */
#refDropzone {
    border: 2px dashed var(--gray-300, #d1d5db);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}
#refDropzone:hover {
    border-color: var(--brand, #6366f1);
}

/* ──────────────────────────────────────────────────────────
   ToC sidebar (student lesson view)
   ────────────────────────────────────────────────────────── */
.toc-link {
    transition: background 0.12s, color 0.12s;
}
.toc-link:hover {
    background: var(--gray-100, #f3f4f6) !important;
    color: var(--gray-900, #111827) !important;
}
@media (max-width: 768px) {
    #lessonToc { display: none !important; }
}

/* ──────────────────────────────────────────────────────────
   Lesson immersive mode (sidebar hidden)
   ────────────────────────────────────────────────────────── */
body.lesson-immersive .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
}
body.lesson-immersive .main-content {
    margin-left: 0 !important;
    transition: margin-left 0.25s cubic-bezier(0.4,0,0.2,1);
}
/* Smooth transition also when leaving immersive mode */
.sidebar {
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), width 0.25s;
}
.main-content {
    transition: margin-left 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ──────────────────────────────────────────────────────────
   Lesson fullscreen mode
   ────────────────────────────────────────────────────────── */
.lesson-fullscreen {
    position: fixed !important;
    inset: 0;
    z-index: 9000;
    background: var(--surface, #fff);
    overflow-y: auto;
    padding: 24px;
}
.lesson-fullscreen .container {
    max-width: none;
}
.lesson-fullscreen #lessonToc {
    position: sticky;
    top: 20px;
}

/* ── Smooth scroll for ToC anchor links ── */
html {
    scroll-behavior: smooth;
}

/* ── Lesson file preview (PDF iframe, image) ── */
.lesson-file-preview {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── Lesson main wrap: constrain max-width for focused reading ── */
#lessonMainWrap {
    max-width: 980px;
    margin: 0 auto;
}
body.lesson-immersive #lessonMainWrap {
    max-width: 1100px;
}

/* ── Document reader typography ── */
#docLessonContent {
    font-size: 1.02rem;
    color: var(--gray-800, #1e293b);
}
#docLessonContent h1, #docLessonContent h2, #docLessonContent h3 {
    scroll-margin-top: 90px;
}
#docLessonContent p {
    line-height: 1.85;
    margin-bottom: 1.1em;
}
#docLessonContent img {
    max-width: 100%;
    border-radius: 6px;
}

/* ── Fullscreen toggle: more discoverable ── */
#fullscreenToggle {
    opacity: 0.72;
    transition: opacity 0.18s, background 0.18s, transform 0.15s;
}
#fullscreenToggle:hover {
    opacity: 1;
    transform: scale(1.08);
}

/* ── Lesson header type badge ── */
.lesson-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--gray-100, #f3f4f6);
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--gray-700, #374151);
}

/* ── Responsive: PDF viewer height on mobile ── */
@media (max-width: 768px) {
    #lessonPdfFrame {
        height: 420px !important;
    }
    .lesson-file-preview iframe {
        height: 420px !important;
    }
}

/* ──────────────────────────────────────────────────────────
   Custom Checkboxes / Radio (form-check)
   ────────────────────────────────────────────────────────── */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--ink, #1e293b);
    padding: 4px 0;
    user-select: none;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid var(--border-strong, #cbd5e1);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    flex-shrink: 0;
}
.form-check input[type="radio"] {
    border-radius: 50%;
}
.form-check input[type="checkbox"]:checked {
    background: var(--brand, #6366f1);
    border-color: var(--brand, #6366f1);
}
.form-check input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}
.form-check input[type="radio"]:checked {
    background: var(--brand, #6366f1);
    border-color: var(--brand, #6366f1);
}
.form-check input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
}
.form-check input[type="checkbox"]:focus,
.form-check input[type="radio"]:focus {
    outline: 2px solid var(--brand, #6366f1);
    outline-offset: 2px;
}
.form-check input[type="checkbox"]:hover:not(:checked),
.form-check input[type="radio"]:hover:not(:checked) {
    border-color: var(--brand, #6366f1);
}
.form-check span {
    line-height: 1.4;
}

/* ──────────────────────────────────────────────────────────
   Block Editor Panel (full-width instructor view)
   ────────────────────────────────────────────────────────── */
.block-editor-panel {
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.block-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--gray-50, #f9fafb);
    border-bottom: 1px solid var(--gray-200, #e5e7eb);
}
.block-editor-toolbar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 10px 16px;
    border-bottom: 1px solid var(--gray-100, #f3f4f6);
    background: var(--gray-50, #f9fafb);
}
#docEditorCanvas {
    min-height: 440px;
    padding: 16px 20px;
    background: #fff;
}

/* ──────────────────────────────────────────────────────────
   Preview Modal
   ────────────────────────────────────────────────────────── */
#lessonPreviewModal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.55);
    overflow-y: auto;
    padding: 40px 20px;
}
#lessonPreviewModal .preview-dialog {
    max-width: 820px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}
