/* ============ School Test Paper Generator — Admin theme ============ */
:root {
    --sidebar-width: 250px;
    --sidebar-bg: #1d3557;
    --sidebar-hover: #16283f;
    --accent: #457b9d;
    --content-bg: #f4f6f9;
}

body { background: var(--content-bg); font-size: .925rem; }

.admin-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width); min-width: var(--sidebar-width);
    background: var(--sidebar-bg); color: #dbe4ee;
    display: flex; flex-direction: column;
    transition: margin-left .2s ease;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-collapsed .admin-sidebar { margin-left: calc(-1 * var(--sidebar-width)); }
.sidebar-brand {
    padding: 1rem 1.25rem; font-weight: 600; font-size: 1rem; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center;
}
.sidebar-nav { padding: .75rem 0 2rem; }
.sidebar-nav .nav-heading {
    padding: .9rem 1.25rem .35rem; font-size: .68rem; text-transform: uppercase;
    letter-spacing: .08em; color: #8da4be;
}
.sidebar-nav .nav-item {
    display: flex; align-items: center; gap: .65rem;
    padding: .5rem 1.25rem; color: #dbe4ee; text-decoration: none; font-size: .875rem;
    border-left: 3px solid transparent;
}
.sidebar-nav .nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-item.active { background: var(--sidebar-hover); color: #fff; border-left-color: #e9c46a; }
.sidebar-nav .nav-item i { width: 1.1rem; text-align: center; }

/* Main area */
.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
    background: #fff; border-bottom: 1px solid #e3e6ea;
    padding: .6rem 1.25rem; display: flex; align-items: center;
    position: sticky; top: 0; z-index: 1020;
}
.admin-content { padding: 1.25rem; flex: 1; }
.admin-footer { padding: .75rem 1.25rem; border-top: 1px solid #e3e6ea; background: #fff; font-size: .8rem; color: #6c757d; }

.avatar-circle {
    width: 32px; height: 32px; border-radius: 50%; background: var(--sidebar-bg); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem;
}

/* Cards */
.card { border: 1px solid #e6e9ed; box-shadow: 0 1px 2px rgba(16,24,40,.04); border-radius: .5rem; }
.card-header { background: #fff; font-weight: 600; font-size: .875rem; }
.stat-card:hover { border-color: var(--accent); }

/* Auth */
.auth-body { background: linear-gradient(160deg, #1d3557 0%, #457b9d 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card-wrapper { width: 100%; max-width: 420px; }
.auth-card { border: 0; border-radius: .75rem; }

/* Stepper */
.stepper { display: flex; gap: .5rem; }
.stepper .step {
    flex: 1; display: flex; align-items: center; gap: .6rem; padding: .65rem .9rem;
    background: #fff; border: 1px solid #e3e6ea; border-radius: .5rem; color: #6c757d;
}
.stepper .step-number {
    width: 26px; height: 26px; border-radius: 50%; background: #e9ecef; color: #495057;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem;
}
.stepper .step.active { border-color: var(--sidebar-bg); color: var(--sidebar-bg); font-weight: 600; }
.stepper .step.active .step-number { background: var(--sidebar-bg); color: #fff; }
.stepper .step.completed { color: #2a9d8f; }
.stepper .step.completed .step-number { background: #2a9d8f; color: #fff; }

/* Dropzone */
.dropzone { border: 2px dashed #b9c2cc; border-radius: .5rem; background: #fafbfc; cursor: pointer; transition: all .15s; }
.dropzone.dragover, .dropzone:hover { border-color: var(--accent); background: #eef4f8; }

/* Tables */
.table > :not(caption) > * > * { padding-top: .55rem; padding-bottom: .55rem; }
.detail-table th { width: 40%; font-weight: 500; color: #6c757d; }

/* Rich text rendering */
.rich-text p:last-child { margin-bottom: 0; }
.rich-text table { border-collapse: collapse; }
.rich-text table td, .rich-text table th { border: 1px solid #adb5bd; padding: 2px 8px; }

/* Editor */
.editor-canvas { max-width: 1000px; }
.editor-question .q-number { min-width: 44px; }
.empty-section { padding: 1rem; color: #6c757d; text-align: center; font-size: .85rem; }

/* Mobile sidebar */
@media (max-width: 991.98px) {
    .admin-sidebar { position: fixed; z-index: 1040; left: calc(-1 * var(--sidebar-width)); height: 100vh; }
    .admin-sidebar.mobile-open { left: 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
    .sidebar-collapsed .admin-sidebar { margin-left: 0; }
}

/* Select2 sizing fix inside modals */
.select2-container { z-index: 1060; }
