/* Public schema styling - clean, professional, information-dense */
:root {
  --color-primary: #333;
  --color-primary-text: #ffffff;
  --color-primary-links: #ffffff;
  --color-primary-light: #555;
  --color-accent: #0066cc;
  --color-accent-hover: #0052a3;
  --color-bg: #fff;
  --color-bg-alt: #f5f5f5;
  --color-text: #222;
  --color-text-muted: #666;
  --color-border: #ddd;
  --color-highlight: #e8e8e8;
  --font-sans: system-ui, -apple-system, sans-serif;
  --transition-fast: 0.15s ease;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  margin: 0;
  padding: 0;
  color: var(--color-text);
  background: var(--color-bg);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-primary);
  color: var(--color-primary-text);
  padding: 0.5rem 1rem;
}

.header-title {
  color: var(--color-primary-links);
}

.header-title:hover {
  color: var(--color-primary-links);
}

.header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary-text);
}

.nav {
  margin-top: 0;
}

.nav a {
  color: var(--color-primary-links);
  opacity: 0.8;
  margin-right: 1rem;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.nav a:hover {
  color: var(--color-primary-links);
  opacity: 1;
}

.nav a.active {
  color: var(--color-primary-links);
  opacity: 1;
  font-weight: 600;
}

/* ---------- Public pages header (base.html) ---------- */

.public-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1.25rem 1rem 0;
}

.public-header-inner {
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
}

.public-header-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-accent);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.public-header-title:hover {
  color: var(--color-accent-hover);
}

.public-header-logo {
  max-height: 48px;
  vertical-align: middle;
  margin-bottom: 0.5rem;
}

.public-nav {
  margin-bottom: 0.75rem;
}

.public-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  margin: 0 0.6rem;
  font-size: 0.9rem;
  transition: color var(--transition-fast);
}

.public-nav a:hover {
  color: var(--color-accent);
}

.public-nav a.active {
  color: var(--color-accent);
  font-weight: 600;
}

/* ---------- Content ---------- */

.main {
  padding: 0.75rem 1rem;
  max-width: 960px;
  margin: 0 auto;
}

.main--full-width {
  max-width: none;
}

h1, h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

