/* ══════════════════════════════════════════════════════════════
   DooDurian — Developer Documentation

   Lives in its own file (not a <style> block) so the page runs under
   the same `style-src 'self'` CSP as the rest of the service.
   Tokens come from styles.css.
   ══════════════════════════════════════════════════════════════ */

/* width:100% is load-bearing: <body> is a flex column, and the auto side
   margins here cancel the cross-axis stretch, so without it this box falls
   back to fit-content and the params table drags the whole page past 375px. */
.docs { display: flex; width: 100%; max-width: 1280px; margin: 0 auto; align-items: flex-start; }

.docs__sidebar {
  width: 240px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 32px 16px;
  position: sticky; top: 0;
  max-height: 100vh; overflow-y: auto;
}
.docs__sidebar h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-soft); margin: 24px 0 8px; font-weight: 600;
}
.docs__sidebar h4:first-child { margin-top: 0; }
.docs__sidebar ul { list-style: none; }
.docs__sidebar li { margin-bottom: 2px; }
.docs__sidebar a {
  display: block; padding: 7px 12px; border-radius: var(--r-sm);
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  transition: background-color .15s, color .15s;
}
.docs__sidebar a:hover, .docs__sidebar a.active {
  background: var(--green-soft); color: var(--green);
}

.docs__content { flex: 1; min-width: 0; padding: 40px 40px 64px; max-width: 820px; }
.docs__content h1 { font-size: 28px; line-height: 38px; margin-bottom: 10px; }
.docs__content h2 {
  font-size: 20px; margin-top: 48px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.docs__content h3 { font-size: 16px; margin-top: 28px; }
.docs__content p { color: var(--text-muted); margin: 12px 0; line-height: 24px; }
.docs__content ul, .docs__content ol { padding-left: 20px; list-style: disc; margin: 12px 0; }
.docs__content li { color: var(--text-muted); margin-bottom: 6px; line-height: 23px; }

.docs__intro-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }

.endpoint {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 20px 0 16px; font-size: 16px;
}
.endpoint__method {
  background: var(--green); color: #fff; padding: 4px 10px;
  border-radius: var(--r-sm); font-family: var(--font-mono);
  font-weight: 700; font-size: 13px;
}
.endpoint__path { font-family: var(--font-mono); color: var(--forest); }

.params-table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; }
.params-table th, .params-table td {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.params-table th {
  color: var(--text-soft); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
}
.params-table code {
  background: var(--surface); padding: 2px 6px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 13px; color: var(--forest);
}

.code-tabs { display: flex; gap: 2px; margin-bottom: -1px; position: relative; z-index: 1; }
.code-tab {
  padding: 8px 16px; border: 1px solid var(--border);
  border-bottom: none; border-radius: var(--r-sm) var(--r-sm) 0 0;
  background: var(--surface); font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
}
.code-tab.active { background: var(--forest); color: #fff; border-color: var(--forest); }

.code-example {
  background: var(--forest); color: rgba(255,255,255,.92);
  padding: 18px 20px; border-radius: 0 var(--r-md) var(--r-md) var(--r-md);
  font-family: var(--font-mono); font-size: 13px; line-height: 1.75;
  overflow-x: auto; white-space: pre;
  position: relative;
}
.code-example--rounded { border-radius: var(--r-md); }

/* Injected by docs.js into every sample. It sits inside the <pre> so the
   language tabs, which toggle `hidden` on the <pre>, take it with them. */
.code-copy {
  position: absolute; top: 10px; right: 10px;
  padding: 5px 11px; border-radius: var(--r-full);
  background: rgba(255,255,255,.14); color: #fff;
  border: 1px solid rgba(255,255,255,.28);
  font-family: inherit; font-size: 12px; line-height: 18px; font-weight: 600;
  cursor: pointer; opacity: .75; transition: opacity .15s, background-color .15s;
}
.code-example:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { background: rgba(255,255,255,.24); }
.code-copy:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.playground {
  border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 22px; background: var(--surface); margin-top: 20px;
}
.playground label {
  display: block; font-weight: 600; font-size: 13px;
  margin-bottom: 6px; color: var(--forest);
}
.playground input[type="text"],
.playground input[type="password"] {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-family: var(--font-mono); margin-bottom: 16px; background: var(--white);
}
.playground input[type="text"]:focus,
.playground input[type="password"]:focus { outline: none; border-color: var(--green); }
.playground input[type="file"] { margin-bottom: 16px; }
.pg-response { margin-top: 20px; }
.pg-response__header {
  display: flex; gap: 16px; margin-bottom: 8px;
  font-size: 13px; color: var(--text-soft);
}
.pg-response__header span { font-weight: 600; }

.keyreq {
  border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 22px; background: var(--surface); margin-top: 20px;
}
.keyreq .field { margin-bottom: 18px; }
.keyreq__opt { font-weight: 400; color: var(--text-soft); }
.keyreq__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.keyreq__result { margin-top: 4px; }
/* ฟอร์มถูกซ่อนหลังส่งสำเร็จ กล่องผลจึงเป็นของชิ้นเดียวในกรอบ ไม่ต้องเว้นบน */
.keyreq form[hidden] + .keyreq__result { margin-top: 0; }

@media (max-width: 900px) {
  .docs__sidebar { display: none; }
  .docs__content { padding: 28px 20px 48px; }
}

@media (max-width: 600px) {
  /* สองคอลัมน์บนมือถือทำให้ช่องแคบจนอ่าน placeholder ไม่จบ */
  .keyreq__row { grid-template-columns: 1fr; gap: 0; }
}
