/*
 * we-design-chrome.css
 *
 * Standardised look-and-feel for the design-mode page chrome:
 *   • Generic icon class (`<svg class="we-icon"><use href="#we-icon-…"/></svg>`)
 *   • Tooltips (`[data-tooltip]` floating chip)
 *   • Keyboard-shortcut help overlay (triggered by `?`)
 *   • A small set of chrome-button utility classes that the existing
 *     left-info-panel / right-info-panel buttons can adopt
 *     incrementally without a structural rewrite.
 *
 * Loaded BEFORE the legacy widget chrome stylesheet (mcw-widgets.css)
 * so its more specific selectors still win when both target the same
 * element.
 */

/* ── Icon primitive ──────────────────────────────────────────────────── */
/* The sprite is injected at boot by `WeIcons.install()` in
   `we-design-chrome.js`. Use as:
     <svg class="we-icon"><use href="#we-icon-edit"/></svg>
   Override size with `we-icon--lg` / `we-icon--sm`. */

.we-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    fill: currentColor;
    color: inherit;
    flex-shrink: 0;
}

.we-icon--sm { width: 12px; height: 12px; }
.we-icon--lg { width: 20px; height: 20px; }

/* ── Standardised chrome button ───────────────────────────────────────── */
/* Base button shape that any design-mode action can adopt by adding
   `.we-chrome-btn`. Keeps consistent padding, hover, focus ring across
   pens, move arrows, delete buttons, etc. */

.we-chrome-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 6px;
    min-width: 26px;
    min-height: 26px;
    background: rgba(255, 255, 255, 0.95);
    color: #455a64;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    line-height: 1;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.we-chrome-btn:hover {
    background: #1565c0;
    border-color: #1565c0;
    color: #ffffff;
}

.we-chrome-btn:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 1px;
}

.we-chrome-btn--danger:hover {
    background: #c62828;
    border-color: #c62828;
}

/* ── Tooltip ──────────────────────────────────────────────────────────── */

.we-tooltip {
    position: fixed;
    transform: translate(-50%, 0);
    padding: 4px 8px;
    background: rgba(15, 23, 42, 0.92);
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 11px;
    line-height: 1.3;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 80ms ease;
    z-index: 10000;
    white-space: nowrap;
    max-width: 280px;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.25);
}

.we-tooltip.is-visible { opacity: 1; }

/* ── Keyboard-shortcut help overlay (triggered by `?`) ────────────────── */

.we-shortcut-help {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 280px;
    background: #ffffff;
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1f2328;
    overflow: hidden;
    animation: we-shortcut-help-in 160ms ease;
}

@keyframes we-shortcut-help-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.we-shortcut-help header {
    padding: 10px 14px;
    background: #f5f7fa;
    border-bottom: 1px solid #e3e8ef;
    font-size: 13px;
    font-weight: 600;
}

.we-shortcut-help dl {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 6px 12px;
    padding: 12px 14px;
    margin: 0;
    font-size: 12px;
}

.we-shortcut-help dt { margin: 0; }
.we-shortcut-help dd { margin: 0; color: #455a64; }

.we-shortcut-help kbd {
    display: inline-block;
    min-width: 24px;
    padding: 2px 6px;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 11px;
    color: #1f2328;
    background: #f5f7fa;
    border: 1px solid #cfd8dc;
    border-bottom-width: 2px;
    border-radius: 4px;
    text-align: center;
}

.we-shortcut-help footer {
    padding: 8px 14px;
    background: #fafbfc;
    border-top: 1px solid #e3e8ef;
    font-size: 11px;
    color: #586069;
    font-style: italic;
}