h2 {
  font-size: 1.25rem;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.4rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.4rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: 600;
  background: var(--color-bg-alt);
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

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

input, button, select {
  font-family: inherit;
  font-size: inherit;
}

input[type="text"],
input[type="url"],
input[type="email"],
textarea {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

button, input[type="submit"] {
  padding: 0.35rem 0.75rem;
  background: var(--color-primary);
  color: var(--color-primary-text);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

button:hover, input[type="submit"]:hover {
  background: var(--color-primary-light);
}

/* Dashboard sidebar */
.dashboard-layout {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.dashboard-sidebar {
  min-width: 160px;
  flex-shrink: 0;
}

.dashboard-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dashboard-sidebar a {
  padding: 0.4rem 0.5rem;
  color: var(--color-text);
  text-decoration: none;
  border-radius: 4px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.dashboard-sidebar a:hover {
  background: var(--color-bg-alt);
  color: var(--color-accent);
}

.dashboard-sidebar a.active {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  border-left: 3px solid var(--color-accent);
  padding-left: calc(0.5rem - 3px);
  font-weight: 600;
  color: var(--color-accent);
}

.dashboard-content {
  flex: 1;
  min-width: 0;
}

/* Messagelist (Django messages) */
.messagelist {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.messagelist li {
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.25rem;
  border-radius: 4px;
}

.messagelist li.success {
  background: #e6f4ea;
  color: #137333;
}

.messagelist li.error {
  background: #fce8e6;
  color: #c5221f;
}

.messagelist li.info {
  background: #e8f0fe;
  color: #1967d2;
}

.muted {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0 0 0.5rem 0;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 3px;
  text-transform: capitalize;
}

.badge-completed {
  background: #e6f4ea;
  color: #137333;
}

.badge-running {
  background: #e8f0fe;
  color: #1967d2;
}

.badge-pending {
  background: #fef7e0;
  color: #b06000;
}

.badge-failed {
  background: #fce8e6;
  color: #c5221f;
}

.badge-completed_with_warnings {
  background: #fef7e0;
  color: #b06000;
}

/* Button styled as a link */
.action-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-accent);
  cursor: pointer;
  font-size: inherit;
  text-decoration: none;
}

.action-link:hover {
  color: var(--color-accent-hover);
  background: none;
}

/* Info callout box */
.info-box {
  background: #e8f0fe;
  border-left: 3px solid #1967d2;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0 4px 4px 0;
  font-size: 0.9rem;
}

.form-row {
  margin-bottom: 0.5rem;
}

.form-row label {
  display: block;
  margin-bottom: 0.15rem;
}

.form-row input[type="text"],
.form-row select {
  max-width: 400px;
}

.form-error {
  display: block;
  color: #c5221f;
  font-size: 0.85em;
  margin-top: 0.15rem;
}

/* Sidebar section labels */
.sidebar-section {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-primary-text);
  background: var(--color-primary);
  padding: 0.25rem 0.5rem;
  margin-top: 0.5rem;
  border-radius: 4px;
}

/* Home page hero */
.hero {
  text-align: center;
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
}

.hero h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Teaser card grid */
.teaser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.teaser-card {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem;
  background: var(--color-bg-alt);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.teaser-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.teaser-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.teaser-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* CTA section */
.cta-section {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

.cta-button {
  display: inline-block;
  padding: 0.45rem 1.25rem;
  background: var(--color-primary);
  color: var(--color-primary-text);
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: background var(--transition-fast);
}

.cta-button:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-text);
}

/* Page header: flex row with title + optional help link or action */
.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.page-header h2 {
  margin: 0;
}

.page-header .help-link {
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Settings card / panel grouping */
.settings-card {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--color-bg);
}

.settings-card h3 {
  margin: 0 0 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--color-border);
}

/* Section spacing (replaces inline margin-top/margin-bottom) */
.section {
  margin-bottom: 1.5rem;
}

/* Header logo in base_tenant */
.header-logo {
  max-height: 36px;
  vertical-align: middle;
}

/* Additional badge variants */
.badge-active {
  background: #e6f4ea;
  color: #137333;
}

.badge-inactive {
  background: var(--color-highlight);
  color: var(--color-text-muted);
}

/* Button variant */
.btn {
  padding: 0.35rem 0.75rem;
  background: var(--color-primary);
  color: var(--color-primary-text);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  transition: background var(--transition-fast);
}

.btn:hover {
  background: var(--color-primary-light);
}

/* Stat cards (reports/overview) */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.75rem;
  text-align: center;
  background: var(--color-bg-alt);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
}

/* Pagination */
.pagination {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

/* Project section grouping */
.project-section {
  margin-bottom: 1.25rem;
}

/* Help text below form fields */
.help {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 0.1rem;
}

/* Error note (form-level) */
.errornote {
  background: #fce8e6;
  color: #c5221f;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Danger/destructive action link */
.danger-link {
  color: #c5221f;
}

.danger-link:hover {
  color: #a31b1b;
}

/* Inline form (e.g., rename, delete buttons in tables) */
.inline-form {
  display: inline;
}

/* MFA device table — fixed column widths for vertical alignment */
.mfa-devices { table-layout: fixed; }
.mfa-devices th:nth-child(1),
.mfa-devices td:nth-child(1) { width: 25%; }
.mfa-devices th:nth-child(2),
.mfa-devices td:nth-child(2) { width: 12%; }
.mfa-devices th:nth-child(3),
.mfa-devices td:nth-child(3) { width: 18%; }
.mfa-devices th:nth-child(4),
.mfa-devices td:nth-child(4) { width: 45%; }
.mfa-devices .inline-form input[type="text"] { width: 45%; }
.mfa-devices .inline-form button { vertical-align: middle; }
.mfa-devices td a { vertical-align: middle; }

/* Message/content display box */
.content-box {
  padding: 1rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  white-space: pre-wrap;
  margin-top: 1rem;
}

/* Monospace fields (JSON, CSS, code) */
.mono-input {
  width: 100%;
  font-family: monospace;
}

/* Deployment table — compact time column */
.deploy-table td:first-child,
.deploy-table th:first-child {
  white-space: nowrap;
  width: 1%;
}

/* Deployment log message — first line in summary, full text expandable */
summary.deploy-message {
  cursor: pointer;
  max-width: 20em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Deployment result color coding */
.deploy-success { color: #137333; font-weight: 600; }
.deploy-failure { color: #c5221f; font-weight: 600; }

/* Deploy spinner animation */
@keyframes deploy-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.deploy-spinner {
  display: inline-block;
  animation: deploy-spin 1s linear infinite;
}

/* Status box (update check, deploy status) */
.status-box {
  padding: 0.6rem 0.75rem;
  border-radius: 4px;
  background: var(--color-bg-alt);
  display: inline-block;
  margin-bottom: 0.75rem;
}

/* Color table for branding (no borders between rows) */
.color-table td,
.color-table th {
  border-bottom: none;
  padding: 0.4rem 1.5rem 0.4rem 0;
}

.color-table td:first-child,
.color-table th:first-child {
  padding-left: 0.5rem;
}

.color-table td:last-child,
.color-table th:last-child {
  padding-right: 0;
}

.color-table th {
  font-size: 0.85rem;
  background: none;
}

.color-table td:first-child {
  font-weight: 600;
}

/* Preview box */
.preview-box {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

.preview-box-label {
  margin: 0 0 0.5rem 0;
  font-weight: 600;
  font-size: 0.9rem;
}

.preview-strip {
  display: flex;
  gap: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.preview-strip > div {
  padding: 0.5rem 1rem;
  flex: 1;
}

/* Image thumbnails */
.thumb-sm {
  max-height: 48px;
  max-width: 120px;
  vertical-align: middle;
}

.thumb-lg {
  max-height: 60px;
  max-width: 200px;
  vertical-align: middle;
}

.thumb-icon {
  max-height: 32px;
  max-width: 32px;
  vertical-align: middle;
}

/* Hero badge pill */
.hero-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 12px;
  margin-bottom: 0.75rem;
}

/* CTA outline button variant */
.cta-button-outline {
  display: inline-block;
  padding: 0.45rem 1.25rem;
  background: transparent;
  color: var(--color-accent);
  border: 2px solid var(--color-accent);
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.cta-button-outline:hover {
  background: var(--color-accent);
  color: #fff;
}

/* Feature section (Features page — card with left accent border) */
.feature-section {
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: 0 6px 6px 0;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  background: var(--color-bg);
}

.feature-section:last-of-type {
  margin-bottom: 1.5rem;
}

.feature-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.feature-header h3 {
  margin: 0;
}

.feature-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  color: var(--color-accent);
}

.feature-section ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.feature-section li {
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
}

/* Teaser card icon */
.teaser-card-icon {
  color: var(--color-accent);
  margin-bottom: 0.4rem;
}

/* Page intro paragraph */
.page-intro {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 640px;
  margin-bottom: 1.25rem;
}

/* Mission text (Company page) */
.mission-text {
  font-size: 1.02rem;
  line-height: 1.7;
}

/* Contact form width constraint */
.contact-form {
  max-width: 480px;
}

/* Site footer */
.site-footer {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  padding: 1.25rem 1rem 1rem;
  margin-top: 2rem;
  font-size: 0.85rem;
}

.footer-content {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  gap: 2rem;
}

.footer-col h4 {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.footer-col a {
  display: block;
  color: var(--color-text);
  text-decoration: none;
  padding: 0.1rem 0;
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: var(--color-accent);
}

.footer-bottom {
  max-width: 960px;
  margin: 0.75rem auto 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

/* Mobile: sidebar collapses to horizontal strip above content */
@media (max-width: 680px) {
  .dashboard-layout {
    flex-direction: column;
  }

  .dashboard-sidebar {
    min-width: unset;
  }

  .dashboard-sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .sidebar-section {
    display: none;
  }

  .hero {
    padding: 1.25rem 0 1rem;
  }

  .hero h2 {
    font-size: 1.4rem;
  }

  .footer-content {
    flex-direction: column;
    gap: 1rem;
  }
}
