/* opnbk — green + black theme (rounded, big buttons).
   Change the colors here: every rule below uses these tokens. */

:root {
  --mx-background: #f4f7f5;
  --mx-foreground: #0a0a0a;
  --mx-card: #ffffff;
  --mx-primary: #0a0a0a;          /* black: headings, outlines, table header */
  --mx-primary-light: #14532d;    /* deep green: end of the hero gradient */
  --mx-secondary: #e7f6ec;        /* light green: result boxes */
  --mx-muted: #edf1ee;
  --mx-muted-foreground: #56605a;
  --mx-accent: #15803d;           /* green on light backgrounds (buttons, links) */
  --mx-accent-hover: #166534;
  --mx-accent-bright: #22c55e;    /* green on black backgrounds (header, hero, scanner) */
  --mx-destructive: #dc2626;
  --mx-success: #15803d;
  --mx-border: #dce3de;
  --mx-input: #ccd6cf;
  --mx-on-color: #ffffff;
  --mx-radius: .75rem;
  --mx-gradient-hero: linear-gradient(135deg, #0a0a0a 0%, #0d1a12 55%, var(--mx-primary-light) 100%);
  --mx-shadow-card: 0 12px 40px -16px rgba(0, 0, 0, .3);
  --mx-font-display: "Montserrat", system-ui, sans-serif;

  /* Bootstrap overrides */
  --bs-body-font-family: "Mulish", system-ui, sans-serif;
  --bs-body-bg: var(--mx-background);
  --bs-body-color: var(--mx-foreground);
  --bs-body-color-rgb: 10, 10, 10;
  --bs-primary: var(--mx-primary);
  --bs-primary-rgb: 10, 10, 10;
  --bs-success: var(--mx-success);
  --bs-success-rgb: 21, 128, 61;
  --bs-danger: var(--mx-destructive);
  --bs-danger-rgb: 220, 38, 38;
  --bs-secondary-color: var(--mx-muted-foreground);
  --bs-border-color: var(--mx-border);
  --bs-link-color: var(--mx-accent);
  --bs-link-color-rgb: 21, 128, 61;
  --bs-link-hover-color: var(--mx-accent-hover);
  --bs-link-hover-color-rgb: 22, 101, 52;
  --bs-code-color: var(--mx-primary-light);
}

body {
  background-color: var(--mx-background);
  color: var(--mx-foreground);
}

h1, h2, h3 {
  font-family: var(--mx-font-display);
  margin-bottom: 0;
}

/* ---------- Utilities ---------- */

.text-accent { color: var(--mx-accent) !important; }
.fw-extrabold { font-weight: 800 !important; }
.fs-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.fs-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.fs-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-xs { font-size: .75rem; }
.opacity-90 { opacity: .9; }

.container-site   { max-width: 72rem; margin-inline: auto; padding-inline: 1.5rem; }
.container-narrow { max-width: 48rem; margin-inline: auto; padding-inline: 1.5rem; }
.container-form   { max-width: 42rem; margin-inline: auto; padding-inline: 1.5rem; }
.container-auth   { max-width: 28rem; margin-inline: auto; width: 100%; }

.card-mx {
  background: var(--mx-card);
  border-radius: calc(var(--mx-radius) + 8px);
  box-shadow: var(--mx-shadow-card);
  padding: 2rem;
}

/* ---------- Header ---------- */

.site-header {
  background: var(--mx-primary);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
/* Bright green reads better than the dark accent on black */
.site-header .text-accent,
.hero .text-accent { color: var(--mx-accent-bright) !important; }

.brand {
  font-family: var(--mx-font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--mx-on-color);
  text-decoration: none;
}
.brand:hover { color: var(--mx-on-color); }

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: .875rem;
  font-weight: 600;
}
.site-nav a { color: rgba(255, 255, 255, .82); text-decoration: none; transition: color .15s; }
/* On a phone the links move to their own row instead of breaking mid-label */
.brand,
.site-nav a { white-space: nowrap; }
.site-nav a:hover,
.site-nav a.active { color: var(--mx-accent-bright); }

@media (max-width: 400px) {
  .site-nav { gap: 1rem; font-size: .8125rem; }
}

/* ---------- Buttons & inputs ---------- */

.btn-pill {
  border-radius: 50rem;
  font-weight: 700;
  padding: .75rem 2rem;
  white-space: nowrap;
}
.btn-sm-pill { padding: .375rem 1rem; font-size: .875rem; }
.btn-xs-pill { padding: .375rem 1rem; font-size: .75rem; white-space: nowrap; }

.btn-accent {
  --bs-btn-color: var(--mx-on-color);
  --bs-btn-bg: var(--mx-accent);
  --bs-btn-border-color: var(--mx-accent);
  --bs-btn-hover-color: var(--mx-on-color);
  --bs-btn-hover-bg: var(--mx-accent-hover);
  --bs-btn-hover-border-color: var(--mx-accent-hover);
  --bs-btn-active-color: var(--mx-on-color);
  --bs-btn-active-bg: var(--mx-accent-hover);
  --bs-btn-active-border-color: var(--mx-accent-hover);
  --bs-btn-disabled-color: var(--mx-on-color);
  --bs-btn-disabled-bg: var(--mx-accent);
  --bs-btn-disabled-border-color: var(--mx-accent);
  --bs-btn-focus-shadow-rgb: 34, 197, 94;
  transition: opacity .15s, background-color .15s;
}
.btn-accent:disabled { opacity: .6; }

/* Black outline button (class name kept from the original theme) */
.btn-outline-navy {
  --bs-btn-color: var(--mx-primary);
  --bs-btn-border-color: var(--mx-primary);
  --bs-btn-hover-color: var(--mx-on-color);
  --bs-btn-hover-bg: var(--mx-primary);
  --bs-btn-hover-border-color: var(--mx-primary);
  --bs-btn-active-color: var(--mx-on-color);
  --bs-btn-active-bg: var(--mx-primary);
  --bs-btn-active-border-color: var(--mx-primary);
  --bs-btn-focus-shadow-rgb: 10, 10, 10;
}

.btn-outline-destructive {
  --bs-btn-color: var(--mx-destructive);
  --bs-btn-border-color: var(--mx-destructive);
  --bs-btn-hover-color: var(--mx-on-color);
  --bs-btn-hover-bg: var(--mx-destructive);
  --bs-btn-hover-border-color: var(--mx-destructive);
  --bs-btn-active-color: var(--mx-on-color);
  --bs-btn-active-bg: var(--mx-destructive);
  --bs-btn-active-border-color: var(--mx-destructive);
  --bs-btn-focus-shadow-rgb: 220, 38, 38;
}

/* Solid red: irreversible action (delete), distinct from the outlined "Couper" */
.btn-destructive {
  --bs-btn-color: var(--mx-on-color);
  --bs-btn-bg: var(--mx-destructive);
  --bs-btn-border-color: var(--mx-destructive);
  --bs-btn-hover-color: var(--mx-on-color);
  --bs-btn-hover-bg: var(--mx-destructive);
  --bs-btn-hover-border-color: var(--mx-destructive);
  --bs-btn-active-color: var(--mx-on-color);
  --bs-btn-active-bg: var(--mx-destructive);
  --bs-btn-active-border-color: var(--mx-destructive);
  --bs-btn-disabled-color: var(--mx-on-color);
  --bs-btn-disabled-bg: var(--mx-destructive);
  --bs-btn-disabled-border-color: var(--mx-destructive);
  --bs-btn-focus-shadow-rgb: 220, 38, 38;
  transition: opacity .15s;
}
.btn-destructive:hover { opacity: .9; }
.btn-destructive:disabled { opacity: .6; }

.input-pill {
  border-radius: 50rem;
  border: 1px solid var(--mx-input);
  background-color: var(--mx-background);
  color: var(--mx-foreground);
  padding: .75rem 1.25rem;
}
.input-pill:focus {
  border-color: var(--mx-input);
  background-color: var(--mx-background);
  box-shadow: 0 0 0 2px var(--mx-accent);
}
.input-pill::placeholder { color: var(--mx-muted-foreground); opacity: .8; }

/* ---------- Home ---------- */

.home-main {
  margin-top: -6rem;
  padding-bottom: 5rem;
  position: relative;
}
.feature-card {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform .15s, border-color .15s;
}
.feature-card:hover,
.feature-card:focus-visible {
  color: inherit;
  transform: translateY(-3px);
  border-color: var(--mx-accent-bright);
}
.feature-card h2 { color: var(--mx-primary); }
.feature-icon { font-size: 2.25rem; color: var(--mx-accent); }
.feature-cta {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  font-weight: 700;
  color: var(--mx-accent);
}
@media (prefers-reduced-motion: reduce) {
  .feature-card { transition: none; }
  .feature-card:hover { transform: none; }
}

/* ---------- Shortener ---------- */

.hero {
  background-image: var(--mx-gradient-hero);
  color: var(--mx-on-color);
  padding: 4rem 1.5rem 8rem;
}
.hero-title { font-size: 2.25rem; line-height: 2.5rem; }
@media (min-width: 768px) {
  .hero-title { font-size: 3rem; line-height: 1; }
}

.shorten-main,
.qr-main {
  margin-top: -6rem;
  padding-bottom: 5rem;
  position: relative;
}

.result-box {
  background: var(--mx-secondary);
  border-radius: calc(var(--mx-radius) + 4px);
  padding: 1.25rem;
}
.result-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--mx-muted-foreground);
}
.short-link {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--mx-primary);
  text-decoration: none;
  word-break: break-all;
}
.short-link:hover { color: var(--mx-accent); }

