/* Shared styles for the public library and its administrator workspace. */
:root { color-scheme: light; --green: #234b38; --muted: #5d7064; --border: #dce6d8; --yellow: #f5d66f; font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; color: #243a2c; background: #f7f9f4; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.65; }
a { color: var(--green); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:is(button, a, input, select, textarea):focus-visible { outline: 3px solid #977000; outline-offset: 3px; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: wait; opacity: .65; }
.skip-link { position: fixed; z-index: 10; left: 20px; top: 12px; transform: translateY(-200%); background: var(--green); color: white; padding: 10px 16px; border-radius: 8px; }
.skip-link:focus { transform: translateY(0); }
.materials-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 16px max(5%, calc((100vw - 1180px)/2)); background: white; border-bottom: 1px solid var(--border); }
.materials-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 750; line-height: 1.4; }
.materials-brand img { flex-shrink: 0; border-radius: 12px; object-fit: contain; }
.materials-brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: .04em; font-weight: 500; }
.materials-header nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.materials-header nav a { border-radius: 8px; padding: 9px 12px; font-size: 14px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.materials-header nav a:hover { background: #edf4e8; }
.materials-header nav .nav-admin { background: #fff6d8; }
.materials-main { max-width: 1180px; margin: auto; padding: 42px 28px 70px; }
.page-heading, .panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.page-heading { margin-bottom: 24px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.4; color: var(--green); }
h1 { margin: 0; font-size: clamp(28px, 4vw, 38px); }
h2 { margin: 0; font-size: 23px; }
h3 { margin: 8px 0; font-size: 19px; }
.eyebrow { color: #557448; font-size: 11px; letter-spacing: .13em; font-weight: 750; margin: 0 0 7px; }
.muted, .field-help { color: var(--muted); }
.muted { font-size: 14px; }
.panel { background: white; border: 1px solid var(--border); border-radius: 18px; padding: 28px; margin-top: 24px; }
.panel-heading { align-items: center; margin-bottom: 24px; }
.notice { padding: 13px 17px; border-radius: 10px; background: #edf4e8; color: #36582f; font-size: 14px; }
.notice[data-tone="error"], .form-status[data-tone="error"] { background: #fff0ed; color: #9a3124; }
.notice[data-tone="success"], .form-status[data-tone="success"] { color: #285c32; background: #eaf5e6; }
.form-status { margin: 12px 0; border-radius: 8px; padding: 0; min-height: 0; font-size: 14px; }
.form-status:not(:empty) { padding: 10px 12px; background: #f3f6ee; }
.login-panel { max-width: 510px; margin: 35px auto 0; padding: 32px; }
.login-mark { background: #faedbc; color: #775b16; border-radius: 9px; width: fit-content; padding: 6px 12px; margin-bottom: 17px; font-size: 12px; font-weight: 700; }
.login-help { margin-top: 25px; font-size: 13px; color: var(--muted); }
.login-help a { display: inline-block; }
label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 650; }
input, select, textarea { display: block; width: 100%; min-width: 0; border: 1px solid #becdbc; border-radius: 9px; background: white; color: #243a2c; padding: 11px 12px; }
textarea { resize: vertical; min-height: 95px; }
textarea + label, input + label, select + label { margin-top: 17px; }
form > label { margin-top: 19px; }
.required { margin-left: 5px; color: #6c7245; font-size: 11px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr); gap: 20px; }
.classification-fields { margin-top: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.course-fields { margin-top: 20px; }
.file-field { margin-top: 21px; padding: 18px; border: 1px dashed #a8bda1; border-radius: 11px; background: #fafcf7; }
input[type="file"] { border: 0; padding: 0; background: transparent; font-size: 14px; }
input[type="file"]::file-selector-button { padding: 9px 13px; border: 1px solid #a7ba9c; border-radius: 8px; background: #edf4e8; color: var(--green); margin-right: 13px; cursor: pointer; }
.field-help { margin: 7px 0 0; font-size: 12px; }
.upload-options { margin-top: 21px; align-items: end; grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr); }
.publish-note { margin: 0; padding: 11px 15px; background: #fff9e7; border-left: 3px solid #d5b75a; border-radius: 0 9px 9px 0; color: #6a561b; font-size: 13px; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 21px; }
.form-actions .muted { font-size: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 43px; padding: 9px 16px; border: 1px solid transparent; border-radius: 9px; text-decoration: none; font-size: 14px; font-weight: 650; }
.button.primary { background: var(--green); color: white; }
.button.primary:hover { background: #183c2a; }
.button.secondary { border-color: #a8bda9; background: white; color: var(--green); }
.button.secondary:hover { background: #edf4e8; }
.button.danger { border-color: #d7b5a9; background: white; color: #8a3b2b; }
.button.danger:hover { background: #fff0ed; }
.button.small { min-height: 38px; padding: 7px 12px; font-size: 13px; }
.badge { display: inline-block; white-space: nowrap; padding: 5px 10px; border-radius: 999px; font-size: 11px; font-weight: 650; }
.badge-draft { background: #fff3cc; color: #775b16; }
.badge-published { background: #e6f1df; color: #3f622f; }
.badge-removed { background: #e7eaed; color: #59656c; }
.badge-legacy { background: #f1f4ec; color: #5d7064; }
.badge-school { background: #edf4e8; color: #3f622f; }
.badge-semester { background: #fff3cc; color: #775b16; }
.badge-unclassified { background: #e7eaed; color: #59656c; }
.badge-material { background: #e6f1df; color: #3f622f; }
.badge-assignment { background: #fff3cc; color: #775b16; }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.filter-course { grid-column: span 2; }
.admin-materials-list { display: grid; gap: 14px; }
.admin-material { padding: 21px; background: #fbfcf9; border: 1px solid var(--border); border-radius: 13px; }
.admin-material.is-removed { background: #f2f4f5; border-color: #dfe4e7; }
.material-topline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.material-week { font-size: 12px; font-weight: 700; color: #5d7064; }
.material-description { font-size: 14px; white-space: pre-wrap; margin: 8px 0; }
.material-course-title { color: var(--green); font-size: 12px; font-weight: 650; line-height: 1.65; margin: 12px 0 6px; overflow-wrap: anywhere; }
.material-meta { font-size: 12px; color: var(--muted); margin: 8px 0; overflow-wrap: anywhere; }
.material-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.legacy-note { margin: 12px 0 0; color: #68745e; font-size: 12px; }
.empty-state { padding: 30px 16px; text-align: center; color: var(--muted); background: #f8faf5; border: 1px dashed var(--border); border-radius: 11px; }
progress { display: block; margin-top: 20px; width: 100%; height: 14px; accent-color: var(--green); }
dialog { width: min(570px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); border: 1px solid var(--border); border-radius: 18px; padding: 27px; overflow-y: auto; color: #243a2c; }
dialog::backdrop { background: #102f20a8; }
.dialog-heading { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-bottom: 22px; }
.icon-button { border: 0; border-radius: 7px; background: #edf4e8; color: var(--green); font-size: 26px; width: 36px; height: 36px; flex-shrink: 0; line-height: 1; }
.materials-footer { padding: 24px; border-top: 1px solid var(--border); text-align: center; color: var(--green); font-size: 13px; font-weight: 650; }
.materials-footer span { color: var(--muted); margin-left: 8px; font-size: 11px; font-weight: 400; }
.public-library-grid { display: grid; gap: 18px; margin-top: 24px; }
.public-material-card { display: flex; gap: 25px; align-items: flex-start; border: 1px solid var(--border); background: white; border-radius: 17px; padding: 25px; }
.material-cover { display: grid; place-items: center; align-content: center; gap: 10px; flex-shrink: 0; width: 122px; min-height: 145px; border-radius: 11px; background: #eef4e8; color: #47673b; }
.material-cover strong { font-size: 30px; line-height: 1; letter-spacing: -.03em; }
.material-cover span { font-size: 11px; font-weight: 700; }
.material-detail { min-width: 0; flex: 1; }
.material-detail :is(h2, h3) { font-size: 21px; margin: 8px 0; }
.material-detail p { margin: 8px 0; font-size: 14px; }
.material-detail .material-meta { font-size: 12px; }
.material-detail .material-course-title { font-size: 12px; }
.material-detail .button { margin-top: 9px; }
.public-intro { max-width: 750px; }
.public-filters { margin-top: 22px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.library-context-title { margin-top: 30px; font-size: 22px; }
@media (max-width: 960px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filter-search { grid-column: 1 / -1; } }
@media (min-width: 950px) { .public-library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .public-material-card { gap: 18px; } .material-cover { width: 92px; min-height: 132px; } }
@media (max-width: 720px) { .materials-header { flex-direction: column; align-items: flex-start; gap: 11px; padding: 15px 20px; } .materials-header nav { justify-content: flex-start; } .materials-header nav a { padding: 7px 9px; font-size: 13px; } .materials-main { padding: 30px 18px 50px; } .panel { padding: 21px; } .page-heading { flex-wrap: wrap; } .panel-heading { gap: 10px; flex-wrap: wrap; } .form-grid, .upload-options { grid-template-columns: minmax(0, 1fr); gap: 17px; } .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filter-search { grid-column: 1 / -1; } .public-filters { grid-template-columns: minmax(0, 1fr); } .public-filters .filter-course { grid-column: 1 / -1; } .public-material-card { gap: 16px; padding: 21px; } .material-cover { width: 75px; min-height: 112px; } .material-cover strong { font-size: 23px; } .material-detail :is(h2, h3) { font-size: 18px; } .admin-material { padding: 17px; } .login-panel { padding: 25px; } }
@media (max-width: 400px) { .public-material-card { flex-direction: column; } .material-cover { width: 100%; min-height: 70px; grid-auto-flow: column; align-content: center; justify-content: start; padding: 18px; } .materials-footer span { display: block; margin: 4px 0 0; } }
