/* ===== ReceiptFlash 共用樣式 ===== */

:root {
  --primary: #2e75b6;
  --primary-dark: #1a4f7a;
  --primary-soft: #e8f2fb;
  --accent: #ff6b35;
  --accent-soft: #fff0e8;
  --success: #27ae60;
  --warning: #f39c12;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-2: #5a5a7a;
  --muted: #9494b0;
  --border: #e2e4ec;
  --border-strong: #c8cbd6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(30,50,90,.06);
  --shadow: 0 4px 24px rgba(30,50,90,.1);
  --shadow-lg: 0 12px 48px rgba(30,50,90,.14);
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", Menlo, Consolas, monospace;
  --max-width: 1100px;
  --max-width-narrow: 720px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

h1, h2, h3, h4, h5, h6 { line-height: 1.3; color: var(--text); margin-bottom: .5em; }
h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -.5px; }
h2 { font-size: 1.8rem; font-weight: 700; margin-top: 1.5em; }
h3 { font-size: 1.3rem; font-weight: 700; margin-top: 1.3em; }

p { margin-bottom: 1em; }

ul, ol { padding-left: 1.5em; margin-bottom: 1em; }
li { margin-bottom: .3em; }

code { background: #f0f0f5; padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: .9em; }
pre { background: #1a1a2e; color: #a8ff78; padding: 16px 20px; border-radius: var(--radius-sm); overflow-x: auto; margin: 12px 0; }
pre code { background: none; color: inherit; padding: 0; }

blockquote {
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  margin: 16px 0;
  background: var(--primary-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-2);
}

/* ===== Header ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.site-header .container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
}
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, #5a9fd4 100%);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white;
  box-shadow: 0 3px 10px rgba(46,117,182,.3);
}
.brand-text { font-size: 17px; }
.brand-sub { font-size: 11px; color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  font-size: 15px;
  transition: all .2s;
}
.nav a:hover { background: var(--primary-soft); color: var(--primary); }
.nav a.active { color: var(--primary); background: var(--primary-soft); }

.nav-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; padding: 4px 8px; color: var(--text); }

@media (max-width: 720px) {
  .nav { display: none; flex-direction: column; gap: 0; position: absolute; top: 100%; right: 0; left: 0; background: var(--surface); padding: 8px 0; border-bottom: 1px solid var(--border); }
  .nav.open { display: flex; }
  .nav a { width: 100%; border-radius: 0; padding: 12px 24px; }
  .nav-toggle { display: block; }
}

/* ===== Main ===== */
main { flex: 1; }

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

.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: white;
  padding: 80px 24px 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero h1 { color: white; font-size: 3rem; max-width: 720px; margin: 0 auto .4em; }
.hero p { font-size: 1.15rem; opacity: .9; max-width: 640px; margin: 0 auto 1.5em; }
.hero .btn { font-size: 1.1rem; padding: 14px 32px; }

/* ===== Sections ===== */
section { padding: 60px 0; }
section h2 { text-align: center; margin-bottom: .3em; }
section .lead { text-align: center; color: var(--text-2); max-width: 640px; margin: 0 auto 40px; font-size: 1.05rem; }

/* ===== Cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  transition: all .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--primary); }
.card .icon { font-size: 2.4rem; margin-bottom: 12px; }
.card h3 { margin-top: 0; }
.card p { color: var(--text-2); margin-bottom: 0; }

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all .2s;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #1a6fc4 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(46,117,182,.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(46,117,182,.4); color: white; }
.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover { background: #e35a25; color: white; }
.btn-outline {
  background: var(--surface);
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-soft); }

/* ===== Article / Long-form Content ===== */
.article {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 48px 40px;
  margin: 40px auto;
  max-width: var(--max-width-narrow);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.article h1 { margin-top: 0; }
.article h2 { border-bottom: 2px solid var(--primary-soft); padding-bottom: 8px; }
.article .meta { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.article .toc {
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 32px;
}
.article .toc h4 { margin: 0 0 8px; color: var(--primary); font-size: 14px; }
.article .toc ul { padding-left: 20px; margin: 0; }
.article .toc a { color: var(--text-2); }
.article .cta {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 20px 24px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 32px 0;
  text-align: center;
}
.article .cta a { display: inline-block; margin-top: 12px; }

/* ===== Footer ===== */
.site-footer {
  background: #1a1a2e;
  color: #c8cbd6;
  padding: 48px 24px 24px;
  margin-top: 60px;
}
.site-footer .container { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.site-footer h4 { color: white; font-size: 14px; margin-bottom: 16px; text-transform: uppercase; letter-spacing: .5px; }
.site-footer ul { list-style: none; padding: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer a { color: #c8cbd6; font-size: 14px; }
.site-footer a:hover { color: white; }
.site-footer .brand-mini { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.site-footer p { font-size: 13px; line-height: 1.6; }
.footer-bottom { grid-column: 1 / -1; border-top: 1px solid #2e2e48; padding-top: 20px; margin-top: 16px; text-align: center; font-size: 12px; color: var(--muted); }

@media (max-width: 720px) {
  .site-footer .container { grid-template-columns: 1fr; gap: 24px; }
  .article { padding: 28px 20px; margin: 20px auto; }
  h1 { font-size: 1.9rem; }
  .hero { padding: 60px 20px 40px; }
  .hero h1 { font-size: 2rem; }
}

/* ===== Ad slots ===== */
.ad-slot {
  margin: 32px auto;
  padding: 0;
  text-align: center;
  max-width: 100%;
  min-height: 90px;
}
.ad-slot[data-ad="header-banner"] { max-width: 728px; }
.ad-slot[data-ad="side-rectangle"] { max-width: 336px; }
.ad-slot[data-ad="in-article-blog"] { margin: 28px 0; }
.ad-slot:not(.ad-loaded)::before {
  content: '廣告載入中…';
  display: block;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  padding: 20px;
  background: #fafbfc;
  border-radius: var(--radius-sm);
}

/* ===== FAQ ===== */
.faq-item { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { margin: 0 0 8px; font-size: 1.1rem; color: var(--primary); }

/* ===== Forms ===== */
input, textarea, select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color .2s, background .2s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  background: var(--surface);
  outline: none;
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.muted { color: var(--muted); }
