/* ===================================================================
   VueXR Context Menu Styling
=================================================================== */

/* ---------- menu container ---------- */
#vuexr-context-menu {
    position: fixed;
    z-index: 99999;
    min-width: 220px;
    max-width: 300px;
    background: rgba(28, 28, 28, 0.97);
    border-radius: 12px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.72),
        0 2px 8px rgba(0, 0, 0, 0.48),
        inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    padding: 6px 0;
    opacity: 0;
    transform: scale(0.92) translateY(-6px);
    transform-origin: top left;
    transition:
        opacity 0.13s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.13s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* prevent layout bleed caused by the Unity canvas stacking context */
    isolation: isolate;
}

#vuexr-context-menu.cm-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* ---------- separator ---------- */
.cm-separator {
    height: 1px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.10);
}

/* ---------- menu item ---------- */
.cm-item {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    padding: 10px 18px;
    color: #f1f1f1;
    font-family: Roboto-Light, 'Roboto', 'Arial', sans-serif;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    position: relative;
    transition: background 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* prevent inherited link underline in case the parent has one */
    text-decoration: none;
}

/* Keyboard focus: use :focus-visible where supported, fall back to :focus */
.cm-item:focus {
    background: rgba(255, 255, 255, 0.10);
    outline: none;
}

.cm-item:hover,
.cm-item:focus-visible {
    background: rgba(255, 255, 255, 0.10);
    outline: none;
}

.cm-item:active {
    background: rgba(255, 255, 255, 0.16);
}

/* ---------- item icon ---------- */
.cm-icon {
    -webkit-box-flex: 0;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    color: #e8e8e8;
    opacity: 0.88;
    /* gap fallback: push label away from icon via margin */
    margin-right: 14px;
}

.cm-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    overflow: visible;
}

/* ---------- item label ---------- */
.cm-label {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    font-family: Roboto-Light, 'Roboto', 'Arial', sans-serif;
    font-size: 14px;
    color: #f1f1f1;
    letter-spacing: 0.01em;
}

/* ---------- toast notification ---------- */
#vuexr-cm-toast {
    position: fixed;
    bottom: 36px;
    left: 50%;
    -webkit-transform: translateX(-50%) translateY(12px);
    transform: translateX(-50%) translateY(12px);
    z-index: 100000;
    background: rgba(32, 32, 32, 0.96);
    color: #f1f1f1;
    font-family: Roboto-Medium, 'Roboto', 'Arial', sans-serif;
    font-size: 13px;
    padding: 9px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.18s ease,
        -webkit-transform 0.18s ease,
        transform 0.18s ease;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

#vuexr-cm-toast.cm-toast-visible {
    opacity: 1;
    -webkit-transform: translateX(-50%) translateY(0);
    transform: translateX(-50%) translateY(0);
}

/* ---------- Stats for Nerds panel ---------- */
#vuexr-stats-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%) scale(0.94);
    transform: translate(-50%, -50%) scale(0.94);
    z-index: 99998;
    /* min() fallback for older browsers */
    width: 92vw;
    max-width: 420px;
    background: rgba(18, 18, 18, 0.97);
    border-radius: 14px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.80),
        inset 0 0 0 1px rgba(255, 255, 255, 0.07);
    padding: 24px 26px 20px;
    box-sizing: border-box;
    color: #e0e0e0;
    font-family: Roboto-Light, 'Roboto', 'Arial', sans-serif;
    font-size: 13px;
    line-height: 1.7;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.16s ease,
        -webkit-transform 0.16s ease,
        transform 0.16s ease;
}

#vuexr-stats-panel.cm-panel-visible {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

#vuexr-stats-panel .sp-title {
    font-family: Roboto-Medium, 'Roboto', 'Arial', sans-serif;
    font-size: 15px;
    color: #ffffff;
    margin-bottom: 14px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
}

#vuexr-stats-panel .sp-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    padding: 0;
    line-height: 1;
    font-size: 20px;
    transition: color 0.12s;
}

#vuexr-stats-panel .sp-close-btn:hover {
    color: #fff;
}

#vuexr-stats-panel .sp-row {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-align: baseline;
    -ms-flex-align: baseline;
    align-items: baseline;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#vuexr-stats-panel .sp-row:last-of-type {
    border-bottom: none;
}

#vuexr-stats-panel .sp-key {
    color: #9e9e9e;
    font-family: Roboto-Light, 'Roboto', 'Arial', sans-serif;
    -webkit-box-flex: 0;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    /* gap fallback */
    margin-right: 12px;
}

#vuexr-stats-panel .sp-val {
    font-family: Roboto-Medium, 'Roboto', 'Arial', sans-serif;
    color: #e8e8e8;
    text-align: right;
    word-break: break-all;
}

/* ---------- backdrop for Stats panel ---------- */
#vuexr-stats-backdrop {
    position: fixed;
    /* inset: 0 fallback for Safari < 14 */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99997;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

#vuexr-stats-backdrop.cm-panel-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Help image panel ---------- */
#vuexr-help-backdrop {
    position: fixed;
    /* inset: 0 fallback for Safari < 14 */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99997;
    background: rgba(0, 0, 0, 0.72);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

#vuexr-help-backdrop.cm-panel-visible {
    opacity: 1;
    pointer-events: auto;
}

#vuexr-help-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%) scale(0.94);
    transform: translate(-50%, -50%) scale(0.94);
    z-index: 99998;
    /* min() fallback for older browsers */
    width: 90vw;
    max-width: 680px;
    background: #000000;
    border-radius: 16px;
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.85),
        inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    padding: 18px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.18s ease,
        -webkit-transform 0.18s ease,
        transform 0.18s ease;
}

#vuexr-help-panel.cm-panel-visible {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

#vuexr-help-panel .hp-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.75);
    background: transparent;
    color: #ffffff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    transition:
        background 0.13s ease,
        border-color 0.13s ease;
    z-index: 1;
}

#vuexr-help-panel .hp-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #ffffff;
}

#vuexr-help-panel .hp-close-btn:active {
    background: rgba(255, 255, 255, 0.22);
}

#vuexr-help-panel .hp-img {
    display: block;
    width: 100%;
    height: auto;
    background: transparent;
    /* top padding clears the close button; sides/bottom prevent corner clipping */
    padding: 46px 4px 4px;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

/* ---------- touch long-press hint (mobile) ---------- */
@media (hover: none) and (pointer: coarse) {
    /* no additional adjustments needed; the JS handles long-press trigger */
}
