/* === Right overlay panel (slides over chat) === */

.right-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 90vw;
    height: 100vh;
    background: #050712;
    color: #f5f5ff;
    box-shadow: -14px 0 40px rgba(0, 0, 0, 0.65);
    border-left: 1px solid rgba(255, 255, 255, 0.10);
    transform: translateX(100%);
    transition: transform 0.22s ease-out;
    display: flex;
    flex-direction: column;
    z-index: 9999;
}

.right-panel.open {
    transform: translateX(0);
}

.right-panel-header {
    height: 52px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.right-panel-title {
    font-size: 14px;
    font-weight: 600;
}

.right-panel-close {
    background: transparent;
    border: none;
    color: #f5f5ff;
    font-size: 18px;
    cursor: pointer;
}

.right-panel-body {
    flex: 1 1 auto;
    padding: 10px 10px 14px;

    /* Correct scrolling behavior */
    overflow-y: auto;
    overflow-x: hidden;

    /* Fix: prevents content from overflowing below screen */
    min-height: 0;
    max-height: calc(var(--vh) * 100 - 56px);
    /* 56px = your top bar height */

    /* Smooth mobile scrolling */
    -webkit-overflow-scrolling: touch;

    background: rgba(255, 255, 255, 0.015);
    /* optional, remove if not needed */
}

/* Simple panel sections */
.panel-section {
    margin-bottom: 12px;
}

.panel-section h4 {
    margin: 0 0 6px;
    font-size: 13px;
    opacity: 0.9;
}

/* Backdrop on mobile for dimming chat when panel open */
@media (max-width: 900px) {
    .right-panel-backdrop {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 9998;
        display: none;
    }

    .right-panel-backdrop.visible {
        display: block;
    }
}

/* Prevent backdrop from blocking chat scrolling */
.right-panel-backdrop {
    pointer-events: none;
}

.right-panel-backdrop.visible {
    pointer-events: auto;
    /* Optional: Allow closing by tapping outside */
}