/* =========================================================
   DGA Website Mockup — Shared Styles (ข้อเสนอ TOR DGA-69-0177)
   ใช้ร่วมกันทุกหน้า: design tokens + components
   ========================================================= */

@import url('design-tokens.css');

:root {
  --dga-navy: #1C164B;      /* สีหลัก */
  --dga-orange: #F05123;    /* สีส้มหลัก DGA (accent) */
  --dga-blue: #1073B8;      /* สีน้ำเงิน (รอง) */
  --dga-orange-light: #FF9933;
  --dga-blue-light: #E6F1F8;
  --text: #1C164B;
  --text-body: #2D2D2D;
  --text-muted: #595959;
  --text-faint: #707070;
  --bg: #fff;
  --bg-alt: #FAFAFA;
  --bg-soft: #F5F5F5;
  --border: #E5E7EB;
  --font: 'Prompt', -apple-system, 'Segoe UI', sans-serif;
  --container: 1280px;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-pill: 999px;
  --sh-sm: 0 2px 8px rgba(0,0,0,.06);
  --sh-md: 0 8px 24px rgba(0,0,0,.10);
  --sh-lg: 0 14px 40px rgba(0,0,0,.16);
  --fs-root: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--fs-root);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--text-body);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

:focus-visible {
  outline: 3px solid var(--dga-orange);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--dga-navy);
  color: #fff;
  padding: 12px 20px;
  z-index: 999;
  font-weight: 600;
}

.skip:focus {
  left: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

.center {
  text-align: center;
}

/* Utility bar */
.utilbar {
  background: var(--dga-navy);
  color: #fff;
  font-size: .82rem;
}

.utilbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  gap: 16px;
}

.utilbar .left {
  display: flex;
  gap: 18px;
  opacity: .92;
}

.utilbar .left a:hover {
  color: var(--dga-orange-light);
}

.utilbar .right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.util-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  border-radius: var(--r-pill);
  padding: 4px 12px;
  font-family: inherit;
  font-size: .82rem;
  cursor: pointer;
}

.util-btn:hover {
  background: rgba(255,255,255,.12);
}

.lang b {
  color: var(--dga-orange-light);
}

.fontsize {
  display: flex;
  gap: 4px;
  align-items: center;
}

.fontsize button {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255,255,255,.35);
  background: transparent;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.fontsize button:hover {
  background: rgba(255,255,255,.15);
}

/* Header / Nav */
header.site {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  box-shadow: var(--sh-sm);
}

.header-main .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 84px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.brand img {
  height: 52px;
  width: auto;
}

.brand .txt {
  display: none;
}

nav.main {
  display: flex;
  gap: 4px;
}

nav.main > a {
  padding: 8px 12px;
  border-radius: var(--r-pill);
  font-weight: 500;
  color: var(--dga-navy);
  font-size: .88rem;
  transition: .15s;
  white-space: nowrap;
}

nav.main > a:hover, nav.main > a.active {
  background: var(--dga-blue-light);
  color: var(--dga-blue);
}

nav.main > a.active {
  color: var(--dga-orange);
}

.menu-toggle {
  display: none;
  background: var(--dga-navy);
  color: #fff;
  border: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-size: 1.4rem;
  cursor: pointer;
}

/* Page hero / breadcrumb */
.page-hero {
  background: linear-gradient(120deg, var(--dga-navy) 0%, #2a1f6b 60%, var(--dga-blue) 100%);
  color: #fff;
  padding: 38px 0;
}

.page-hero h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem);
  font-weight: 700;
}

.page-hero p {
  opacity: .9;
  margin-top: 8px;
  max-width: 640px;
}

.breadcrumb {
  font-size: .85rem;
  opacity: .85;
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.breadcrumb a:hover {
  color: var(--dga-orange-light);
}

.breadcrumb span {
  opacity: .6;
}

/* Section */
.section {
  padding: 48px 0;
}

.section-head {
  margin-bottom: 28px;
}

.section-head.center {
  text-align: center;
}

.section-head .kicker {
  color: var(--dga-orange);
  font-weight: 600;
  letter-spacing: .04em;
  font-size: .85rem;
  text-transform: uppercase;
}

.section-head h2 {
  font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem);
  color: var(--dga-navy);
  font-weight: 700;
  margin-top: 6px;
}

.section-head p {
  color: var(--text-muted);
  margin-top: 6px;
}

.bg-soft {
  background: var(--bg-soft);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  font-size: .95rem;
  transition: .15s;
}

.btn-primary {
  background: var(--dga-orange);
  color: #fff;
}

.btn-primary:hover {
  background: #d43d11;
}

.btn-navy {
  background: var(--dga-navy);
  color: #fff;
}

.btn-navy:hover {
  background: #2a1f6b;
}

.btn-ghost {
  background: #fff;
  color: var(--dga-navy);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--dga-blue);
  color: var(--dga-blue);
}

/* Cards */
.card {
  background: #fff;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--sh-sm);
  transition: .18s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--sh-md);
}

