/* เอกสารโรงเรียน: public list and open page (front/school_docs_public.php, front/school_docs_open.php).
   Standalone so it looks the same when another website shows it in an iframe. */
:root {
    --sdp-primary: #1d4ed8;
    --sdp-primary-dark: #1e3a8a;
    --sdp-text: #0f172a;
    --sdp-muted: #475569;
    --sdp-line: #e2e8f0;
    --sdp-soft: #f8fafc;
    --sdp-font: "Sarabun", "Noto Sans Thai", "Tahoma", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
.sdp-body { margin: 0; background: #eef2f7; color: var(--sdp-text); font-family: var(--sdp-font); font-size: 15px; line-height: 1.6; }
.sdp-body.is-embed { background: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sdp { max-width: 1040px; margin: 0 auto; padding: 28px 20px 24px; }
.is-embed .sdp { padding: 12px 10px 10px; }
.sdp a:focus-visible, .sdp button:focus-visible, .sdp input:focus-visible, .sdp summary:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* header */
.sdp-head { background: linear-gradient(135deg, var(--sdp-primary-dark), var(--sdp-primary)); color: #fff; border-radius: 16px; padding: 22px 26px; box-shadow: 0 10px 30px rgba(30, 58, 138, 0.18); }
.is-embed .sdp-head { padding: 14px 18px; border-radius: 12px; box-shadow: none; }
.sdp-org { margin: 0; font-size: 13.5px; font-weight: 600; color: #dbeafe; }
.sdp-title { margin: 2px 0 0; font-size: 26px; line-height: 1.3; font-weight: 700; }
.is-embed .sdp-title { font-size: 20px; }
.sdp-title-sub { display: block; font-size: 17px; font-weight: 600; color: #e0e7ff; }
.sdp-lead { margin: 8px 0 0; max-width: 760px; color: #e0e7ff; font-size: 14.5px; }
.sdp-stats { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.is-embed .sdp-stats { margin-top: 8px; }
.sdp-stats li { background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.24); border-radius: 999px; padding: 3px 12px; font-size: 13.5px; }
.sdp-stats strong { font-size: 15px; }

/* category tabs */
.sdp-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; }
.sdp-tabs a { padding: 7px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--sdp-line); color: var(--sdp-text); text-decoration: none; font-weight: 600; font-size: 14px; }
.sdp-tabs a[aria-current="page"] { background: var(--sdp-primary); border-color: var(--sdp-primary); color: #fff; }

/* tools */
.sdp-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 18px 0 6px; }
.sdp-search { flex: 1 1 320px; }
.sdp-search label { display: block; font-size: 13.5px; font-weight: 600; color: var(--sdp-muted); margin-bottom: 4px; }
.sdp-search-box { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #cbd5e1; border-radius: 12px; padding: 0 12px; }
.sdp-search-box:focus-within { border-color: var(--sdp-primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15); }
.sdp-search-box svg { width: 18px; height: 18px; fill: none; stroke: #64748b; stroke-width: 2; flex: 0 0 auto; }
.sdp-search-box input { flex: 1; border: 0; outline: none; background: transparent; font: inherit; padding: 10px 0; min-width: 0; color: var(--sdp-text); }
.sdp-search-box input:focus-visible { outline: none; }
.sdp-toggle { min-height: 44px; padding: 8px 16px; border-radius: 12px; border: 1px solid #cbd5e1; background: #fff; color: var(--sdp-text); font: inherit; font-weight: 600; cursor: pointer; }
.sdp-toggle:hover { background: var(--sdp-soft); }
.sdp-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sdp-count { margin: 4px 2px 10px; font-size: 13.5px; color: var(--sdp-muted); min-height: 1em; }

/* access pills */
.sdp-access { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; border-radius: 999px; padding: 2px 10px 2px 8px; font-size: 12.5px; font-weight: 600; }
.sdp-access svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.sdp-access.is-open { background: #dcfce7; color: #166534; }
.sdp-access.is-locked { background: #fef3c7; color: #92400e; }

/* schools */
.sdp-list { display: flex; flex-direction: column; gap: 10px; }
.sdp-school { background: #fff; border: 1px solid var(--sdp-line); border-radius: 14px; overflow: hidden; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
.sdp-school[open] { box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07); }
.sdp-school > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; min-height: 52px; }
.sdp-school > summary::-webkit-details-marker { display: none; }
.sdp-school > summary:hover { background: var(--sdp-soft); }
.sdp-school-name { flex: 1; font-weight: 700; font-size: 16px; }
.sdp-school-count { font-size: 13px; color: var(--sdp-muted); background: #f1f5f9; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.sdp-chevron { width: 20px; height: 20px; fill: none; stroke: #64748b; stroke-width: 2; transition: transform .15s ease; flex: 0 0 auto; }
.sdp-school[open] .sdp-chevron { transform: rotate(180deg); }
.sdp-docs { list-style: none; margin: 0; padding: 0 10px 10px; border-top: 1px solid #eef2f7; }
.sdp-doc { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-bottom: 1px solid #f1f5f9; }
.sdp-doc:last-child { border-bottom: 0; }
.sdp-type { flex: 0 0 46px; text-align: center; font-size: 12px; font-weight: 700; border-radius: 8px; padding: 6px 0; letter-spacing: .02em; }
.sdp-type.is-pdf { background: #fee2e2; color: #991b1b; }
.sdp-type.is-img { background: #ccfbf1; color: #115e59; }
.sdp-type.is-file { background: #e0e7ff; color: #3730a3; }
.sdp-doc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sdp-doc-main a { color: var(--sdp-primary-dark); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.sdp-doc-main a:hover { text-decoration: underline; }
.sdp-doc-meta { font-size: 12.5px; color: #64748b; }
.sdp-empty { background: #fff; border: 1px dashed #cbd5e1; border-radius: 14px; padding: 28px; text-align: center; color: var(--sdp-muted); }
.sdp-foot { margin-top: 18px; text-align: center; font-size: 12.5px; color: #64748b; }
.is-embed .sdp-foot { margin-top: 10px; }

@media (max-width: 600px) {
    .sdp { padding: 14px 10px 18px; }
    .sdp-head { padding: 16px 16px; border-radius: 12px; }
    .sdp-title { font-size: 21px; }
    .sdp-school > summary { padding: 12px 14px; }
    .sdp-access-text { display: none; }
    .sdp-access { padding: 4px 6px; }
    .sdp-legend .sdp-access { padding: 2px 10px 2px 8px; }
}
@media print {
    .sdp-tools, .sdp-count { display: none; }
    .sdp-school { break-inside: avoid; box-shadow: none; }
}

/* open page: a file that needs signing in (front/school_docs_open.php) */
.sdo-body { min-height: 100vh; }
.sdo-band { background: linear-gradient(135deg, var(--sdp-primary-dark), var(--sdp-primary)); color: #fff; text-align: center; padding: 26px 20px 92px; }
.sdo-band-org { margin: 0; font-size: 13.5px; font-weight: 600; color: #dbeafe; }
.sdo-band-cat { margin: 2px 0 0; font-size: 22px; font-weight: 700; }
.sdo { max-width: 520px; margin: -68px auto 0; padding: 0 16px 28px; }
.sdo-card { background: #fff; border-radius: 20px; box-shadow: 0 18px 44px rgba(15, 23, 42, 0.14); overflow: hidden; }
.sdo-file { display: flex; align-items: center; gap: 14px; padding: 18px 22px; background: var(--sdp-soft); border-bottom: 1px solid var(--sdp-line); }
.sdo-file-icon { position: relative; flex: 0 0 48px; height: 56px; display: grid; place-items: center; border-radius: 10px; }
.sdo-file-icon svg { position: absolute; inset: 6px 8px; width: 32px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.6; opacity: .45; }
.sdo-file-icon span { position: relative; font-size: 12px; font-weight: 800; letter-spacing: .03em; margin-top: 10px; }
.sdo-file-icon.is-pdf { background: #fee2e2; color: #991b1b; }
.sdo-file-icon.is-img { background: #ccfbf1; color: #115e59; }
.sdo-file-icon.is-file { background: #e0e7ff; color: #3730a3; }
.sdo-file-text { min-width: 0; }
.sdo-file-name { margin: 0; font-weight: 700; font-size: 16px; color: var(--sdp-text); overflow-wrap: anywhere; line-height: 1.45; }
.sdo-file-meta { margin: 2px 0 0; font-size: 13.5px; color: var(--sdp-muted); }
.sdo-body-inner { padding: 26px 28px 22px; text-align: center; }
.sdo-lock { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: #fef3c7; color: #92400e; box-shadow: 0 0 0 8px #fffbeb; }
.sdo-lock svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; }
.sdo-lock circle { fill: currentColor; stroke: none; }
.sdo-body-inner h1 { margin: 18px 0 6px; font-size: 21px; line-height: 1.35; }
.sdo-who { margin: 0 0 20px; color: var(--sdp-muted); font-size: 15px; }
.sdo-who strong { color: var(--sdp-text); }
.sdo-alert { margin: -6px 0 18px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.sdo-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; padding: 12px 18px; border-radius: 14px; background: var(--sdp-primary); color: #fff; font-weight: 700; font-size: 16.5px; text-decoration: none; box-shadow: 0 8px 20px rgba(29, 78, 216, 0.28); transition: background-color .15s ease, transform .1s ease; }
.sdo-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sdo-btn:hover { background: var(--sdp-primary-dark); transform: translateY(-1px); }
.sdo-btn:focus-visible, .sdo-back:focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }
.sdo-steps { list-style: none; margin: 18px 0 0; padding: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 22px; font-size: 13.5px; color: var(--sdp-muted); }
.sdo-steps li { display: inline-flex; align-items: center; gap: 8px; }
.sdo-step-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #dbeafe; color: var(--sdp-primary-dark); font-weight: 700; font-size: 12.5px; }
.sdo-back { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 12px 18px; border-top: 1px solid var(--sdp-line); color: var(--sdp-primary-dark); font-weight: 600; font-size: 14.5px; text-decoration: none; }
.sdo-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.sdo-back:hover { background: var(--sdp-soft); }
.sdo-foot { margin: 16px 0 0; text-align: center; font-size: 12.5px; color: #64748b; }
@media (max-width: 600px) {
    .sdo-band { padding: 20px 16px 84px; }
    .sdo-band-cat { font-size: 19px; }
    .sdo { padding: 0 12px 20px; }
    .sdo-file { padding: 16px; }
    .sdo-body-inner { padding: 22px 18px 18px; }
    .sdo-body-inner h1 { font-size: 19px; }
}
