/* Theme — ported from .streamlit/config.toml */
:root {
  --primary: #7BA3CE;
  --primary-dark: #5f87b3;
  --bg: #FFFFFF;
  --bg-secondary: #EBF1F8;
  --text: #1F2937;
  --text-muted: #6B7280;
  --border: #D1D9E4;
  --success-bg: #D4F4DD;
  --success-text: #0F5132;
  --error-bg: #F8D7DA;
  --error-text: #842029;
  --warning-bg: #FFF3CD;
  --warning-text: #664D03;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 8px;
  --sidebar-w: 16rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

/* Sidebar — mimics Streamlit's sidebar */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border-right: 1px solid var(--border);
}

.logo {
  width: 100%;
  max-width: 200px;
  height: auto;
  align-self: center;
}

.nav-section {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 0.5rem;
  margin-bottom: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
}

.nav-item.active { background: rgba(123, 163, 206, 0.2); }
.nav-item:hover { background: rgba(123, 163, 206, 0.15); }
.nav-icon { font-size: 1.1rem; }

/* Main content — centered, ~46rem like Streamlit layout="centered" */
main {
  margin-left: var(--sidebar-w);
  max-width: 46rem;
  padding: 3rem 2rem 4rem;
}

h1 {
  font-size: 1.875rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.caption {
  color: var(--text-muted);
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

.caption.privacy {
  margin-bottom: 1.75rem;
  font-style: italic;
}

/* Boot status */
.boot {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Form */
form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

form label {
  font-weight: 500;
  font-size: 0.95rem;
  margin-top: 0.75rem;
}

form select,
form input[type="file"] {
  padding: 0.55rem 0.75rem;
  font: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

form select:focus,
form input[type="file"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
  margin-top: 0.85rem;
}

.checkbox-row input { width: 1rem; height: 1rem; accent-color: var(--primary); }

/* Buttons */
.btn-primary {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  margin-top: 1.25rem;
  text-decoration: none;
  text-align: center;
  transition: background 0.12s;
}

.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.download { width: fit-content; }

/* Result banners */
.banner-success {
  margin-top: 1.5rem;
  background: var(--success-bg);
  color: var(--success-text);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-weight: 500;
}

.banner-error {
  margin-top: 1.25rem;
  background: var(--error-bg);
  color: var(--error-text);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
}

/* <details> as st.expander equivalent */
details {
  margin-top: 0.75rem;
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid rgba(102, 77, 3, 0.2);
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
}

details summary {
  cursor: pointer;
  font-weight: 500;
  padding: 0.25rem 0;
  list-style: none;
}

details summary::-webkit-details-marker { display: none; }
details summary::before { content: "▸ "; display: inline-block; transition: transform 0.15s; }
details[open] summary::before { content: "▾ "; }

details ul {
  margin: 0.5rem 0 0.25rem 0;
  padding-left: 1.2rem;
  font-size: 0.92rem;
}

details li { margin-bottom: 0.15rem; }

#result { margin-top: 0.5rem; }

@media (max-width: 720px) {
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 0.75rem 1rem;
  }
  .logo { max-width: 100px; }
  .nav-section { display: none; }
  main { margin-left: 0; padding: 1.5rem 1rem 3rem; }
}
