/* ========================================
   นับวัน - shared stylesheet
   Mobile-first, no framework
   ======================================== */

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --bg: #f9fafb;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --max-width: 1100px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ===== Header ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 22px;
}

.logo-icon { font-size: 24px; }
.logo-text { color: var(--primary); }

.site-nav {
  display: flex;
  gap: 20px;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--primary);
}

/* ===== Hero ===== */
.hero {
  padding: 64px 0 48px;
  text-align: center;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg) 100%);
}

.hero h1 {
  margin: 0 0 16px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.hero .lead {
  margin: 0 auto 32px;
  max-width: 600px;
  font-size: 16px;
  color: var(--text-muted);
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* ===== Tools section ===== */
.tools-section {
  padding: 64px 0;
}

.tools-section h2,
.about-section h2 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
}

.section-sub {
  margin: 0 0 40px;
  text-align: center;
  color: var(--text-muted);
}

.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tool-card.available {
  cursor: pointer;
}

.tool-card.available:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.tool-card.soon {
  opacity: 0.7;
}

.tool-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.tool-card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.tool-card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.tool-status {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
}

.status-active { color: var(--primary); }
.status-soon { color: var(--text-muted); }

/* ===== About section ===== */
.about-section {
  padding: 48px 0 64px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.about-section p {
  max-width: 720px;
  margin: 0 auto 16px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.7;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--text);
  color: rgba(255, 255, 255, 0.8);
  padding: 32px 0;
  text-align: center;
  font-size: 14px;
}

.site-footer p { margin: 0; }

/* ===== Tool page (used by individual tools) ===== */
.tool-page {
  padding: 32px 0 64px;
}

.breadcrumb {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.tool-page h1 {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 700;
}

.tool-page .tool-intro {
  margin: 0 0 32px;
  color: var(--text-muted);
  font-size: 16px;
}

.tool-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin: 0 0 32px;
  box-shadow: var(--shadow);
}

.input-group {
  margin: 0 0 20px;
}

.input-group label {
  display: block;
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 15px;
}

.input-group input[type="number"],
.input-group input[type="date"],
.input-group input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  background: var(--bg);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}

.result-box {
  margin: 24px 0 0;
  padding: 20px;
  background: var(--primary-light);
  border-radius: 8px;
  border-left: 4px solid var(--primary);
}

.result-box .result-label {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.result-box .result-value {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-dark);
}

.content-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin: 0 0 24px;
}

.content-section h2 {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 700;
}

.content-section h3 {
  margin: 24px 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.content-section p,
.content-section li {
  color: var(--text);
  line-height: 1.7;
}

.faq details {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.faq details:last-child { border-bottom: none; }

.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq summary::after {
  content: '+';
  font-size: 24px;
  color: var(--primary);
  font-weight: 400;
}

.faq details[open] summary::after { content: '−'; }

.faq details p {
  margin: 12px 0 0;
  color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (min-width: 640px) {
  .hero { padding: 80px 0 64px; }
  .hero h1 { font-size: 40px; }
  .hero .lead { font-size: 18px; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .tool-page h1 { font-size: 34px; }
}

@media (min-width: 960px) {
  .tools-grid { grid-template-columns: repeat(3, 1fr); }
  .hero h1 { font-size: 48px; }
}
