/*
 * ============================================================
 * Org Drawer — Slide-out Organization Switcher
 * ============================================================
 *
 * Purpose:
 *   Styles for the org-switcher drawer: overlay, slide-out panel,
 *   org list items, search, role badges, and keyboard navigation.
 *
 * Extracted from style.css to reduce monolith size.
 *
 * How to undo:
 *   Move these styles back into style.css and remove the
 *   <link> in index.html.
 */

/* --- Org Switcher Overlay --- */
.org-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10500;
    display: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.org-drawer-overlay.show {
    display: block;
    opacity: 1;
}

/* --- Org Switcher Drawer (Slide-out) --- */
.org-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: var(--bg-elevated);
    border-right: 1px solid var(--line-stark);
    z-index: 11000;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.2s ease-out;
    /* NOTE: will-change: transform removed — Chrome/Blink hoists position:fixed
       elements with will-change into a separate compositing layer that escapes
       overflow:hidden clipping, causing visible horizontal scroll on Android. */
}

.org-drawer.show {
    transform: translateX(0);
}

.org-drawer-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.org-drawer-header h3 {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin: 0;
}

.org-drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.org-drawer-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-display);
}

.org-drawer-search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-subtle);
}

.org-drawer-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line-subtle);
    border-radius: 6px;
    padding: 8px 10px 8px 32px;
    color: var(--text-body);
    font-size: 0.8rem;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
}

.org-drawer-search input:focus {
    outline: none;
    border-color: var(--primary);
    background-color: rgba(var(--primary-rgb), 0.03);
}

.org-drawer-search input::placeholder {
    color: var(--text-subtle);
}

.org-drawer-footer {
    padding: 16px;
    border-top: 1px solid var(--line-subtle);
    background: rgba(0, 0, 0, 0.2);
    margin-top: auto;
}

.org-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    max-height: 280px;
}

.org-drawer-section {
    padding: 8px 12px 4px;
}

.org-drawer-section-title {
    font-family: var(--font-display);
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-subtle);
    margin-bottom: 4px;
}

.org-drawer-item {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 2px solid transparent;
    outline: none;
    margin: 0 4px;
    border-radius: 6px;
}

.org-drawer-item:hover,
.org-drawer-item:focus {
    background: rgba(255, 255, 255, 0.04);
}

.org-drawer-item.active {
    background: rgba(var(--primary-rgb), 0.1);
    border-left-color: var(--primary);
}

.org-drawer-item.keyboard-focus {
    background: rgba(255, 255, 255, 0.06);
    border-left-color: var(--primary);
}

.org-drawer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--primary-dim) 0%, rgba(var(--primary-rgb), 0.15) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.8rem;
    color: var(--primary);
    flex-shrink: 0;
}

.org-drawer-info {
    flex: 1;
    min-width: 0;
}

.org-drawer-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-display);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.org-drawer-item.active .org-drawer-name {
    color: var(--primary);
}

.org-drawer-role {
    display: inline-flex;
    padding: 2px 6px;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    margin-top: 2px;
}

.org-drawer-role.role-owner {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

.org-drawer-role.role-admin {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.org-drawer-role.role-member {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

.org-drawer-active-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 6px var(--primary);
    flex-shrink: 0;
}

.org-drawer-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-subtle);
    font-size: 0.8rem;
}

/* Search highlight */
.org-drawer-highlight {
    background: rgba(var(--primary-rgb), 0.3);
    color: var(--text-display);
    border-radius: 2px;
    padding: 0 2px;
}