:root {
    --bg: #edf2f6;
    --card: #ffffff;
    --text: #0b1f2a;
    --muted: #48616f;
    --line: #d6e1e8;
    --brand-900: #06587a;
    --brand-800: #0a6f93;
    --brand-700: #0b7ea5;
    --brand-600: #1996bc;
    --brand-500: #2ca9cb;
    --accent: var(--brand-800);
    --accent-2: var(--brand-500);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top right, #d8eef5 0%, transparent 34%),
        radial-gradient(circle at top left, #e5f7fb 0%, transparent 30%),
        var(--bg);
    color: var(--text);
}

.container { width: min(1100px, 92vw); margin: 0 auto; }
.narrow { max-width: 700px; padding: 2rem 0; }

.topbar {
    border-bottom: 1px solid #c8dce7;
    background: #ffffffee;
    backdrop-filter: blur(6px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--brand-900);
}
.brand-logo {
    width: 176px;
    height: auto;
    display: block;
}
.brand-text {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}
nav { display: flex; gap: 1rem; align-items: center; }
a { color: var(--brand-900); text-decoration: none; }
a:hover { text-decoration: underline; }
nav a {
    font-weight: 700;
}
.nav-accordion {
    position: relative;
}
.nav-accordion summary {
    list-style: none;
    cursor: pointer;
    font-weight: 700;
    color: var(--brand-900);
}
.nav-accordion summary::-webkit-details-marker { display: none; }
.nav-accordion-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.45rem);
    min-width: 190px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 14px 28px rgba(6, 88, 122, 0.16);
    padding: 0.3rem;
    z-index: 90;
}
.nav-accordion-menu a {
    display: block;
    padding: 0.46rem 0.56rem;
    border-radius: 8px;
    text-decoration: none;
}
.nav-accordion-menu a:hover {
    background: #edf7fb;
}

main { padding: 1.6rem 0 2.8rem; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.05rem 1.15rem;
    margin-bottom: 1rem;
    box-shadow: 0 12px 26px rgba(6, 88, 122, 0.08);
}
.narrow-card { max-width: 520px; margin-inline: auto; }

