
/* study999-course-manager-v1 */

/* 普通课程页面不再展示容易误触的添加、移除按钮 */
#app .study999-original-course-action {
    display: none !important;
}

/* 课程导航：图标和文字一起包在椭圆形按钮内 */
.study999-course-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin: 12px 0 18px;
}

.study999-course-nav > button,
button.study999-course-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;

    width: auto !important;
    height: 38px !important;
    min-height: 38px !important;
    box-sizing: border-box !important;

    padding: 0 15px !important;
    margin: 4px 7px 4px 0 !important;

    border: 0 !important;
    border-radius: 999px !important;

    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    white-space: nowrap !important;

    box-shadow: 0 2px 6px rgba(15,23,42,.14) !important;
    cursor: pointer !important;
    vertical-align: middle !important;
}

button.study999-course-pill::before,
.study999-course-nav > button::before {
    display: inline-block !important;
    font-size: 18px !important;
    line-height: 1 !important;
}

/* 🗂️ 课程库：蓝色 */
button.study999-course-all,
.study999-course-nav > button[data-study999-nav="all"] {
    background: #2f80ed !important;
}

button.study999-course-all::before,
.study999-course-nav > button[data-study999-nav="all"]::before {
    content: "🗂️" !important;
}

/* 📚 我的课程：绿色 */
button.study999-course-mine,
.study999-course-nav > button[data-study999-nav="mine"] {
    background: #27ae60 !important;
}

button.study999-course-mine::before,
.study999-course-nav > button[data-study999-nav="mine"]::before {
    content: "📚" !important;
}

/* ⚙️ 编辑我的课程：紫色 */
button.study999-course-edit,
.study999-course-nav > button[data-study999-nav="edit"] {
    background: #8e44ad !important;
}

button.study999-course-edit::before,
.study999-course-nav > button[data-study999-nav="edit"]::before {
    content: "⚙️" !important;
}

button.study999-course-pill:not(:disabled):hover,
.study999-course-nav > button:not(:disabled):hover {
    filter: brightness(1.08);
}

button.study999-course-pill:focus-visible,
.study999-course-nav > button:focus-visible {
    outline: 3px solid #93c5fd !important;
    outline-offset: 3px;
}

/* 编辑页 */
#study999-course-editor .study999-editor-table {
    margin-top: 15px;
    border: 1px solid #dbe3ed;
    border-radius: 12px;
    overflow: hidden;
}

#study999-course-editor .study999-editor-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 9px 12px;
    border-bottom: 1px solid #e2e8f0;
}

#study999-course-editor .study999-editor-row:last-child {
    border-bottom: 0;
}

#study999-course-editor .study999-editor-head {
    min-height: 42px;
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
}

#study999-course-editor .study999-editor-name {
    min-width: 0;
    overflow-wrap: anywhere;
    color: #1e293b;
    font-weight: 600;
}

#study999-course-editor .study999-editor-action {
    display: flex;
    justify-content: flex-end;
}

#study999-course-editor button.study999-manage-action {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;

    width: 94px !important;
    height: 34px !important;
    padding: 0 8px !important;
    margin: 0 !important;

    border: 0 !important;
    border-radius: 9px !important;

    color: #fff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    cursor: pointer !important;
}

#study999-course-editor .study999-add-course {
    background: #2563eb !important;
}

#study999-course-editor .study999-delete-course {
    background: #dc2626 !important;
}

#study999-course-editor button.study999-manage-action:disabled {
    opacity: .55 !important;
    cursor: not-allowed !important;
}

/* 点击添加后，才弹出的课程选择窗口 */
#study999-course-editor dialog.study999-course-picker {
    width: min(520px, calc(100vw - 28px));
    max-height: 80vh;
    overflow: auto;
    box-sizing: border-box;

    padding: 22px;
    border: 1px solid #dbe3ed;
    border-radius: 14px;
    background: #fff;
    color: #1e293b;
    box-shadow: 0 18px 60px rgba(15,23,42,.2);
}

#study999-course-editor dialog.study999-course-picker::backdrop {
    background: rgba(15,23,42,.48);
}