.card .thumb {
  aspect-ratio: 600/315;
  overflow: hidden;
  background: var(--bg-alt);
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: .3s;
}

.card:hover .thumb img {
  transform: scale(1.05);
}

.card .body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.tag {
  align-self: flex-start;
  background: var(--dga-blue-light);
  color: var(--dga-blue);
  font-size: .72rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--r-pill);
}

.tag.act {
  background: #fff0eb;
  color: var(--dga-orange);
}

.tag.green {
  background: #e6f4ea;
  color: #2E7D32;
}

.card h3 {
  font-size: 1rem;
  color: var(--dga-navy);
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
}

.card .meta {
  font-size: .78rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* Layout with sidebar */
.with-side {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
}

.side {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px;
  position: sticky;
  top: 100px;
}

.side h3 {
  font-size: 1rem;
  color: var(--dga-navy);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--dga-blue-light);
}

.side .field {
  margin-bottom: 16px;
}

.side label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.side input, .side select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: .9rem;
}

.side input:focus, .side select:focus {
  outline: none;
  border-color: var(--dga-blue);
}

.side .chk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .88rem;
  padding: 4px 0;
}

/* Filter bar */
.filterbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 18px;
  margin-bottom: 24px;
}

.filterbar input, .filterbar select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: .9rem;
}

.filterbar input[type=search] {
  flex: 1;
  min-width: 200px;
}

/* Table (procurement) */
.dga-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--sh-sm);
}

.dga-table th {
  background: var(--dga-navy);
  color: #fff;
  text-align: left;
  padding: 14px 16px;
  font-size: .88rem;
  font-weight: 600;
}

.dga-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  vertical-align: top;
}

.dga-table tr:hover td {
  background: var(--dga-blue-light);
}

.dga-table .num {
  color: var(--text-faint);
  font-size: .82rem;
}

.dga-table a.title {
  color: var(--dga-navy);
  font-weight: 500;
}

.dga-table a.title:hover {
  color: var(--dga-orange);
}

.dl-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--dga-blue);
  font-weight: 600;
  font-size: .85rem;
}

.dl-link:hover {
  color: var(--dga-orange);
}

.amount {
  font-weight: 600;
  color: var(--dga-navy);
  white-space: nowrap;
}

/* Accordion (year groups) */
.accordion {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: #fff;
}

.accordion > summary {
  padding: 16px 20px;
  font-weight: 600;
  color: var(--dga-navy);
  cursor: pointer;
  background: var(--bg-alt);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion > summary::-webkit-details-marker {
  display: none;
}

.accordion > summary::after {
  content: "▾";
  color: var(--dga-blue);
}

.accordion[open] > summary::after {
  content: "▴";
}

.accordion .acc-body {
  padding: 6px 0;
}

/* Pagination */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 32px;
  flex-wrap: wrap;
}

.pagination a {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--dga-navy);
  font-weight: 500;
  padding: 0 12px;
}

.pagination a:hover {
  background: var(--dga-blue-light);
  border-color: var(--dga-blue);
}

.pagination a.active {
  background: var(--dga-navy);
  color: #fff;
  border-color: var(--dga-navy);
}

/* Forms */
.form-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 32px;
  box-shadow: var(--sh-sm);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 18px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-weight: 500;
  color: var(--dga-navy);
  margin-bottom: 7px;
  font-size: .92rem;
}

.form-group label .req {
  color: var(--dga-orange);
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: .95rem;
  transition: .15s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--dga-blue);
  box-shadow: 0 0 0 3px rgba(16,115,184,.12);
}

.form-group .hint {
  font-size: .8rem;
  color: var(--text-faint);
  margin-top: 5px;
}

.form-group.error input,
.form-group.error select,
.form-group.error textarea {
  border-color: var(--dga-orange);
}

.form-group.error .file-drop {
  border-color: var(--dga-orange);
  background: #fdecea;
}

.err {
  color: var(--dga-orange);
  font-size: .8rem;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.form-group.ok input {
  border-color: #2E7D32;
}

.file-drop {
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  padding: 26px;
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
  cursor: pointer;
}

.file-drop:hover {
  border-color: var(--dga-blue);
  background: var(--dga-blue-light);
}

.steps {
  display: flex;
  gap: 0;
  margin-bottom: 30px;
  counter-reset: s;
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
  font-size: .85rem;
  color: var(--text-faint);
}

.step::before {
  counter-increment: s;
  content: counter(s);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border);
  color: #fff;
  margin: 0 auto 8px;
  font-weight: 600;
}

.step.active::before {
  background: var(--dga-orange);
}

.step.done::before {
  background: #2E7D32;
  content: "✓";
}

.step.active, .step.done {
  color: var(--dga-navy);
  font-weight: 500;
}

.step::after {
  content: "";
  position: absolute;
  top: 18px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: -1;
}

.step:first-child::after {
  display: none;
}

/* Service category cards */
.svc-cat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 26px;
  box-shadow: var(--sh-sm);
  transition: .18s;
}