h1, h2 { margin: 0 0 0.7rem; }
p { margin: 0.4rem 0 0.8rem; }
label { display: block; margin-bottom: 0.65rem; }
input, textarea, select {
    width: 100%;
    padding: 0.58rem 0.62rem;
    margin-top: 0.22rem;
    border: 1px solid #bfd3df;
    border-radius: 10px;
    background: #fff;
}
input:focus, textarea:focus, select:focus {
    outline: 2px solid #b7e3ef;
    outline-offset: 0;
    border-color: var(--brand-600);
}
button, .button {
    display: inline-block;
    border: none;
    border-radius: 999px;
    padding: 0.56rem 0.92rem;
    background: linear-gradient(130deg, var(--brand-800), var(--brand-500));
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .button:hover {
    filter: brightness(1.03);
    text-decoration: none;
}

.link-btn { background: none; color: var(--brand-900); padding: 0; border-radius: 0; }
.inline { display: inline; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0.8rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.stack { display: flex; gap: 0.5rem; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 0.58rem; text-align: left; vertical-align: top; }
.accordion-course summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-weight: 800;
    font-size: 1.15rem;
}
.accordion-course summary::-webkit-details-marker { display: none; }
.accordion-course .accordion-body {
    margin-top: 0.75rem;
}

.error { color: #b91c1c; font-weight: 700; }
.success { color: #166534; font-weight: 700; }
.pill { background: #daf1f8; color: var(--brand-900); font-size: 0.78rem; padding: 0.18rem 0.5rem; border-radius: 999px; }
.muted { color: var(--muted); }
.content-text { line-height: 1.6; }
.comment { border-top: 1px solid var(--line); padding-top: 0.6rem; margin-top: 0.6rem; }
.lesson-list { padding-left: 1.4rem; }
.lesson-item { margin: 0.35rem 0; }
.module-sortable-list { display: flex; flex-direction: column; gap: 0.8rem; }
.module-sortable-list .module-card { margin-bottom: 0; }
.draggable-module { cursor: move; }
.module-drag-handle { margin-right: 0.35rem; }
.module-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
}
.module-title-edit-btn {
    padding: 0.2rem 0.55rem;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.2;
    background: #edf5f9;
    border: 1px solid #bfd3df;
    color: #0b3f59;
}
.module-title-input {
    min-width: 240px;
    width: min(60vw, 460px);
    max-width: 100%;
    padding: 0.35rem 0.45rem;
    border: 1px solid #8fc5da;
    border-radius: 8px;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text);
}
.sortable-lessons { list-style: none; padding-left: 0; }
.sortable-lessons .lesson-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #fff;
}
.sortable-lessons .lesson-item:hover { border-color: #d7e2ee; }
.draggable-lesson { cursor: move; }
.drag-handle {
    color: #64748b;
    font-weight: 700;
    letter-spacing: 1px;
    user-select: none;
}
.draggable-lesson.dragging {
    opacity: 0.6;
    border-color: #94a3b8;
    background: #f8fafc;
}
.draggable-module.dragging {
    opacity: 0.75;
    border-color: #94a3b8;
}
.rich-content p { margin: 0.4rem 0; }
.rich-content ul, .rich-content ol { padding-left: 1.2rem; }
.rich-content img {
    max-width: min(100%, 420px);
    width: auto;
    height: auto;
    border-radius: 10px;
    margin: 0.5rem 0;
    cursor: zoom-in;
}
.toolbar-label { margin-bottom: 0.2rem; font-weight: 600; }
.editor-toolbar { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.tool-btn {
    border: 1px solid #94a3b8;
    background: #fff;
    color: #0f172a;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
}
.tool-btn-danger {
    border-color: #f0b7b7;
    color: #8f1f1f;
    background: #fff5f5;
}
.tool-btn-danger:hover {
    background: #ffe9e9;
}
.danger-btn {
    background: linear-gradient(130deg, #b62a2a, #db4b4b);
    color: #fff;
}
.danger-btn:hover {
    filter: brightness(1.03);
}
.inline-editor {
    min-height: 180px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 0.65rem;
    background: #fff;
    margin-bottom: 0.65rem;
}
.inline-editor img {
    max-width: min(100%, 280px) !important;
    width: auto !important;
    height: auto !important;
    border-radius: 8px;
    margin: 0.35rem 0;
    cursor: zoom-in;
}
.hidden-input { display: none; }
.course-cover {
    width: min(100%, 300px);
    max-width: 300px;
    aspect-ratio: 16 / 9;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--line);
    margin: 0.2rem 0 0.7rem;
    object-fit: cover;
    display: block;
}
.course-cover.hero {
    width: min(100%, 360px);
    max-width: 360px;
    max-height: 202px;
}
.course-thumb {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--line);
    vertical-align: middle;
    margin-right: 0.5rem;
}
.course-line { display: flex; align-items: center; }
.profile-avatar {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--line);
    margin-bottom: 0.8rem;
}
.admin-logo-preview {
    width: min(100%, 320px);
    max-height: 120px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    padding: 0.6rem;
    margin-bottom: 0.8rem;
}
.certificate-card {
    max-width: 860px;
    margin-inline: auto;
    padding: 2rem 2.4rem;
    border: 2px solid #a9ccd9;
    background:
        linear-gradient(180deg, #ffffff, #f7fcff);
}
.certificate-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-800);
    font-weight: 700;
    text-align: center;
}
.certificate-title {
    font-size: 2.4rem;
    color: var(--brand-900);
    text-align: center;
    margin-bottom: 1.3rem;
}
.certificate-text { text-align: center; font-size: 1.05rem; }
.certificate-name {
    text-align: center;
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--brand-900);
    margin: 0.5rem 0;
}
.certificate-course {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0.4rem 0;
}
.certificate-meta {
    margin-top: 1.6rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}
.zoomable-image { cursor: zoom-in; }
.image-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.82);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 2rem;
}
.image-lightbox.open { display: flex; }
.image-lightbox img {
    max-width: min(92vw, 1400px);
    max-height: 88vh;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.45);
}
.scorm-frame {
    width: 100%;
    min-height: 72vh;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

@media (max-width: 768px) {
    nav { display: none; }
    .topbar-inner { justify-content: space-between; }
    .brand-logo { width: 144px; }
    .brand-text { display: none; }
    .certificate-meta { flex-direction: column; }
}
