/*
 * GL→source sidepanel (Phase 7a)
 * Slides in from the trailing edge of the viewport. LTR anchors right; RTL anchors left
 * via [dir="rtl"]. Sits at z-index 1035 — above page content (header 1030) and below
 * Bootstrap modal backdrop (1040), so modals opened from inside the panel render on top.
 */

.gl-sidepanel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1034;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.gl-sidepanel-backdrop.open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0s linear 0s;
}

.gl-sidepanel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 600px;
    max-width: 90vw;
    background: var(--ab-surface-card, #ffffff);
    border-left: 1px solid var(--ab-surface-border, #e2e8f0);
    box-shadow: -8px 0 24px rgba(15, 23, 42, 0.08);
    z-index: 1035;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

.gl-sidepanel.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.25s ease, visibility 0s linear 0s;
}

/* RTL: anchor on the left, slide from the left */
[dir="rtl"] .gl-sidepanel {
    right: auto;
    left: 0;
    border-left: 0;
    border-right: 1px solid var(--ab-surface-border, #e2e8f0);
    box-shadow: 8px 0 24px rgba(15, 23, 42, 0.08);
    transform: translateX(-100%);
}

[dir="rtl"] .gl-sidepanel.open {
    transform: translateX(0);
}

.gl-sidepanel-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ab-surface-border, #e2e8f0);
    background: var(--ab-surface-card, #ffffff);
}

.gl-sidepanel-title {
    font-weight: 600;
    color: var(--ab-text-primary, #0f172a);
    font-size: 15px;
}

.gl-sidepanel-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gl-sidepanel-actions .gl-sidepanel-fullpage,
.gl-sidepanel-actions .gl-sidepanel-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 0;
    background: transparent;
    color: var(--ab-text-secondary, #475569);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.gl-sidepanel-actions .gl-sidepanel-fullpage:hover,
.gl-sidepanel-actions .gl-sidepanel-close:hover {
    background: var(--ab-surface-hover, #f1f5f9);
    color: var(--ab-text-primary, #0f172a);
    text-decoration: none;
}

.gl-sidepanel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    background: var(--ab-surface-bg, #f8fafc);
}

.gl-sidepanel-body .gl-sidepanel-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--ab-text-tertiary, #94a3b8);
}

.gl-sidepanel-body .gl-sidepanel-error {
    text-align: center;
    padding: 60px 20px;
    color: var(--ab-text-secondary, #475569);
}
