/* ==================================================================
   เทศบาลตำบลโพหัก — E-Service
   Design tokens: Modern Government / Clean / Minimal / Premium
   ================================================================== */

:root {
  --primary: #2E7D32;
  --primary-dark: #1B5E20;
  --secondary: #43A047;
  --accent: #81C784;
  --bg: #F7FFF7;
  --card: #FFFFFF;
  --gold: #E8D8A6;
  --text-main: #1D2B1E;
  --text-muted: #5B6B5C;
  --radius-lg: 24px;
  --radius-md: 18px;
  --shadow-soft: 0 8px 30px rgba(46, 125, 50, 0.12);
  --shadow-hover: 0 14px 40px rgba(46, 125, 50, 0.20);
  --font-th: 'Noto Sans Thai', 'Sarabun', system-ui, -apple-system, sans-serif;
  --header-height: 80px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary-dark);
  color: #fff;
  padding: 10px 16px;
  z-index: 999;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------
   Header — no menu, no navbar, just brand
   --------------------------------------------------------------- */
.site-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(46, 125, 50, 0.10);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 1.05rem; color: var(--primary-dark); }
.brand-text small { font-size: 0.8rem; color: var(--text-muted); }

/* ---------------------------------------------------------------
   Hero
   --------------------------------------------------------------- */
.hero {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(129, 199, 132, 0.35), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(67, 160, 71, 0.25), transparent 45%),
    var(--bg);
}
.hero::before, .hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.5;
  animation: float 10s ease-in-out infinite;
}
.hero::before {
  width: 260px; height: 260px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  top: -60px; left: -60px;
}
.hero::after {
  width: 320px; height: 320px;
  background: radial-gradient(circle, var(--secondary), transparent 70%);
  bottom: -80px; right: -80px;
  animation-delay: 2s;
}
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}
.hero-content { position: relative; z-index: 2; max-width: 640px; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(129, 199, 132, 0.18);
  color: var(--primary-dark);
  padding: 6px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--primary-dark);
  margin: 0 0 14px;
  font-weight: 800;
}
.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin: 0 0 36px;
}

/* Big single CTA button */
.btn-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 22px 52px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(27, 94, 32, 0.35), 0 0 0 0 rgba(129, 199, 132, 0.7);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  isolation: isolate;
}
.btn-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(27, 94, 32, 0.45), 0 0 0 10px rgba(129, 199, 132, 0.25);
}
.btn-cta:active { transform: translateY(-1px) scale(0.98); }
.btn-cta .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  transform: scale(0);
  animation: ripple-anim 0.6s ease-out;
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(4); opacity: 0; }
}
.hero-subnote {
  margin-top: 18px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------
   Footer
   --------------------------------------------------------------- */
.site-footer {
  background: linear-gradient(160deg, var(--primary-dark), #143d17);
  color: #E7F4E8;
  padding: 48px 24px 20px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 32px;
}
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-col h3 {
  font-size: 1rem;
  color: var(--gold);
  margin: 0 0 12px;
  font-weight: 600;
}
.footer-col p { margin: 0 0 8px; font-size: 0.92rem; color: #D9EAD9; }
.footer-col a { transition: color 0.2s ease; }
.footer-col a:hover { color: var(--gold); }
.map-frame { border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-soft); }
.footer-bottom {
  max-width: 1200px;
  margin: 32px auto 0;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  color: #B9D6BA;
}
.developed-by a { color: var(--gold); font-weight: 600; }
.developed-by a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------
   Generic page shell (used by services/form/status/pages other than homepage)
   --------------------------------------------------------------- */
.page-shell {
  max-width: 1000px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}
.page-heading { text-align: center; margin-bottom: 40px; }
.page-heading h1 { color: var(--primary-dark); font-size: 2rem; margin: 0 0 10px; }
.page-heading p { color: var(--text-muted); margin: 0; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 24px;
}
.back-link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------
   Service cards grid
   --------------------------------------------------------------- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 900px) { .service-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .service-grid { grid-template-columns: 1fr; } }

.service-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  border: 1px solid rgba(46,125,50,0.06);
}
.service-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(46,125,50,0.18);
}
.service-icon {
  width: 68px; height: 68px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  color: #fff;
  font-size: 1.6rem;
  box-shadow: 0 8px 18px rgba(67,160,71,0.35);
}
.service-card h3 { margin: 0 0 8px; font-size: 1.05rem; color: var(--text-main); }
.service-card p { margin: 0; font-size: 0.88rem; color: var(--text-muted); }

/* ---------------------------------------------------------------
   Step Form
   --------------------------------------------------------------- */
.form-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 36px;
}
@media (max-width: 600px) { .form-card { padding: 24px 18px; } }

.progress-track {
  display: flex;
  align-items: center;
  margin-bottom: 36px;
}
.progress-step {
  flex: 1;
  text-align: center;
  position: relative;
}
.progress-step .dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #E3EEE3;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 8px;
  font-weight: 700;
  transition: all 0.3s ease;
  border: 2px solid #E3EEE3;
}
.progress-step.active .dot,
.progress-step.done .dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.progress-step span.label { font-size: 0.78rem; color: var(--text-muted); }
.progress-step::after {
  content: '';
  position: absolute;
  top: 17px; right: -50%;
  width: 100%; height: 2px;
  background: #E3EEE3;
  z-index: -1;
}
.progress-step:last-child::after { display: none; }
.progress-step.done::after { background: var(--primary); }