#study999-course-editor .study999-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid #edf2f7;
    cursor: pointer;
}

#study999-course-editor .study999-picker-item input {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    accent-color: #2563eb;
}

#study999-course-editor .study999-picker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 18px;
}

#study999-course-editor .study999-picker-actions button {
    border-radius: 9px !important;
    padding: 9px 14px !important;
    font-weight: 700 !important;
}

#study999-course-editor .study999-picker-confirm {
    background: #2563eb !important;
    color: #fff !important;
}

#study999-course-editor .study999-picker-cancel {
    background: #e2e8f0 !important;
    color: #334155 !important;
}

@media (max-width: 420px) {
    #study999-course-editor .study999-editor-row {
        grid-template-columns: minmax(0, 1fr) 96px;
        gap: 6px;
        padding: 9px 8px;
    }

    #study999-course-editor button.study999-manage-action {
        width: 88px !important;
    }
}


/* study999-grouped-picker-v2 */

/* 大分类与下一大分类之间留出间距 */
#study999-course-editor .study999-picker-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#study999-course-editor .study999-picker-group {
    overflow: hidden;
    border: 1px solid #dbe3ed;
    border-radius: 11px;
    background: #ffffff;
}

/* 大分类：浅蓝背景、较大文字和方框 */
#study999-course-editor .study999-picker-category {
    display: flex;
    align-items: center;
    gap: 10px;

    min-height: 46px;
    padding: 8px 12px;

    background: #eff6ff;
    color: #172554;

    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;

    cursor: pointer;
}

#study999-course-editor .study999-picker-category-name {
    flex: 1;
    min-width: 0;
}

#study999-course-editor .study999-picker-count {
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* 小分类：固定三列，各列方框左边缘对齐 */
#study999-course-editor .study999-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 8px;
    row-gap: 4px;

    padding: 10px 12px 12px;
}

#study999-course-editor .study999-picker-grid
.study999-picker-item {
    display: flex;
    align-items: center;
    gap: 6px;

    min-width: 0;
    min-height: 32px;
    margin: 0;
    padding: 4px 0;

    border: 0;
    color: #334155;

    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;

    cursor: pointer;
}

#study999-course-editor .study999-picker-grid
.study999-picker-item span {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* 所有方框采用红色勾选标记 */
#study999-course-editor .study999-course-picker
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;

    position: relative;
    display: inline-grid;
    place-items: center;

    width: 18px;
    height: 18px;
    min-width: 18px;
    flex: 0 0 18px;

    box-sizing: border-box;
    margin: 0;
    padding: 0;

    border: 2px solid #64748b;
    border-radius: 4px;
    background: #ffffff;

    cursor: pointer;
}

/* 大分类方框稍大 */
#study999-course-editor .study999-course-picker
.study999-picker-category input[type="checkbox"] {
    width: 23px;
    height: 23px;
    min-width: 23px;
    flex-basis: 23px;
    border-width: 2px;
    border-radius: 5px;
}

/* 已选中：红色勾 */
#study999-course-editor .study999-course-picker
input[type="checkbox"]:checked,
#study999-course-editor .study999-course-picker
input[type="checkbox"]:indeterminate {
    border-color: #dc2626;
    background: #ffffff;
}

#study999-course-editor .study999-course-picker
input[type="checkbox"]:checked::after {
    content: "✓";
    color: #dc2626;
    font: 900 16px/1 Arial, sans-serif;
}

#study999-course-editor .study999-course-picker
.study999-picker-category
input[type="checkbox"]:checked::after {
    font-size: 21px;
}

/* 只选中部分小分类：大分类出现红色短横线 */
#study999-course-editor .study999-course-picker
input[type="checkbox"]:indeterminate::after {
    content: "";
    width: 11px;
    height: 3px;
    border-radius: 2px;
    background: #dc2626;
}

#study999-course-editor .study999-course-picker
input[type="checkbox"]:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
}

/* 超窄屏幕改为两列，避免课程名称过于拥挤 */
@media (max-width: 400px) {
    #study999-course-editor .study999-picker-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