/* Link type choice (Temporary / Permanent): radio buttons styled as cards */
.link-type {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.link-type-option {
  display: flex;
  align-items: center;
  gap: .625rem;
  height: 100%;
  padding: .5rem 1rem;
  border: 1px solid var(--mx-input);
  border-radius: 1rem;
  background: var(--mx-background);
  line-height: 1.2;
  cursor: pointer;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.link-type-option .bi { font-size: 1.25rem; color: var(--mx-muted-foreground); }
.link-type-option strong { display: block; font-size: .875rem; color: var(--mx-primary); }
.link-type-option small { display: block; font-size: .75rem; color: var(--mx-muted-foreground); }
.link-type-option:hover { border-color: var(--mx-accent); }
.btn-check:checked + .link-type-option {
  border-color: var(--mx-accent);
  background: var(--mx-secondary);
  box-shadow: inset 0 0 0 1px var(--mx-accent);
}
.btn-check:checked + .link-type-option .bi { color: var(--mx-accent); }
.btn-check:focus-visible + .link-type-option { outline: 2px solid var(--mx-accent-bright); outline-offset: 2px; }
.btn-check:disabled + .link-type-option { opacity: .55; cursor: not-allowed; }
.btn-check:disabled + .link-type-option:hover { border-color: var(--mx-input); }

.type-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 50rem;
  padding: .125rem .5rem;
  background: var(--mx-primary);
  color: var(--mx-accent-bright);
  font-size: .6875rem;
  font-weight: 700;
  text-transform: none;
  vertical-align: middle;
}

/* ---------- QR code reader ---------- */
/* Elements toggled with the hidden attribute get their display here, not from
   Bootstrap's !important d-* utilities, which would override [hidden]. */

.camera-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.qr-link { display: inline-block; }

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .25rem;
  padding: .25rem;
  background: var(--mx-muted);
  border-radius: 50rem;
}
.mode-switch button {
  border: 0;
  border-radius: 50rem;
  background: transparent;
  color: var(--mx-muted-foreground);
  font-size: .875rem;
  font-weight: 700;
  padding: .625rem .75rem;
  transition: background-color .15s, color .15s;
}
.mode-switch button:hover { color: var(--mx-primary); }
.mode-switch button[aria-selected="true"] {
  background: var(--mx-card);
  color: var(--mx-primary);
  box-shadow: 0 2px 10px -4px rgba(0, 0, 0, .3);
}
.mode-switch button:focus-visible { outline: 2px solid var(--mx-accent); outline-offset: 2px; }

