/* styles.css — สไตล์ร่วมของระบบควบคุมเอกสาร CAP (public/*.html ทุกหน้า)
   โทนสีอ้างอิงจาก showcase/styles.css ให้ตรงกับ mockup ที่ออกแบบไว้ */

:root {
  --navy-900: #123a6b;
  --navy-800: #164280;
  --navy-700: #1c4f97;
  --accent: #1f5fd6;
  --accent-light: #e8f0fe;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --border: #e0e4ec;
  --text: #1a2233;
  --text-muted: #626b7e;
  --success-bg: #e6f4ea;
  --success-text: #1a7f4b;
  --warning-bg: #fdf1de;
  --warning-text: #9a5b0a;
  --danger-bg: #fbe9e8;
  --danger-text: #a3251f;
  --gray-bg: #eef0f4;
  --gray-text: #5b6478;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(11, 28, 51, 0.06), 0 1px 8px rgba(11, 28, 51, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "TH SarabunPSK", "Sarabun", "Segoe UI", Tahoma, sans-serif;
  min-height: 100vh;
}

body { display: flex; flex-direction: column; }

a { color: var(--accent); }

/* ---------- Header ---------- */
header {
  background: var(--navy-900);
  color: #fff;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

header h1 { margin: 0; font-size: clamp(1rem, 3.5vw, 1.4rem); }

header a, header button {
  background: var(--navy-700);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  font-size: 0.9rem;
}

header a:hover, header button:hover { background: var(--accent); }

/* ---------- Layout / Cards ---------- */
main { max-width: 900px; margin: 0 auto; padding: 1rem; width: 100%; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card h2 { color: var(--navy-900); font-size: 1.1rem; margin-top: 0; }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.9rem; font-weight: bold; margin: 0.9rem 0 0.3rem; }

input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

textarea { resize: vertical; min-height: 80px; }

small.hint { color: var(--text-muted); display: block; margin-top: 0.2rem; }

button.primary {
  margin-top: 1.5rem;
  background: var(--navy-900);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
}

button.primary:hover { background: var(--navy-700); }
button.primary:disabled { opacity: 0.6; cursor: not-allowed; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 0.8rem;
  display: block;
  text-align: center;
  width: 100%;
  font-family: inherit;
}

/* ---------- Messages / badges ---------- */
.msg { margin-top: 1rem; font-size: 0.9rem; }
.msg.error { color: var(--danger-text); }
.msg.ok { color: var(--success-text); background: var(--success-bg); border: 1px solid #b7e0bd; border-radius: 8px; padding: 0.7rem; }

.dev-note {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  background: var(--warning-bg);
  border: 1px solid #f2ddb0;
  color: var(--warning-text);
  border-radius: 6px;
  padding: 0.6rem;
  word-break: break-all;
}

.badge {
  display: inline-block;
  background: var(--warning-bg);
  color: var(--warning-text);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-size: 0.8rem;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); }
th { color: var(--navy-900); background: var(--gray-bg); }

/* ---------- Misc ---------- */
.center { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }

footer { text-align: center; padding: 1rem; font-size: 0.8rem; color: var(--text-muted); }