.svc-cat:hover {
  transform: translateY(-5px);
  box-shadow: var(--sh-md);
  border-color: var(--dga-blue);
}

.svc-cat .ic {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--dga-navy), var(--dga-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 14px;
}

.svc-cat h3 {
  color: var(--dga-navy);
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.svc-cat ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.svc-cat li a {
  font-size: .9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.svc-cat li a::before {
  content: "→";
  color: var(--dga-blue);
}

.svc-cat li a:hover {
  color: var(--dga-orange);
}

/* Alerts / Notices */
.alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px;
  border-radius: var(--r-sm);
  font-size: .9rem;
  border-left: 4px solid;
}

.alert .ic {
  font-size: 1.1rem;
  line-height: 1.3;
}

.alert-info {
  background: var(--dga-blue-light);
  border-color: var(--dga-blue);
  color: #0d4a76;
}

.alert-success {
  background: #e6f4ea;
  border-color: #2E7D32;
  color: #1b5e20;
}

.alert-warning {
  background: #fff4e5;
  border-color: #B26A00;
  color: #7a4a00;
}

.alert-error {
  background: #fdecea;
  border-color: var(--dga-orange);
  color: #8c1a1f;
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle .track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: var(--r-pill);
  transition: .2s;
  cursor: pointer;
}

.toggle .track::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
  box-shadow: var(--sh-sm);
}

.toggle input:checked + .track {
  background: var(--dga-orange);
}

.toggle input:checked + .track::before {
  transform: translateX(22px);
}

.toggle input:focus-visible + .track {
  outline: 3px solid var(--dga-orange);
  outline-offset: 2px;
}

/* Radio / checkbox pill */
.radio-row {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: .92rem;
}

.radio-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--dga-orange);
}

/* Icon (inline svg) sizing */
.ico-svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn .ico-svg {
  width: 18px;
  height: 18px;
}

/* Footer */
footer.site {
  background: var(--dga-navy);
  color: #cfc9e6;
  font-size: .9rem;
}

.footer-top {
  padding: 48px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
}

footer h4 {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 16px;
  font-weight: 600;
}

footer .fcol a {
  display: block;
  padding: 5px 0;
  color: #cfc9e6;
  transition: .15s;
}

footer .fcol a:hover {
  color: var(--dga-orange-light);
}

footer .brand-f img {
  height: 50px;
  margin-bottom: 14px;
  filter: brightness(0) invert(1);
}

footer .brand-f p {
  font-size: .85rem;
  line-height: 1.5;
  opacity: .85;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.15);
  padding: 18px 0;
  font-size: .8rem;
  opacity: .8;
}

.footer-bottom .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* Ask AI + cookie */
.ai-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(120deg, var(--dga-orange), #ff7e54);
  color: #fff;
  border: 0;
  padding: 14px 22px;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--sh-lg);
  transition: transform 0.2s ease, background 0.2s ease;
}

.ai-fab:hover {
  transform: scale(1.04);
}

.ai-fab .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7CFC9A;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(124,252,154,.6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(124,252,154,0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(124,252,154,0);
  }
}

@media (min-width: 1280px) and (max-width: 1400px) {
  .header-main .container {
    gap: 12px;
  }
  nav.main {
    gap: 2px;
  }
  nav.main > a {
    padding: 6px 8px;
    font-size: 0.8rem;
  }
  .brand .txt {
    display: none;
  }
  .header-search-input {
    width: 100px;
  }
  .header-search-input:focus {
    width: 140px;
  }
  .mockup-nav-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
}

/* Responsive */
@media(max-width: 1279px) {
  nav.main {
    display: none;
  }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .with-side {
    grid-template-columns: 1fr;
  }
  .side {
    position: static;
  }
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media(max-width: 768px) {
  .utilbar .left {
    display: none;
  }
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .spotlight {
    grid-template-columns: 1fr !important;
  }
  .card[style*="row"] {
    flex-direction: column !important;
  }
  .card[style*="row"] .thumb {
    flex: none !important;
    width: 100%;
    aspect-ratio: 600/315 !important;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .brand .txt {
    display: none;
  }
  .header-main .container {
    height: 68px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .ai-fab span {
    display: none;
  }
  .dga-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* Accessibility Toolbar Mobile Optimizations */
  .a11y-bar .a11y-container {
    justify-content: center;
    gap: 8px;
  }
  .a11y-bar .a11y-container .a11y-group {
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .a11y-bar .a11y-container .a11y-btn {
    padding: 4px 8px !important;
    font-size: 0.74rem !important;
  }
}

/* Custom DGA SVG Icon helper classes */
.dga-icon {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.dga-icon.fill-current {
  fill: currentColor;
  stroke: none;
}

/* Custom DGA SVGs */
.dga-svg-icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* For inline links */
.link-btn .dga-svg-icon {
  margin-right: 4px;
}

/* For larger alert/special icons */
.alert .ic .dga-svg-icon {
  width: 1.3em;
  height: 1.3em;
  vertical-align: -0.25em;
}

