/*
 * The catalog UI's colours, lines and type applied to the old Blade pages
 * (/ and /login) without changing their layout. Loaded after main.css and
 * custom.css via includes/new_theme.blade.php, so these rules win on equal
 * specificity; only the pages that include it are affected.
 *
 * Tokens are copied from frontend/src/assets/main.css — keep the two in step.
 * Dark is the default, as in the SPA, and both read `limnocity-theme`.
 */

:root {
  --radius: 0.375rem;
  --background: #ffffff;
  --foreground: #1a1a2e;
  --card: #ffffff;
  --secondary: #f5f5f5;
  --primary: #3bbfa0;
  --primary-hover: #2ea88a;
  --primary-foreground: #ffffff;
  --muted-foreground: #888888;
  --destructive: #ef4444;
  --destructive-bg: #fef2f2;
  --border: #eeeeee;
  --input: #e5e5e5;
  --input-bg: #ffffff;
  --ring: rgba(59, 191, 160, 0.35);
  --warning: #92400e;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --sidebar: #1a1a2e;
  --sidebar-foreground: #ffffff;
  --sidebar-border: rgba(255, 255, 255, 0.08);
}

.dark {
  --background: #0f1419;
  --foreground: #e5e9ee;
  --card: #10161d;
  --secondary: #1a212b;
  --primary: #0ea5b7;
  --primary-hover: #0e93a3;
  --primary-foreground: #ffffff;
  --muted-foreground: #8a95a3;
  --destructive: #f87171;
  --destructive-bg: #f871711a;
  --border: #2c3a4d;
  --input: #2c3a4d;
  --input-bg: #0b0f14;
  --ring: rgba(14, 165, 183, 0.35);
  --warning: #fbbf24;
  --warning-bg: #fbbf241a;
  --warning-border: #fbbf2447;
  --sidebar: #0b0f14;
  --sidebar-foreground: #e5e9ee;
  --sidebar-border: #2c3a4d;

  color-scheme: dark;
}

/* ── Page ─────────────────────────────────────────────────────────── */

html body,
html #wrapper {
  background: var(--background);
  color: var(--foreground);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

html #app {
  background: var(--background);
  box-shadow: none;
}

html h1, html h2, html h3, html h4, html h5, html h6,
html .h1, html .h2, html .h3, html .h4, html .h5, html .h6 {
  font-family: inherit;
  color: var(--foreground);
}

html a {
  color: var(--primary);
}
html a:hover {
  color: var(--primary-hover);
}

/* ── Header and footer: the SPA sidebar's surface ─────────────────── */

html #mainheader {
  background: var(--sidebar);
  border-bottom: 1px solid var(--sidebar-border);
}

html #header_title > span {
  background: none;
  -webkit-text-fill-color: var(--sidebar-foreground);
  color: var(--sidebar-foreground);
  font-family: inherit;
}

html #mainfooter {
  background: var(--sidebar);
  border-top: 1px solid var(--sidebar-border);
  color: var(--muted-foreground);
  font-family: inherit;
}

/* ── Cards (home page) ────────────────────────────────────────────── */

html .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
}

html .card-body,
html .card-title {
  color: var(--foreground);
}

html .card-text {
  color: var(--muted-foreground);
}

/* ── Fieldset panel (login page) ──────────────────────────────────── */

html fieldset {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
}

html legend {
  background: var(--secondary);
  color: var(--foreground);
  border: 0;
  border-bottom: 1px solid var(--border);
  font-family: inherit;
  border-radius: calc(var(--radius) + 1px) calc(var(--radius) + 1px) 0 0;
}

html label,
html .form-check-label {
  color: var(--foreground);
}

/* ── Inputs ───────────────────────────────────────────────────────── */

html .form-control,
html input[type='email'],
html input[type='password'],
html input[type='text'] {
  background: var(--input-bg);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  color: var(--foreground);
}

html .form-control:focus,
html input[type='email']:focus,
html input[type='password']:focus,
html input[type='text']:focus {
  background: var(--input-bg);
  border-color: var(--primary);
  color: var(--foreground);
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
}

html .form-control.is-invalid {
  border-color: var(--destructive);
}

html .invalid-feedback {
  color: var(--destructive);
}

html .form-check-input,
html input[type='checkbox'] {
  background-color: var(--input-bg);
  border: 1px solid var(--input);
  accent-color: var(--primary);
}
html .form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}
html .form-check-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

/* ── Buttons ──────────────────────────────────────────────────────── */

html .btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius);
}
html .btn-primary:hover,
html .btn-primary:focus,
html .btn-primary:active {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--primary-foreground);
}
html .btn-primary:focus {
  box-shadow: 0 0 0 3px var(--ring);
}

html .btn-link {
  color: var(--primary);
}
html .btn-link:hover {
  color: var(--primary-hover);
}

/* ── Alerts ───────────────────────────────────────────────────────── */

html .alert-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}

html .alert-danger {
  background: var(--destructive-bg);
  border-color: var(--destructive);
  color: var(--destructive);
}

/* ── Console window (includes/console.blade.php) ──────────────────── */

/* A terminal stays dark in both themes; only its frame follows the theme. */
.lc-console {
  margin: 24px 0 240px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: #0b0f14;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.lc-console-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--secondary);
  border-bottom: 1px solid var(--border);
}

.lc-console-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}
.lc-console-dot:first-child {
  background: var(--primary);
}

.lc-console-title {
  flex: 1;
  margin-right: 46px; /* balances the dots so the title sits centred */
  color: var(--muted-foreground);
  font-size: 12px;
  text-align: center;
}

/* Output scrolls above; the prompt stays pinned at the bottom. */
.lc-console-body {
  display: flex;
  flex-direction: column;
  height: 800px;
  color: #e5e9ee;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, 'Liberation Mono', monospace;
  font-size: 14px;
  line-height: 1.6;
  cursor: text;
}

.lc-console-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 8px;
}

.lc-line {
  min-height: 1.6em;
  white-space: pre-wrap;
  word-break: break-word;
}
.lc-line.lc-pre {
  white-space: pre;
}
.lc-muted {
  color: #8a95a3;
}
.lc-error {
  color: #f87171;
}
.lc-ok {
  color: #6fd283;
}
.lc-line b {
  color: #e5e9ee;
}

.lc-console-prompt {
  color: #0ea5b7;
}

.lc-console-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 18px;
  border-top: 1px solid #2c3a4d;
  background: #10161d;
}
.lc-console-form .lc-console-prompt {
  flex-shrink: 0;
  margin: 0;
  font: inherit;
}

/* Beats the page-wide input rules above (html input[type=...]). */
html .lc-console .lc-console-input,
html .lc-console .lc-console-input:focus {
  flex: 1;
  min-width: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  color: #e5e9ee;
  caret-color: #0ea5b7;
  font: inherit;
}

/* Types itself out: 20 characters of monospace text, revealed one ch at a
   time. Keep steps() and the width equal to the text's length. */
.lc-console-text {
  display: inline-block;
  vertical-align: bottom;
  width: 20ch;
  overflow: hidden;
  white-space: nowrap;
  animation: lc-type 1.4s steps(20, end) 0.5s both;
}

@keyframes lc-type {
  from {
    width: 0;
  }
}

/* The hint arrives once the welcome line has finished typing. */
.lc-console-hint {
  animation: lc-fade 0.3s ease 2s both;
}

@keyframes lc-fade {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lc-console-text,
  .lc-console-hint {
    animation: none;
  }
}

/* On /login the console sits inside the .login container; don't pad twice. */
.login.container > .container {
  padding: 0;
}