.form-step { display: none; animation: fadeIn 0.35s ease; }
.form-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }
.form-group .req { color: #C62828; }
.form-control {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid #DCEBDC;
  border-radius: var(--radius-md);
  font-size: 0.98rem;
  font-family: inherit;
  background: #FBFFFB;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(46,125,50,0.12);
}
.form-control.is-invalid { border-color: #C62828; }
.field-error { color: #C62828; font-size: 0.82rem; margin-top: 4px; display: none; }
.field-error.show { display: block; }
textarea.form-control { resize: vertical; min-height: 110px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* Dropzone */
.dropzone {
  border: 2px dashed #BFE0BF;
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  background: #FBFFFB;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.dropzone.dragover { border-color: var(--primary); background: rgba(129,199,132,0.10); }
.dropzone i { font-size: 1.8rem; color: var(--secondary); margin-bottom: 8px; }
.file-preview-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.file-preview-item {
  display: flex; align-items: center; gap: 8px;
  background: #EAF6EA; border-radius: 12px; padding: 8px 12px; font-size: 0.85rem;
}
.file-preview-item button { border: none; background: none; color: #C62828; cursor: pointer; font-size: 0.9rem; }

.form-nav { display: flex; justify-content: space-between; margin-top: 32px; gap: 12px; }
.btn {
  padding: 13px 28px;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(46,125,50,0.3); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: rgba(46,125,50,0.06); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.autosave-note { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin-top: 14px; }

/* ---------------------------------------------------------------
   Status check + timeline
   --------------------------------------------------------------- */
.status-search { display: flex; gap: 12px; margin-bottom: 32px; }
@media (max-width: 560px) { .status-search { flex-direction: column; } }
.status-result { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); padding: 32px; }
.status-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.status-header h2 { margin: 0; font-size: 1.2rem; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; }
.badge-pending { background: #FFF3CD; color: #8A6D00; }
.badge-reviewing { background: #D6EAFE; color: #0B5ED7; }
.badge-approved { background: #DFF3E1; color: var(--primary-dark); }
.badge-rejected { background: #FBDADA; color: #B02A2A; }
.badge-completed { background: #E1E9FF; color: #3730A3; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li {
  position: relative;
  padding-left: 36px;
  padding-bottom: 28px;
  border-left: 2px solid #E3EEE3;
  margin-left: 10px;
}
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute;
  left: -11px; top: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #E3EEE3;
  border: 3px solid #fff;
}
.timeline li.active::before { background: var(--primary); }
.timeline .t-title { font-weight: 700; margin-bottom: 2px; }
.timeline .t-time { font-size: 0.8rem; color: var(--text-muted); }
.timeline .t-note { font-size: 0.88rem; color: var(--text-muted); margin-top: 4px; }

/* ---------------------------------------------------------------
   Skeleton loading
   --------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, #EAF3EA 25%, #F5FBF5 37%, #EAF3EA 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: 10px;
}
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------------------------------------------------------
   Utility: fade/slide reveal (works with AOS or plain IntersectionObserver)
   --------------------------------------------------------------- */
[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
[data-reveal].in-view { opacity: 1; transform: translateY(0); }

/* ---------------------------------------------------------------
   Admin (E-Office) shared shell — see admin/assets if extended further
   --------------------------------------------------------------- */
.admin-body { background: #F1F6F1; font-family: var(--font-th); margin: 0; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px;
  background: linear-gradient(180deg, var(--primary-dark), #12330F);
  color: #E7F4E8;
  padding: 24px 16px;
  position: sticky; top: 0; height: 100vh;
}
.admin-sidebar .brand-mini { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; padding: 0 8px; }
.admin-sidebar .brand-mini img { width: 36px; height: 36px; border-radius: 8px; }
.admin-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px; color: #CFE6D0;
  margin-bottom: 4px; font-size: 0.92rem; transition: background 0.2s ease;
}
.admin-nav a:hover, .admin-nav a.active { background: rgba(255,255,255,0.10); color: #fff; }
.admin-main { flex: 1; padding: 28px 32px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
@media (max-width: 1000px) { .admin-cards { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: #fff; border-radius: var(--radius-md); padding: 22px;
  box-shadow: var(--shadow-soft);
}
.stat-card .num { font-size: 1.8rem; font-weight: 800; color: var(--primary-dark); }
.stat-card .label { color: var(--text-muted); font-size: 0.86rem; }
.admin-table-wrap { background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-soft); overflow: hidden; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.admin-table th, table.admin-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid #EFF5EF; }
table.admin-table th { background: #F3FAF3; color: var(--primary-dark); font-weight: 700; }
table.admin-table tr:hover td { background: #FAFFFA; }

.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 20%, rgba(129,199,132,0.35), transparent 50%), var(--bg);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover); padding: 40px 32px; text-align: center;
}
.login-card img { width: 64px; margin: 0 auto 14px; }
.login-card h1 { font-size: 1.3rem; color: var(--primary-dark); margin: 0 0 6px; }
.login-card p.sub { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 26px; }
