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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2e3345;
  --text: #e8eaed;
  --text-muted: #9aa0b0;
  --accent: #6c63ff;
  --accent-hover: #7d75ff;
  --accent-bg: rgba(108, 99, 255, 0.12);
  --success: #4caf50;
  --error: #ef5350;
  --radius: 8px;
  --radius-sm: 6px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1rem;
  width: 100%;
}

/* Header */
header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

header .subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.card .section-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* Builder */
.builder-row {
  margin-bottom: 1rem;
}

.builder-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

select, input[type="text"], input[type="number"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

select:focus, input:focus {
  border-color: var(--accent);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239aa0b0' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.builder-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.builder-options .builder-row {
  flex: 1 1 200px;
  margin-bottom: 0;
}

/* Result Box */
.result-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.result-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: 100%;
}

.result-expression {
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  flex: 1;
  word-break: break-all;
}

.copy-btn {
  padding: 0.4rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.copy-btn:hover {
  background: var(--accent-hover);
}

/* Explanation */
.explanation-box {
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.5;
}

/* Next Runs */
.next-runs h3 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.next-runs ol {
  padding-left: 1.5rem;
}

.next-runs li {
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.2rem 0;
}

/* Explainer Input */
.input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.input-row input {
  flex: 1;
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
}

.btn {
  padding: 0.6rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--accent-hover);
}

.error-msg {
  color: var(--error);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Examples Grid */
.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.example-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
  color: var(--text);
}

.example-btn:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.example-btn .example-expr {
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  display: block;
  margin-bottom: 0.25rem;
}

.example-btn .example-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* SEO Content */
.seo-content h3 {
  font-size: 1.05rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.seo-content p, .seo-content ul {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.seo-content ul {
  padding-left: 1.5rem;
}

.seo-content li {
  margin-bottom: 0.35rem;
}

.seo-content code {
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85rem;
  color: var(--accent);
}

.cron-fields-table {
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

.cron-fields-table table {
  width: 100%;
  border-collapse: collapse;
}

.cron-fields-table th, .cron-fields-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.cron-fields-table th {
  color: var(--text);
  font-weight: 600;
}

.cron-fields-table td {
  color: var(--text-muted);
}

/* Ad Slots */
.ad-slot {
  margin-bottom: 1.5rem;
  min-height: 50px;
}

/* Footer */
footer {
  margin-top: auto;
  padding: 1.5rem 1rem;
  text-align: center;
  border-top: 1px solid var(--border);
}

footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: #fff;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* Responsive */
@media (max-width: 600px) {
  header h1 {
    font-size: 1.35rem;
  }

  .result-expression {
    font-size: 1.2rem;
  }

  .builder-options .builder-row {
    flex: 1 1 100%;
  }

  .examples-grid {
    grid-template-columns: 1fr;
  }
}
