/*
 * Metrahit look for the Storage Box web page (SFTPGo web client).
 * Gunmetal + Lagoon from docs/theme.md, light and dark. Loaded after
 * SFTPGo's own CSS through its branding setting (sftpgo.env, EXTRA_CSS),
 * so it only overrides colors: layout stays SFTPGo's.
 * Plan: plans/branding/portal-theming-plan.md (approved 2026-11-29).
 */

/* Light */
:root,
[data-bs-theme=light] {
  --mh-bg: #ffffff;
  --mh-card: #f2f3f4;
  --mh-surface: #ffffff;
  --mh-text: #16181b;
  --mh-muted: #4b5158;
  --mh-border: #d9dcdf;
  --mh-field-border: #6e747a;
  --mh-accent: #0e7490;
  --mh-accent-hover: #155e75;
  --mh-accent-text: #ffffff;
  --mh-tint: #ecfeff;
  --mh-band: #141618;

  --bs-gray-100: #f2f3f4;
  --bs-gray-200: #e6e8ea;
  --bs-gray-300: #d9dcdf;
  --bs-gray-400: #c3c8cc;
  --bs-gray-500: #6e747a;
  --bs-gray-600: #4b5158;
  --bs-gray-700: #3a3f45;
  --bs-gray-800: #2a2d31;
  --bs-gray-900: #16181b;
  --bs-text-gray-100: #f2f3f4;
  --bs-text-gray-200: #e6e8ea;
  --bs-text-gray-300: #d9dcdf;
  --bs-text-gray-400: #6e747a;
  --bs-text-gray-500: #4b5158;
  --bs-text-gray-600: #4b5158;
  --bs-text-gray-700: #3a3f45;
  --bs-text-gray-800: #2a2d31;
  --bs-text-gray-900: #16181b;
  --bs-text-muted: #4b5158;
}

/* Dark */
[data-bs-theme=dark] {
  --mh-bg: #0b0c0d;
  --mh-card: #16181b;
  --mh-surface: #16181b;
  --mh-text: #e6e8ea;
  --mh-muted: #9ba1a7;
  --mh-border: #2a2d31;
  --mh-field-border: #6e747a;
  --mh-accent: #06b6d4;
  --mh-accent-hover: #22d3ee;
  --mh-accent-text: #0b0c0d;
  --mh-tint: rgb(34 211 238 / 0.14);
  --mh-band: #111315;

  --bs-gray-100: #16181b;
  --bs-gray-200: #202327;
  --bs-gray-300: #2a2d31;
  --bs-gray-400: #3a3f45;
  --bs-gray-500: #9ba1a7;
  --bs-gray-600: #9ba1a7;
  --bs-gray-700: #c3c8cc;
  --bs-gray-800: #d9dcdf;
  --bs-gray-900: #e6e8ea;
  --bs-text-gray-100: #16181b;
  --bs-text-gray-200: #202327;
  --bs-text-gray-300: #2a2d31;
  --bs-text-gray-400: #9ba1a7;
  --bs-text-gray-500: #9ba1a7;
  --bs-text-gray-600: #9ba1a7;
  --bs-text-gray-700: #c3c8cc;
  --bs-text-gray-800: #d9dcdf;
  --bs-text-gray-900: #e6e8ea;
  --bs-text-muted: #9ba1a7;
}

/* Both modes: SFTPGo's tokens from ours */
:root,
[data-bs-theme=light],
[data-bs-theme=dark] {
  --bs-body-bg: var(--mh-bg);
  --bs-app-bg-color: var(--mh-bg);
  --bs-app-blank-bg-color: var(--mh-bg);
  --bs-app-header-base-bg-color: var(--mh-bg);
  --bs-body-color: var(--mh-text);
  --bs-heading-color: var(--mh-text);
  --bs-border-color: var(--mh-border);
  --bs-card-bg: var(--mh-card);
  --bs-dropdown-bg: var(--mh-surface);
  --bs-menu-dropdown-bg-color: var(--mh-surface);

  --bs-primary: var(--mh-accent);
  --bs-primary-active: var(--mh-accent-hover);
  --bs-primary-inverse: var(--mh-accent-text);
  --bs-primary-light: var(--mh-tint);
  --bs-primary-clarity: rgb(6 182 212 / 0.2);
  --bs-text-primary: var(--mh-accent);
  --bs-link-color: var(--mh-accent);
  --bs-link-hover-color: var(--mh-accent-hover);
  --bs-component-active-bg: var(--mh-accent);
  --bs-component-active-color: var(--mh-accent-text);
  --bs-component-hover-color: var(--mh-accent);
  --bs-focus-ring-color: var(--mh-accent);

  --bs-app-sidebar-base-bg-color: var(--mh-band);
  --bs-app-sidebar-base-border-end: 1px solid #3a3f45;
}
[data-bs-theme=light] { --bs-primary-rgb: 14, 116, 144; --bs-link-color-rgb: 14, 116, 144; --bs-link-hover-color-rgb: 21, 94, 117; }
[data-bs-theme=dark] { --bs-primary-rgb: 6, 182, 212; --bs-link-color-rgb: 6, 182, 212; --bs-link-hover-color-rgb: 34, 211, 238; }

