/* Drawer Component Styles */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    /* opacity only: `transition: all` animates layout properties too, and a
       full-viewport backdrop-filter re-blurs the whole page every frame. */
    transition: opacity var(--dur-med) var(--ease-out), visibility var(--dur-med);
}

.drawer-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 45vw;
    min-width: 320px;
    max-width: 800px;
    /* Slightly wider than the old sidebar */
    background: var(--surface);
    /* Default flat surface for contrast */
    box-shadow: var(--shadow-float);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform var(--dur-med) var(--ease-emph);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    visibility: visible;
    /* Ensure it stays painted */
}

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

/* Only promote to its own layer while sliding; a permanent will-change
   keeps the layer (and its memory) alive for the life of the page. */
.drawer-panel.open,
.drawer-panel.closing {
    will-change: transform;
}

/* Full-bleed sheet on phones - a 320px min-width panel over a 390px
   viewport leaves a dead sliver of unusable page behind it. */
@media (max-width: 640px) {
    .drawer-panel {
        width: 100%;
        min-width: 0;
        max-width: none;
        border-left: none;
    }

    .drawer-header {
        padding-top: max(var(--s-4), env(safe-area-inset-top));
    }

    .drawer-content {
        padding-bottom: max(var(--s-4), env(safe-area-inset-bottom));
    }
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--s-4);
    border-bottom: 1px solid var(--hairline);
}

.drawer-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.drawer-close-button {
    width: var(--tap-min);
    height: var(--tap-min);
    border-radius: var(--r-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    background: transparent;
    transition: all var(--dur-fast) var(--ease-out);
    font-size: var(--text-lg);
}

.drawer-close-button:hover {
    background: var(--hover-wash);
    color: var(--coral);
    transform: rotate(90deg);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--s-4);
}

/* Drawer Content Specific Styles */
.drawer-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.drawer-tabs {
    display: flex;
    width: 100%;
    border-bottom: 1px solid var(--hairline);
    background: var(--hover-wash);
    flex-shrink: 0;
    margin-bottom: var(--s-3);
    border-radius: var(--r-m);
    overflow: hidden;
    padding: var(--s-1);
}

.drawer-tab {
    flex: 1;
    padding: var(--s-2);
    min-height: var(--tap-min);
    background: transparent;
    border: none;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    text-align: center;
    transition: all var(--dur-fast) var(--ease-out);
    border-radius: var(--r-s);
}

.drawer-tab:hover {
    color: var(--teal);
    background: var(--hover-wash);
}

.drawer-tab.active {
    color: var(--teal);
    background: var(--surface);
    box-shadow: var(--shadow-button);
}

.drawer-tab-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Empty State Helper */
.empty-state {
    padding: var(--s-6) var(--s-4);
    text-align: center;
    color: var(--ink-soft);
    font-style: italic;
    font-size: var(--text-sm);
}