/* f06csv_web — custom styles on top of Skeleton.css */

/* Widen Skeleton's narrow 960px container so the app uses more of the
 * available viewport on PC-sized screens, while still leaving comfortable
 * margins on very wide monitors. */
.container {
  max-width: min(1500px, 95vw);
}

:root {
  --bg: #ffffff;
  --fg: #222222;
  --muted: #777777;
  --border: #e1e1e1;
  --panel: #fafafa;
  --accent: #33c3f0;
  --error-bg: #f8d7da;
  --error-fg: #721c24;
  --ok-bg: #d4edda;
  --ok-fg: #155724;
}

html[data-theme="dark"] {
  --bg: #1e1e1e;
  --fg: #e1e1e1;
  --muted: #999999;
  --border: #3a3a3a;
  --panel: #2a2a2a;
  --accent: #4ec9d9;
  --error-bg: #4a1d23;
  --error-fg: #f8c8cf;
  --ok-bg: #1f3d2a;
  --ok-fg: #c6efd0;
}

html,
body {
  background: var(--bg);
  color: var(--fg);
}

a {
  color: var(--accent);
}

/* Override Skeleton's hardcoded white background on form controls so the
 * theme variables actually take effect. Specificity here matches the
 * Skeleton selectors. */
input[type="email"],
input[type="number"],
input[type="search"],
input[type="text"],
input[type="tel"],
input[type="url"],
input[type="password"],
textarea,
select {
  background-color: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
}

input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="text"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  border: 1px solid var(--accent);
}

/* Native select dropdown arrow becomes invisible against dark bg without
 * an explicit foreground hint. */
html[data-theme="dark"] select {
  /* Use color-scheme so the native widget (dropdown arrow, option list)
   * follows the dark theme. */
  color-scheme: dark;
}

html[data-theme="dark"] input[type="checkbox"],
html[data-theme="dark"] input[type="radio"] {
  color-scheme: dark;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.app-header-title {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app-header h1 {
  margin: 0;
  font-size: 3.1rem;
  line-height: 1.1;
}

.app-header-tagline {
  font-size: 2rem;
  font-weight: 400;
  color: var(--muted, #6b7785);
  margin-left: 0.25rem;
}
.app-header-byline {
  font-size: 1.1rem;
  color: var(--muted, #6b7785);
}

.app-header-project {
  /*font-weight: 600;*/
  color: var(--fg);
}

.app-header-repo {
  color: var(--muted, #6b7785);
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.app-header-repo::before {
  content: "↗ ";
  opacity: 0.7;
}

.app-header-repo:hover {
  color: var(--fg);
  text-decoration: underline;
}

.app-header-repo-line {
  font-size: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.app-header-repo-note {
  color: var(--muted, #6b7785);
  font-style: italic;
}

.theme-toggle {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 0.4rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease,
    color 0.12s ease;
}

.theme-toggle:hover,
.theme-toggle:focus,
.theme-toggle:focus-visible,
.theme-toggle:active {
  background: var(--bg);
  border-color: var(--fg);
  color: var(--fg);
  outline: none;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel:first-child h3 {
  margin-top: 3rem;
  margin-bottom: 1.5rem;
}

.section-hint {
  margin: -1.3rem 0 1.8rem 0;
  font-size: 1rem;
  color: var(--muted);
  font-style: italic;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  }
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.25rem 1rem;
}

.checkbox-grid label {
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 6px;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: rgba(51, 195, 240, 0.08);
}

.drop-zone input[type="file"] {
  display: none;
}

.drop-zone .filename {
  color: var(--fg);
  font-weight: 600;
  margin-top: 0.5rem;
  word-break: break-all;
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.banner.error {
  background: var(--error-bg);
  color: var(--error-fg);
}

.banner.ok {
  background: var(--ok-bg);
  color: var(--ok-fg);
}

.preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 1.2rem;
  white-space: pre;
  overflow: auto;
  max-height: 60vh;
  margin: 0;
}

.preview-meta {
  color: var(--muted);
  font-size: 1.2rem;
  margin-top: 0.5rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

/* Keep text/number inputs and selects inside the filters grid from
 * stretching to the full column width. */
.field-row input[type="text"],
.field-row input[type="number"],
.field-row select {
  width: 100%;
  max-width: 16rem;
}

/* Compact, top-of-page action toolbar. */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 1.5rem;
}

.toolbar .grow {
  flex: 1 1 auto;
}

.toolbar button {
  margin-bottom: 0;
}

/* Read-only CLI equivalent shown beneath the toolbar. */
.cli-flags-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-weight: normal;
}

.cli-flags-label {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

input.cli-flags {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
  margin-bottom: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.35rem 0.6rem;
  cursor: text;
}

input.cli-flags:focus {
  outline: 1px solid var(--fg);
  outline-offset: -1px;
}

label.inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
}

/* tighten skeleton spacing inside panels */
.panel input[type="text"],
.panel input[type="number"],
.panel select {
  margin-bottom: 0.5rem;
}
.panel label {
  margin-bottom: 0.25rem;
}
