/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg: #f8fafc;
  --c-surface: #ffffff;
  --c-border: #e2e8f0;
  --c-text: #1e293b;
  --c-text-secondary: #64748b;
  --c-primary: #4F46E5;
  --c-primary-hover: #4338CA;
  --c-primary-light: #EEF2FF;
  --c-success: #16a34a;
  --c-danger: #dc2626;
  --c-warning: #f59e0b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --max-w: 960px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Layout ===== */
.site-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 0.75rem 1rem;
  position: sticky; top: 0; z-index: 10;
}
.site-header .inner {
  max-width: var(--max-w); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
}
.site-logo {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 700; font-size: 1.15rem; color: var(--c-text); text-decoration: none;
}
.site-logo img { width: 28px; height: 28px; }
.site-nav { display: flex; gap: 1.25rem; font-size: 0.9rem; }
.site-nav a { color: var(--c-text-secondary); text-decoration: none; }
.site-nav a:hover { color: var(--c-primary); }

.site-main {
  flex: 1;
  max-width: var(--max-w); width: 100%;
  margin: 0 auto; padding: 1.5rem 1rem 3rem;
}

.site-footer {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding: 1.5rem 1rem;
  font-size: 0.85rem; color: var(--c-text-secondary); text-align: center;
}
.site-footer a { color: var(--c-primary); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer .inner {
  max-width: var(--max-w); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center;
}

/* ===== Typography ===== */
h1 { font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.3; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 1.25rem 0 0.5rem; }
p { margin-bottom: 0.75rem; color: var(--c-text-secondary); }
a { color: var(--c-primary); }

/* ===== Tool Area ===== */
.tool-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.upload-zone {
  border: 2px dashed var(--c-border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
}
.upload-zone input[type="file"] { display: none; }
.upload-zone .icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.upload-zone .hint { font-size: 0.85rem; color: var(--c-text-secondary); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.2rem; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  min-height: 44px; /* touch target */
  text-decoration: none;
}
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-hover); }
.btn-outline { background: #fff; color: var(--c-primary); border-color: var(--c-primary); }
.btn-outline:hover { background: var(--c-primary-light); }
.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Options Row ===== */
.options-row {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  margin: 1rem 0;
}
.options-row label {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.9rem; cursor: pointer;
}

/* ===== Preview Table ===== */
.table-wrap {
  overflow-x: auto; margin: 1rem 0; max-height: 400px; overflow-y: auto;
  border: 1px solid var(--c-border); border-radius: var(--radius);
}
.table-wrap table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.table-wrap th, .table-wrap td {
  padding: 0.4rem 0.6rem; border: 1px solid var(--c-border);
  white-space: nowrap; text-align: left;
}
.table-wrap th { background: #f1f5f9; font-weight: 600; position: sticky; top: 0; }

/* ===== Status ===== */
.status-bar {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center;
  padding: 0.75rem 1rem; border-radius: var(--radius);
  background: #f8fafc; border: 1px solid var(--c-border);
  margin: 1rem 0; font-size: 0.9rem;
}
.status-bar .badge {
  padding: 0.2rem 0.6rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600;
}
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-warn { background: #fef3c7; color: #b45309; }
.badge-success { background: #dcfce7; color: #15803d; }

/* ===== SEO Content Sections ===== */
.content-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.content-section ol, .content-section ul { padding-left: 1.25rem; margin-bottom: 0.75rem; }
.content-section li { margin-bottom: 0.35rem; color: var(--c-text-secondary); }

details { margin-bottom: 0.5rem; }
details summary { cursor: pointer; font-weight: 500; padding: 0.3rem 0; }
details p { margin-top: 0.35rem; padding-left: 0.5rem; border-left: 3px solid var(--c-primary-light); }

/* ===== Homepage ===== */
.hero { text-align: center; padding: 1.5rem 0 1rem; }
.hero h1 { margin-bottom: 0.5rem; }
.hero p { font-size: 1.1rem; max-width: 600px; margin: 0 auto 1rem; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.tool-grid .card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: box-shadow .15s, border-color .15s;
  text-decoration: none; color: inherit;
}
.tool-grid .card:hover { box-shadow: var(--shadow-md); border-color: var(--c-primary); }
.tool-grid .card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.tool-grid .card p { font-size: 0.85rem; margin: 0; }

/* ===== News / updates ===== */
.empty-state { text-align: center; padding: 1.5rem 1rem; color: var(--c-text-secondary); }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .tool-card, .content-section { padding: 1rem; }
  .upload-zone { padding: 2rem 1rem; }
  .site-nav { gap: 0.75rem; font-size: 0.8rem; }
  .options-row { flex-direction: column; align-items: flex-start; }
}
