/*
 * BóHub layer on top of the Structurizr static viewer:
 * app palette (pos-app/app/globals.css), toolbar, hover focus, Arabic typography.
 */

:root,
:root[data-theme="dark"] {
    --bg: #0f0c0a;
    --surface: #181310;
    --surface-2: #221b15;
    --line: #33281f;
    --text: #f6ecdd;
    --text-dim: #a8927c;
    --accent: #e0a264;
    --accent-strong: #c77f3c;
    --accent-ink: #201409;
}

:root[data-theme="light"] {
    --bg: #f7f2ea;
    --surface: #ffffff;
    --surface-2: #f1e8db;
    --line: #e0d3c1;
    --text: #241a12;
    --text-dim: #6f5b48;
    --accent: #8f5518;
    --accent-strong: #74400f;
    --accent-ink: #fffaf3;
}

body,
#diagram,
.structurizrDiagramViewport {
    background: var(--bg) !important;
}

body {
    font-family: "Cairo", "Open Sans", "Segoe UI", sans-serif;
    color: var(--text);
}

/* ------------------------------------------------------------------ toolbar */

.bohub-toolbar {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    font-family: "Cairo", "Open Sans", sans-serif;
    /* Stays out of the way of tall diagrams until you reach for it. */
    opacity: 0.55;
    transition: opacity 0.15s ease;
}

.bohub-toolbar:hover,
.bohub-toolbar:focus-within {
    opacity: 1;
}

.bohub-group {
    display: flex;
    gap: 4px;
}

.bohub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-dim);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.bohub-btn:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.bohub-btn.is-off {
    opacity: 0.45;
}

.bohub-lang {
    border-color: var(--line);
    background: var(--accent);
    color: var(--accent-ink);
}

.bohub-lang:hover {
    background: var(--accent-strong);
    color: var(--accent-ink);
}

.bohub-select {
    max-width: 320px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.bohub-select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

@media (max-width: 720px) {
    .bohub-select { max-width: 140px; }
    .bohub-toolbar { gap: 4px; padding: 5px; }
}

/* --------------------------------------------------------------- hover focus */

#diagram g.joint-element,
#diagram g.joint-link {
    transition: opacity 0.12s ease;
}

#diagram .bohub-fade {
    opacity: 0.15;
}

#diagram .bohub-link-on path.connection {
    stroke: var(--accent) !important;
    stroke-width: 4 !important;
}

#diagram .bohub-link-on .marker-target,
#diagram .bohub-link-on .marker-source {
    fill: var(--accent) !important;
    stroke: var(--accent) !important;
}

#diagram .bohub-link-on text {
    fill: var(--accent) !important;
}

#diagram .bohub-node-on {
    filter: drop-shadow(0 0 14px rgba(224, 162, 100, 0.55));
}

/* ------------------------------------------------------------------- Arabic */

/* The viewer draws diagram/boundary labels with text-anchor:start. Inheriting
   dir=rtl flips their base direction and pushes them off the left edge of the
   canvas, so pin the SVG text base direction back to ltr — Arabic runs still
   shape right-to-left inside it. */
html[dir="rtl"] #diagram svg text,
html[dir="rtl"] #diagramKey svg text {
    direction: ltr;
}

html[dir="rtl"] .modal-header,
html[dir="rtl"] .modal-footer {
    flex-direction: row-reverse;
}

/* --------------------------------------------------------------- modals etc */

.modal-content {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    font-family: "Cairo", "Open Sans", sans-serif;
}

.modal-content code {
    color: var(--accent);
}

.modal-content .btn-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
}

#tooltip {
    font-family: "Cairo", "Open Sans", sans-serif;
}
