/* Playground layout: sidebar + content side by side */
main:has(.ref-sidebar) {
    flex-direction: row !important;
}

.playground-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* Command reference sidebar */
.ref-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #181825;
    border-right: 1px solid #313244;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease;
}

.ref-sidebar.collapsed {
    width: 32px;
}

.ref-sidebar.collapsed .ref-list {
    display: none;
}

.ref-header {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #89b4fa;
    cursor: pointer;
    border-bottom: 1px solid #313244;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
}

.ref-sidebar.collapsed .ref-header {
    justify-content: center;
    padding: 10px 6px;
}

.ref-header:hover { color: #74c7ec; }

.ref-expanded-label {
    display: inline;
}

.ref-collapsed-label {
    display: none;
    font-size: 14px;
}

.ref-sidebar.collapsed .ref-expanded-label {
    display: none;
}

.ref-sidebar.collapsed .ref-collapsed-label {
    display: inline;
}

.ref-chevron {
    font-size: 10px;
    color: #6c7086;
}

.ref-list {
    overflow-y: auto;
    flex: 1;
    padding: 4px 0;
}

.ref-section {
    padding: 12px 12px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #89b4fa;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 4px;
    border-top: 1px solid #313244;
    margin-top: 4px;
}

.ref-section:first-child {
    border-top: none;
    margin-top: 0;
}

.ref-section:hover { color: #74c7ec; }

.ref-section-chevron {
    font-size: 8px;
    display: inline-block;
}

.ref-group {
    overflow: hidden;
}

.ref-group.collapsed {
    display: none;
}

.ref-item {
    padding: 4px 12px 4px 20px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 11px;
    color: #a6adc8;
    cursor: pointer;
    transition: color 0.1s;
}

.ref-item:hover {
    color: #a6e3a1;
    background: rgba(166, 227, 161, 0.05);
}

.ref-item-linux {
    opacity: 0.5;
}

.ref-item-linux:hover {
    opacity: 0.8;
}

.ref-linux-badge {
    font-size: 9px;
    color: #a6adc8;
    background: #45475a;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    vertical-align: 1px;
    font-weight: 600;
}

/* Popup overlay */
.ref-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
}

/* Popup */
.ref-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    background: #1e1e2e;
    border: 1px solid #313244;
    border-radius: 12px;
    padding: 24px;
    z-index: 201;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.ref-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #313244;
}

.ref-popup-name {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 18px;
    font-weight: 600;
    color: #a6e3a1;
    margin-bottom: 4px;
}

.ref-popup-sig {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: #585b70;
    margin-bottom: 6px;
}

.ref-popup-actions {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(148, 226, 213, 0.1);
    border: 1px solid rgba(148, 226, 213, 0.2);
    border-radius: 999px;
    font-size: 11px;
    color: #94e2d5;
}

.ref-popup-close {
    background: none;
    border: none;
    color: #6c7086;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s;
}

.ref-popup-close:hover { color: #cdd6f4; }

.ref-popup-desc {
    font-size: 13px;
    color: #a6adc8;
    line-height: 1.6;
    margin-bottom: 12px;
}

.ref-popup-trybar {
    margin-bottom: 16px;
}

.ref-try-btn {
    background: #89b4fa;
    color: #1e1e2e;
    border: none;
    padding: 6px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.ref-try-btn:hover { background: #74c7ec; }

.ref-linux-note {
    display: inline-block;
    font-size: 12px;
    color: #f9e2af;
    background: rgba(249, 226, 175, 0.1);
    border: 1px solid rgba(249, 226, 175, 0.2);
    padding: 4px 12px;
    border-radius: 6px;
    font-style: normal;
    font-weight: 500;
}

.ref-popup-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ref-popup-card {
    background: #11111b;
    border: 1px solid #313244;
    border-radius: 8px;
    overflow: hidden;
}

.ref-popup-card-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: #181825;
    border-bottom: 1px solid #313244;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #585b70;
}

.ref-copy-btn {
    background: transparent;
    color: #45475a;
    border: 1px solid #313244;
    border-radius: 4px;
    padding: 1px 8px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.ref-copy-btn:hover { color: #cdd6f4; border-color: #45475a; }

.ref-popup-code {
    padding: 14px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.7;
    color: #cdd6f4;
    white-space: pre-wrap;
    margin: 0;
}

/* Flags in popup */
.ref-popup-flags {
    margin-bottom: 12px;
    background: #181825;
    border: 1px solid #313244;
    border-radius: 6px;
    overflow: hidden;
    display: inline-block;
}

.ref-popup-flags-table {
    border-collapse: collapse;
}

.ref-popup-flags-header th {
    padding: 5px 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #585b70;
    text-align: left;
    border-bottom: 1px solid #313244;
}

.ref-popup-flags-table td {
    padding: 4px 12px;
    font-size: 12px;
    border-bottom: 1px solid #1e1e2e;
}

.ref-popup-flags-table td:first-child,
.ref-popup-flags-table td:nth-child(2) {
    white-space: nowrap;
}

.ref-popup-flags-table td code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 11px;
    color: #cba6f7;
}

.ref-popup-flags-table td:last-child {
    color: #a6adc8;
}
