/* Wazuh brand tokens/components sourced from web/BRANDING.md — keep in sync with that file. */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --wazuh-blue: #3585F9;
  --wazuh-yellow: #FEDD0B;
  --wazuh-black: #000000;
  --wazuh-gray: #F9F9F9;

  --ter-teal: #2DA4AA;
  --ter-red: #E55C42;

  --blue: var(--wazuh-blue);
  --blue-hover: #256BD1;
  --blue-text: #215FBE;    /* darker text/border-text variant of --blue: ~6:1 on white, meets AA */
  --alert-text: #B23A22;   /* darker text variant of --alert for AA on its light badge/banner bg */
  --amber-text: #7A5F00;   /* darker text variant for the amber "degraded" badge, AA on its bg */
  --ink: var(--wazuh-black);
  --slate: #5e6b7a;
  --border: #e8edf5;
  --page: var(--wazuh-gray);
  --white: #FFFFFF;
  --alert: var(--ter-red);
  --mint: var(--ter-teal);
  --yellow: var(--wazuh-yellow);
  --radius: 12px;
  --radius-sm: 8px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* guard against .row/.flex utility classes on the same element */
body {
  margin: 0;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
/* ---------------------------------------------------------------- app shell
   Fixed-width sidebar + fluid content, expressed as a two-track CSS grid so
   collapsing is just a first-track width change. */
:root { --sidebar-w: 248px; --rail-w: 68px; --sidebar-bg: var(--wazuh-blue); }
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }
body.no-nav .app-shell { grid-template-columns: 1fr; }              /* login / unauthenticated */
body.sidebar-collapsed .app-shell { grid-template-columns: var(--rail-w) 1fr; }
.content { min-width: 0; display: flex; flex-direction: column; }   /* min-width:0 keeps wide <pre>/tables from blowing out the grid */

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sidebar :focus-visible, .mobilebar :focus-visible { outline-color: var(--white); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 100;
  background: var(--white); color: var(--blue-text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; font-weight: 700; font-size: 14px; text-decoration: none;
  transition: top .15s;
}
.skip-link:focus { top: 8px; }

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100dvh; overflow-y: auto;
  background: var(--sidebar-bg); color: var(--white);
  display: flex; flex-direction: column;
  padding: 14px 12px;
}
.sidebar__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--white); font-size: 17px; text-decoration: none; }
.brand__logo { height: 26px; filter: brightness(0) invert(1); }

/* Sidebar brand: big logo on top, "Training Console" as a small caption below it */
.sidebar__head .brand { flex-direction: column; align-items: flex-start; gap: 6px; }
.sidebar__head .brand__logo { height: 42px; }
.sidebar__head .brand__text {
  font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: rgba(255,255,255,.92);
}
.sidebar__head .rail-toggle { margin-top: 4px; }
.rail-toggle, .hamburger {
  background: transparent; border: 0; color: var(--white); cursor: pointer;
  padding: 6px; border-radius: var(--radius-sm); display: inline-flex; line-height: 0;
}
.rail-toggle:hover, .hamburger:hover { background: rgba(255,255,255,.14); }
.ico { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Deploy: primary call-to-action, pinned above the nav groups */
.deploy-cta {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--yellow); color: var(--wazuh-black);
  border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 16px;
  font-weight: 800; font-size: 15px; text-decoration: none; transition: transform .12s, box-shadow .12s;
}
.deploy-cta:hover { background: #f0d100; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,.18); }
.deploy-cta.active { box-shadow: 0 0 0 2px rgba(255,255,255,.65) inset; }

.sidebar__nav { display: flex; flex-direction: column; gap: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group--config { margin-top: auto; }                            /* Settings pinned low */
.nav-group__label {
  margin: 4px 0 4px 12px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: rgba(255,255,255,.92);
}
.navlink, .footer-link {
  display: flex; align-items: center; gap: 12px; position: relative;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--white); text-decoration: none;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background .15s, color .15s;
}
.navlink:hover, .footer-link:hover { background: rgba(255,255,255,.14); }
.navlink.active { background: var(--white); color: var(--sidebar-bg); font-weight: 700; }
.navlink.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--yellow);
}

/* Footer: system status + session, segregated from navigation */
.sidebar__footer {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.2);
  display: flex; flex-direction: column; gap: 10px;
}
.sidebar__footer .badge { align-self: flex-start; }
.who { display: flex; flex-direction: column; padding: 0 12px; line-height: 1.3; color: var(--white); }
.who__name { font-weight: 700; font-size: 14px; }
.who__role { font-size: 12px; opacity: .8; text-transform: capitalize; }

/* Collapsed icon-rail (desktop): hide text, center glyphs */
body.sidebar-collapsed .brand__text,
body.sidebar-collapsed .navlink__label,
body.sidebar-collapsed .nav-group__label,
body.sidebar-collapsed .who,
body.sidebar-collapsed .sidebar__footer .badge { display: none; }
body.sidebar-collapsed .sidebar__head { justify-content: center; }
body.sidebar-collapsed .brand { display: none; }                       /* hide brand in the rail… */
body.sidebar-collapsed .rail-toggle .ico { transform: rotate(180deg); } /* …keep the toggle; chevron now points right = expand */
body.sidebar-collapsed .deploy-cta,
body.sidebar-collapsed .navlink,
body.sidebar-collapsed .footer-link { justify-content: center; padding: 10px 0; gap: 0; }

/* Mobile top bar (shown only under the breakpoint) */
.mobilebar { display: none; }