body { background-color: var(--mh-bg); color: var(--mh-text); }
a { color: var(--mh-accent); }
a:hover { color: var(--mh-accent-hover); }

/* Headings 700, as on every Metrahit surface */
h1, h2, h3, .card-title, .fw-bolder { font-weight: 700; }

/* Cards: the only gray in light mode, no border, no shadow */
.card {
  --bs-card-bg: var(--mh-card);
  --bs-card-border-color: transparent;
  --bs-card-box-shadow: none;
  background-color: var(--mh-card);
  box-shadow: none;
}
.card .card-header { border-bottom-color: var(--mh-border); }

/* Primary buttons: Lagoon, white text (dark text in dark mode) */
.btn.btn-primary {
  color: var(--mh-accent-text);
  background-color: var(--mh-accent);
  border-color: var(--mh-accent);
}
.btn.btn-primary:hover:not(.btn-active),
.btn.btn-primary:focus:not(.btn-active),
.btn.btn-primary:active,
.btn.btn-primary.active,
.btn-check:checked + .btn.btn-primary,
.show > .btn.btn-primary {
  color: var(--mh-accent-text);
  background-color: var(--mh-accent-hover) !important;
  border-color: var(--mh-accent-hover);
}
.btn.btn-primary i,
.btn.btn-primary .svg-icon,
.btn.btn-primary:hover:not(.btn-active) i { color: var(--mh-accent-text); }

/* Light-primary buttons and badges: tint with Lagoon text */
.btn.btn-light-primary,
.badge-light-primary {
  color: var(--mh-accent);
  background-color: var(--mh-tint);
}
.btn.btn-light-primary:hover:not(.btn-active) {
  color: var(--mh-accent-text);
  background-color: var(--mh-accent) !important;
}

/* Form controls: 1px outline that reaches 3:1, 2px Lagoon focus ring */
.form-control,
.form-select,
.form-control.form-control-solid,
.form-select.form-select-solid {
  background-color: var(--mh-surface);
  border: 1px solid var(--mh-field-border);
  color: var(--mh-text);
}
.form-control:focus,
.form-select:focus,
.form-control.form-control-solid:focus,
.form-select.form-select-solid:focus {
  background-color: var(--mh-surface);
  border-color: var(--mh-accent);
  box-shadow: 0 0 0 2px var(--mh-accent);
  outline: none;
}
.form-check-input,
.form-check.form-check-solid .form-check-input { border: 1px solid var(--mh-field-border); }
.form-check.form-check-solid .form-check-input:not(:checked) { background-color: var(--mh-surface); }
.form-check-input:indeterminate,
.form-check-solid .form-check-input[type=checkbox]:indeterminate {
  background-color: var(--mh-accent);
  border-color: var(--mh-accent);
}
.form-check-input:checked {
  background-color: var(--mh-accent);
  border-color: var(--mh-accent);
}
.form-control::placeholder { color: var(--bs-gray-500); }

:focus-visible { outline: 2px solid var(--mh-accent); outline-offset: 2px; }

/* Left menu: the dark band, white words, current item Lagoon on a tint.
   No left accent bar (docs/theme.md). */
.app-sidebar { border-right: 1px solid #3a3f45; }
.app-sidebar .text-sidebar { color: #ffffff; font-weight: 700; }
/* The bolt: gunmetal on light pages, lighter on dark ones, white on the band */
[data-bs-theme=dark] img[alt=Logo] { content: url("bolt-dark.svg"); }
.app-sidebar-logo img,
[data-bs-theme=dark] .app-sidebar-logo img { content: url("bolt-white.svg"); }
.app-sidebar .menu .menu-item .menu-link,
.app-sidebar .menu .menu-item .menu-link .menu-title,
.app-sidebar .menu .menu-item .menu-link .menu-icon i { color: #ffffff; }
.app-sidebar .menu .menu-item .menu-link:hover:not(.active) {
  background-color: rgb(255 255 255 / 0.06);
}
.app-sidebar .menu .menu-item .menu-link.active,
.app-sidebar .menu .menu-item .menu-link.active .menu-title,
.app-sidebar .menu .menu-item .menu-link.active .menu-icon i {
  color: #67e8f9;
}
.app-sidebar .menu .menu-item .menu-link.active { background-color: rgb(34 211 238 / 0.14); }
.app-sidebar .menu .menu-heading,
.app-sidebar .menu .menu-section { color: #c5cad0; }

/* Tables: thin lines, subtle hover */
.table { --bs-table-color: var(--mh-text); }
.table > :not(caption) > * > * { border-bottom-color: var(--mh-border); }
.table.table-hover > tbody > tr:hover > * { --bs-table-hover-bg: var(--bs-gray-200); }
table.dataTable > thead > tr > th { color: var(--mh-muted); }

.text-muted { color: var(--mh-muted) !important; }
.text-primary { color: var(--mh-accent) !important; }
.bg-primary { background-color: var(--mh-accent) !important; }

/* No glows or heavy shadows */
.shadow, .shadow-sm, .shadow-lg, .menu-sub-dropdown { box-shadow: 0 1px 2px rgb(0 0 0 / 0.08) !important; }
