/* ============================================================
   课程表生成器 —— 页面私有样式（/tool/schedule-gen）
   通用结构复用 tool-detail.css
   ============================================================ */

/* ---------- 设置区 ---------- */
.sg-setup {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid rgba(0, 21, 41, .08);
    border-radius: 14px;
    background: #fff;
    margin-bottom: 14px;
}

.sg-setup label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: #42526e;
}

.sg-setup input[type="text"],
.sg-setup select {
    padding: 7px 10px;
    border: 1px solid rgba(0, 21, 41, .14);
    border-radius: 8px;
    background: #f6f8fb;
    font-size: 14px;
    color: #14203a;
    outline: none;
}

.sg-setup input[type="text"]:focus,
.sg-setup select:focus {
    border-color: #0096dc;
    background: #fff;
}

#sgTitleInput { width: 200px; }

.sg-setup .sg-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.sg-hint {
    font-size: 12.5px;
    color: #7a8aa0;
    line-height: 1.7;
}

/* ---------- 课程表 ---------- */
.sg-table-card {
    border: 1px solid rgba(0, 21, 41, .08);
    border-radius: 14px;
    background: #fff;
    padding: 18px;
    overflow-x: auto;
}

.sg-title {
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    color: #14203a;
    margin-bottom: 14px;
    letter-spacing: .04em;
}

.sg-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 4px;
    table-layout: fixed;
    min-width: 720px;
}

.sg-table th.sg-corner {
    width: 74px;
    font-size: 11.5px;
    font-weight: 700;
    color: #7a8aa0;
}

.sg-table th.sg-day {
    padding: 8px 0;
    font-size: 14px;
    font-weight: 800;
    color: #14203a;
    background: #eef4fb;
    border-radius: 8px;
}

.sg-table th.sg-period {
    padding: 6px 4px;
    text-align: center;
    vertical-align: middle;
    background: #eef4fb;
    border-radius: 8px;
}

.sg-p-num {
    display: block;
    font-size: 17px;
    font-weight: 800;
    color: #0096dc;
    line-height: 1.2;
}

.sg-p-label {
    display: block;
    font-size: 10.5px;
    color: #7a8aa0;
}

.sg-cell {
    height: 64px;
    border: 1.5px dashed rgba(0, 21, 41, .14);
    border-radius: 8px;
    vertical-align: middle;
    text-align: center;
    cursor: pointer;
    padding: 4px;
    transition: transform .12s, box-shadow .12s;
}

.sg-cell:hover {
    border-style: solid;
    border-color: #0096dc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 150, 220, .14);
}

.sg-c-plus {
    display: block;
    font-size: 20px;
    color: rgba(0, 21, 41, .18);
    line-height: 52px;
}

.sg-cell.is-filled { border-style: solid; }

.sg-c-name {
    display: block;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.4;
    word-break: break-all;
}

.sg-c-sub {
    display: block;
    font-size: 11px;
    color: #5a6a80;
    line-height: 1.4;
    word-break: break-all;
}

/* 课程统计 chips */
.sg-stats {
    margin-top: 12px;
    font-size: 12.5px;
    color: #7a8aa0;
}

.sg-chip {
    display: inline-block;
    padding: 2px 10px;
    margin: 2px 4px 2px 0;
    border: 1px solid;
    border-radius: 999px;
    font-weight: 600;
}

/* ---------- 编辑弹层 ---------- */
.sg-editor {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 20, 40, .45);
    padding: 16px;
}

.sg-editor.is-open { display: flex; }

.sg-editor-box {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 18px 50px rgba(10, 20, 40, .3);
}

.sg-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.sg-editor-title {
    font-size: 15.5px;
    font-weight: 800;
    color: #14203a;
}

.sg-editor-pos {
    font-size: 12px;
    color: #0096dc;
    font-weight: 700;
    background: #eef4fb;
    padding: 3px 10px;
    border-radius: 999px;
}

.sg-field { margin-bottom: 12px; }

.sg-field label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: #42526e;
    margin-bottom: 5px;
}

.sg-field input {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid rgba(0, 21, 41, .14);
    border-radius: 8px;
    background: #f6f8fb;
    font-size: 14px;
    color: #14203a;
    outline: none;
    box-sizing: border-box;
}

.sg-field input:focus {
    border-color: #0096dc;
    background: #fff;
}

.sg-editor-btns {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.sg-editor-btns .btn { flex: 1; }

#sgEdDelete {
    flex: 0 0 auto !important;
    color: #e0447c;
    border-color: rgba(224, 68, 124, .4);
}

/* ---------- 黑夜模式 ---------- */
[data-theme="dark"] .sg-setup,
[data-theme="dark"] .sg-table-card,
[data-theme="dark"] .sg-editor-box {
    background: var(--c-surface, #1a2333);
    border-color: rgba(255, 255, 255, .08);
}

[data-theme="dark"] .sg-title,
[data-theme="dark"] .sg-table th.sg-day,
[data-theme="dark"] .sg-c-name { color: var(--c-text, #e8edf5); }

[data-theme="dark"] .sg-table th.sg-day,
[data-theme="dark"] .sg-table th.sg-period,
[data-theme="dark"] .sg-table th.sg-corner { background: rgba(255, 255, 255, .06); }

[data-theme="dark"] .sg-cell { border-color: rgba(255, 255, 255, .14); }

[data-theme="dark"] .sg-c-plus { color: rgba(255, 255, 255, .2); }

[data-theme="dark"] .sg-c-sub { color: #9aa8bd; }

[data-theme="dark"] .sg-p-num { color: #6cc3f0; }

[data-theme="dark"] .sg-p-label,
[data-theme="dark"] .sg-hint,
[data-theme="dark"] .sg-stats,
[data-theme="dark"] .sg-table th.sg-corner { color: #8fa0b8; }

[data-theme="dark"] .sg-setup label,
[data-theme="dark"] .sg-field label,
[data-theme="dark"] .sg-editor-title { color: var(--c-text, #e8edf5); }

[data-theme="dark"] .sg-setup input[type="text"],
[data-theme="dark"] .sg-setup select,
[data-theme="dark"] .sg-field input {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .12);
    color: #e8edf5;
}

/* ---------- 打印 ---------- */
@media print {
    @page { size: A4 landscape; margin: 10mm; }

    body { background: #fff !important; }

    .detail-wrap > .container > :not(.sg-print-area),
    nav.detail-breadcrumb,
    .back-to-top,
    .sg-setup,
    .sg-stats,
    .sg-hint { display: none !important; }

    .detail-wrap > .container { max-width: 100% !important; padding: 0 !important; }

    .sg-print-area { margin: 0 !important; padding: 0 !important; }

    .sg-table-card {
        border: none !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .sg-table { min-width: 0 !important; border-spacing: 2px; }

    .sg-cell {
        border: 1px solid #999 !important;
        border-radius: 4px !important;
        break-inside: avoid;
        box-shadow: none !important;
        transform: none !important;
    }

    .sg-cell .sg-c-plus { display: none !important; }
}