.scan-viewport {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: calc(var(--mx-radius) + 4px);
  background-image: var(--mx-gradient-hero);
  color: var(--mx-on-color);
}
.scan-viewport video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Square target; the huge shadow dims everything around it */
.scan-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(62%, 16rem);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 3px solid var(--mx-accent-bright);
  border-radius: 1rem;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5);
}
.scan-line {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 2px;
  background: var(--mx-accent-bright);
  box-shadow: 0 0 12px var(--mx-accent-bright);
  animation: scan-sweep 1.8s ease-in-out infinite alternate;
}
@keyframes scan-sweep {
  from { top: 10%; }
  to { top: 90%; }
}
@media (prefers-reduced-motion: reduce) {
  .scan-line { animation: none; top: 50%; }
}
.scan-idle { padding: 1.5rem; text-align: center; }
.scan-idle-icon { font-size: 3rem; color: var(--mx-accent-bright); }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 14rem;
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  border: 2px dashed var(--mx-input);
  border-radius: calc(var(--mx-radius) + 4px);
  background: var(--mx-background);
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover,
.dropzone:focus-within,
.dropzone.is-dragover {
  border-color: var(--mx-accent);
  background: #ecf8f0;
}
.dropzone-icon { font-size: 2.25rem; color: var(--mx-accent); }
.dropzone img {
  max-width: 100%;
  max-height: 10rem;
  border-radius: var(--mx-radius);
  box-shadow: 0 6px 20px -10px rgba(0, 0, 0, .4);
}