/* ---------------------------------------------------------------- content */
main { max-width: 980px; width: 100%; margin: 24px auto; padding: 0 24px; }

/* ---------------------------------------------------------------- responsive
   Below 768px the sidebar becomes an off-canvas drawer behind a hamburger. */
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .mobilebar { display: flex; align-items: center; gap: 12px; background: var(--sidebar-bg); color: var(--white); padding: 10px 14px; }
  .mobilebar .brand__logo { height: 30px; }
  .mobilebar .brand__text {
    font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: rgba(255,255,255,.92);
  }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: 82%; max-width: 300px;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  /* a desktop-collapsed body must still show full labels inside the mobile drawer */
  body.sidebar-collapsed .brand,
  body.sidebar-collapsed .brand__text,
  body.sidebar-collapsed .navlink__label,
  body.sidebar-collapsed .nav-group__label,
  body.sidebar-collapsed .who,
  body.sidebar-collapsed .sidebar__footer .badge { display: revert; }
  body.sidebar-collapsed .rail-toggle .ico { transform: none; }
  body.sidebar-collapsed .deploy-cta,
  body.sidebar-collapsed .navlink,
  body.sidebar-collapsed .footer-link { justify-content: flex-start; padding: 9px 12px; gap: 12px; }
  .scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); }
  .scrim[hidden] { display: none; }
  main { margin: 16px auto; padding: 0 16px; }
}
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.card.narrow { max-width: 420px; margin: 40px auto; }
/* Login: logo at natural color on the card's white background, per BRANDING.md (logo's preferred
   use is on white) — unlike the sidebar brand, which inverts it to white for the blue rail. */
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand__logo { height: 44px; }
.login-brand__subtitle {
  margin: 10px 0 0; font-size: 15px; font-weight: 700; color: var(--slate);
  letter-spacing: .01em;
}
.subcard { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; margin: 10px 0; }
h1 { font-size: 22px; font-weight: 800; margin-top: 0; }
h2 { font-size: 17px; font-weight: 700; }
label { display: block; margin: 10px 0; font-size: 14px; color: var(--slate); font-weight: 500; }
label.check { display: flex; align-items: center; gap: 8px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
}
label.check input { width: auto; margin: 0; }
.row { display: flex; gap: 14px; }
.row label { flex: 1; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 14px 0; padding: 6px 14px 14px; }
legend { color: var(--blue-text); font-weight: 700; padding: 0 6px; }
details { margin: 14px 0; }
summary { cursor: pointer; color: var(--slate); font-weight: 600; }
button, .btn {
  display: inline-block; border: 1.5px solid var(--blue); background: var(--white); color: var(--blue-text);
  border-radius: var(--radius-sm); padding: 9px 18px; font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; text-decoration: none; transition: all .15s;
}
.btn:hover { background: rgba(53,133,249,.08); }
/* Primary CTA per BRANDING.md: yellow fill, black text, no border. */
button.primary, .btn.primary { background: var(--yellow); color: var(--wazuh-black); border: none; }
button.primary:hover { background: #f0d100; transform: translateY(-1px); }
button.danger { border-color: var(--alert); color: var(--alert-text); }
.note { color: var(--slate); font-size: 13px; }
.error { color: var(--alert-text); background: #FCEEEB; border: 1px solid var(--alert); border-radius: var(--radius-sm); padding: 8px 12px; }
.ok { color: #1f7a5c; background: #E4F5F4; border: 1px solid var(--mint); border-radius: var(--radius-sm); padding: 8px 12px; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--slate); font-weight: 700; }
.log {
  background: #0f1420; color: #d7e0ee; border-radius: var(--radius-sm); padding: 12px;
  font-family: Consolas, "JetBrains Mono", monospace; font-size: 12.5px;
  max-height: 460px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
/* Pills/badges: full-capsule per BRANDING.md. */
.badge { font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 9999px; vertical-align: middle; }
.badge-pending { background: var(--wazuh-gray); color: var(--slate); }
.badge-running { background: #E7F0FE; color: var(--blue-text); }
.badge-succeeded { background: #E4F5F4; color: #1f7a5c; }
.badge-degraded { background: #FCF3D9; color: var(--amber-text); }
.badge-failed { background: #FCEEEB; color: var(--alert-text); }
.badge-stopped { background: #ECEFF3; color: var(--slate); }

/* --- Documentation (in-app help): left section index + rendered Markdown content --- */
.docs-layout { display: grid; grid-template-columns: 220px 1fr; gap: 28px; margin-top: 10px; }
.docs-nav { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border); padding-right: 12px; }
.docs-nav__link { padding: 7px 10px; border-radius: var(--radius-sm); color: var(--slate); text-decoration: none; font-size: 14px; }
.docs-nav__link:hover { background: var(--wazuh-gray); color: var(--ink); }
.docs-nav__link.active { background: #E7F0FE; color: var(--blue-text); font-weight: 600; }
.docs-content { min-width: 0; }
.docs-content h1:first-child { margin-top: 0; }
.docs-content h2 { margin-top: 28px; }
.docs-content h3 { margin-top: 20px; }
.docs-content p, .docs-content li { line-height: 1.55; }
.docs-content code { background: var(--wazuh-gray); padding: 1px 5px; border-radius: 4px;
  font-family: Consolas, "JetBrains Mono", monospace; font-size: 13px; }
.docs-content pre.log code { background: none; padding: 0; }
.docs-content a { color: var(--blue-text); }
@media (max-width: 720px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-nav { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 10px; }
}
