/* =============================================
   E-Services อบต.บ่อแก้ว - Main Stylesheet
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #1a4fa0;
  --primary-dark: #0d3278;
  --primary-light: #2563c4;
  --secondary: #e8631a;
  --accent: #3b82f6;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --bg: #f0f4f8;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 2px 12px rgba(26,79,160,0.08);
  --radius: 14px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Sarabun', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

/* ---- Navbar ---- */
.navbar {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: #fff;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
}
.navbar-brand .logo-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.navbar-brand .brand-text { line-height: 1.2; }
.navbar-brand .brand-main { font-size: 14px; font-weight: 600; }
.navbar-brand .brand-sub { font-size: 11px; opacity: 0.8; }
.navbar-menu { display: flex; gap: 8px; align-items: center; }
.navbar-menu a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s;
}
.navbar-menu a:hover { background: rgba(255,255,255,0.15); color: #fff; }
.btn-manual {
  background: rgba(255,255,255,0.18) !important;
  border: 1px solid rgba(255,255,255,0.3) !important;
  color: #fff !important;
  font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}

/* ---- Hero / Banner ---- */
.hero-banner {
  background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  padding: 32px 24px;
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 300px; height: 300px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.hero-banner::after {
  content: '';
  position: absolute;
  right: 60px; bottom: -80px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}
.hero-content {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.hero-title {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 4px;
}
.hero-title .icon-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  width: 28px; height: 28px;
}
.hero-title .icon-grid span {
  background: rgba(255,255,255,0.7);
  border-radius: 2px;
  display: block;
}
.hero-subtitle { color: rgba(255,255,255,0.85); font-size: 14px; margin-left: 40px; }
.hero-actions { margin-top: 16px; margin-left: 40px; }
.btn-manual-hero {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.2);
  border: 1.5px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 8px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}
.btn-manual-hero:hover { background: rgba(255,255,255,0.3); color: #fff; }

/* ---- Container ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- Services Grid ---- */
.services-section {
  background: #fff;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.service-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: all 0.25s;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.service-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(26,79,160,0.12);
  transform: translateY(-2px);
}
.service-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  color: #fff;
}
.ic-assistance { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.ic-water      { background: linear-gradient(135deg, #0891b2, #06b6d4); }
.ic-child      { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.ic-tree       { background: linear-gradient(135deg, #16a34a, #22c55e); }
.ic-garbage    { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.ic-electric   { background: linear-gradient(135deg, #ea580c, #f97316); }
.ic-queue      { background: linear-gradient(135deg, #7c3aed, #6366f1); }

.service-card .service-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}
.service-card .service-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  transition: background 0.2s;
}
.service-card:hover .service-btn { background: var(--primary-dark); }
.service-card .service-btn.btn-queue { background: #7c3aed; }

/* ---- Form Page ---- */
.form-page { padding: 24px 0; }
.form-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 32px 24px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.form-header::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.form-header-icon {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.18);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  margin: 0 auto 12px;
}
.form-header h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.form-header p { font-size: 13px; opacity: 0.85; }

.form-wrapper {
  background: #fff;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ---- Form Sections ---- */
.form-section {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--border);
}

/* ---- Form Fields ---- */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.form-group input,
.form-group select,
.form-group textarea {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 15px;
  font-family: 'Sarabun', sans-serif;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-group input::placeholder,
.form-group select::placeholder,
.form-group textarea::placeholder {
  color: #c0cfe0;
}
.form-group textarea { resize: vertical; min-height: 100px; }

/* ---- File Upload ---- */
.file-upload-group { margin-bottom: 12px; }
.file-upload-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.file-upload-label .file-icon { font-size: 15px; }
.file-upload-limit { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.file-input-wrap {
  display: flex; align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f8fafc;
}
.file-input-wrap input[type="file"] {
  border: none; background: transparent;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text-muted);
  flex: 1;
}

/* ---- Agreement ---- */
.agreement-box {
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.agreement-box label {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px;
  cursor: pointer;
}
.agreement-box input[type="checkbox"] {
  width: 16px; height: 16px;
  margin-top: 2px; flex-shrink: 0;
  accent-color: var(--primary);
}
.agreement-text { font-weight: 600; color: var(--primary-dark); }
.agreement-note { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---- Captcha ---- */
.captcha-box {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 16px;
}
.captcha-img {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--primary-dark);
  min-width: 130px;
  text-align: center;
}
.captcha-refresh {
  font-size: 12px; color: var(--text-muted);
  text-decoration: underline; cursor: pointer;
}
.captcha-input { flex: 1; }

/* ---- Submit Button ---- */
.btn-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 15px;
  font-size: 17px;
  font-weight: 700;
  font-family: 'Sarabun', sans-serif;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(26,79,160,0.25);
}
.btn-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(26,79,160,0.35); }
.btn-submit:active { transform: translateY(0); }

/* ---- Alert / Success ---- */
.alert {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: #dcfce7; border: 1.5px solid #86efac; color: #166534; }
.alert-error   { background: #fee2e2; border: 1.5px solid #fca5a5; color: #991b1b; }

/* ---- Back Button ---- */
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 14px;
  font-family: 'Sarabun', sans-serif;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 16px;
  transition: all 0.2s;
}
.btn-back:hover { border-color: var(--primary); color: var(--primary); }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #e0f2fe; color: #0c4a6e; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }

/* ---- Success Page ---- */
.success-card {
  text-align: center;
  padding: 40px 24px;
}
.success-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  margin: 0 auto 20px;
}
.success-card h2 { font-size: 22px; color: var(--success); margin-bottom: 8px; }
.success-card p  { color: var(--text-muted); font-size: 15px; margin-bottom: 24px; }
.btn-home {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
}

/* ---- Footer ---- */
.footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 20px;
  font-size: 13px;
  margin-top: 32px;
}
.footer strong { color: #fff; }

/* ---- Queue Date ---- */
.queue-date-display {
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  letter-spacing: 1px;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .services-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .form-row { grid-template-columns: 1fr; }
  .navbar-brand .brand-sub { display: none; }
  .hero-banner { padding: 20px 16px; }
}