.qr-text {
  max-height: 12rem;
  overflow: auto;
  margin-bottom: 0;
  padding: .75rem 1rem;
  border-radius: var(--mx-radius);
  background: var(--mx-card);
  color: var(--mx-foreground);
  font-family: inherit;
  font-size: .9375rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- Auth ---------- */

.page-auth { padding: 4rem 1.5rem; }

/* ---------- Installer ---------- */

.install-status {
  list-style: none;
  padding: 0;
  margin-bottom: 0;
  display: grid;
  gap: .5rem;
  font-size: .875rem;
}
.install-status .bi { margin-right: .375rem; }
.install-status .is-ok .bi      { color: var(--mx-success); }
.install-status .is-pending .bi { color: var(--mx-muted-foreground); }
.install-status .is-error       { color: var(--mx-destructive); }

.install-code {
  background: var(--mx-secondary);
  color: var(--mx-primary);
  border-radius: var(--mx-radius);
  padding: .75rem 1rem;
  font-size: .8125rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.notice {
  border-radius: var(--mx-radius);
  padding: .875rem 1rem;
  font-size: .875rem;
}
.notice-success { background: rgba(21, 128, 61, .12); color: #14532d; }
.notice-warning { background: rgba(245, 158, 11, .16); color: #78350f; }
.notice code { color: inherit; }

/* ---------- Admin ---------- */

.page-admin { padding-block: 2.5rem; }

.table-card {
  background: var(--mx-card);
  border-radius: calc(var(--mx-radius) + 8px);
  box-shadow: var(--mx-shadow-card);
  overflow: hidden;
}

.table-links {
  --bs-table-bg: var(--mx-card);
  --bs-table-color: var(--mx-foreground);
  font-size: .8125rem;
}
.table-links > :not(caption) > * > * {
  padding: .5rem .75rem;
  vertical-align: middle;
  white-space: nowrap;
}
.table-links > thead > tr > th {
  --bs-table-bg: var(--mx-primary);
  --bs-table-color: var(--mx-on-color);
  border-bottom: 0;
  font-weight: 700;
  padding-block: .75rem;
}
.table-links > tbody > tr:last-child > td { border-bottom: 0; }

.table-links .code-cell { font-weight: 700; color: var(--mx-primary); }
/* Takes the space the other columns leave and cuts long URLs with "…" (full URL in the tooltip) */
.table-links .url-cell {
  width: 100%;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-links .empty-cell {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--mx-muted-foreground);
}

.link-actions { display: flex; align-items: center; gap: .375rem; }
.btn-icon-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50rem;
  font-size: .875rem;
}

/* Below 992px: one card per link instead of a wide table (no horizontal scroll) */
@media (max-width: 991.98px) {
  .table-links,
  .table-links > tbody { display: block; }
  .table-links > thead { display: none; }
  .table-links > tbody > tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "code code"
      "url url"
      "created expires"
      "status actions";
    gap: .375rem 1rem;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--mx-border);
  }
  .table-links > tbody > tr:last-child { border-bottom: 0; }
  .table-links > :not(caption) > * > * {
    display: block;
    min-width: 0;
    padding: 0;
    border-bottom-width: 0;
  }
  .table-links .code-cell    { grid-area: code; }
  .table-links .url-cell     { grid-area: url; width: auto; max-width: none; color: var(--mx-muted-foreground); }
  .table-links .created-cell { grid-area: created; }
  .table-links .expires-cell { grid-area: expires; }
  .table-links .status-cell  { grid-area: status; align-self: center; }
  .table-links .actions-cell { grid-area: actions; justify-self: end; }
  .table-links .empty-cell   { grid-column: 1 / -1; padding: 2.5rem 0; }
  .table-links td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: .6875rem;
    font-weight: 700;
    color: var(--mx-muted-foreground);
  }
}

.status-badge {
  display: inline-block;
  border-radius: 50rem;
  padding: .25rem .625rem;
  font-size: .75rem;
  font-weight: 700;
}
.status-active   { background: var(--mx-success); color: var(--mx-on-color); }
.status-expired  { background: var(--mx-muted); color: var(--mx-muted-foreground); }
.status-disabled { background: var(--mx-destructive); color: var(--mx-on-color); }

/* ---------- Unavailable link ---------- */

.page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.unavailable-icon { font-size: 2.5rem; color: var(--mx-accent); }

@media (max-width: 400px) {
  .card-mx { padding: 1.5rem; }
}
