/* ==========================================================================
   components/slidein.css — THE slide-in panel (this project uses NO modals)
   --------------------------------------------------------------------------
   Used by: every form, detail view, confirmation and the notification
   bell list. Opens from the right: 50% width on desktop, 100% on mobile.
   Driven by assets/js/core/slidein.js which toggles .is-open.
   FLAT: panel is a surface with a left border; backdrop is a plain tint.
   ========================================================================== */

/* Backdrop behind the panel — click closes the slide-in */
.slidein-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(48, 49, 61, 0.4);   /* --color-text at 40% */
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition);
    z-index: 90;
}

/* The panel itself */
.slidein {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: var(--slidein-width-desktop);  /* 50% on desktop */
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    transform: translateX(100%);
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

/* Open state (set by slidein.js on both panel and backdrop) */
.slidein.is-open {
    transform: translateX(0);
}

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

/* ----- Panel sections ------------------------------------------------------- */

/* Header: title + close button */
.slidein-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.slidein-header h2 {
    margin: 0;
    font-size: var(--font-size-md);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Header action slot (e.g. the notifications trash) + vertical divider
   between the action and the close button. */
.slidein-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.slidein-actions:empty {
    display: none;
}

.slidein-divider {
    display: inline-block;
    width: 1px;
    height: 22px;
    background: var(--color-border);
}

/* Close (X) button — icon only, include .sr-only label for accessibility */
.slidein-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.slidein-close:hover {
    background: var(--color-surface-alt);
}

/* Scrollable content area */
.slidein-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5);
}

/* Bare variant — no header bar; a floating close button in the corner and
   a little extra top padding so content clears it. */
.slidein--bare .slidein-body {
    padding-top: var(--space-7);
}

.slidein-close--float {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    z-index: 2;
}

/* Legal document shown as a slide-in view (Terms / Privacy) */
.slidein .legal-back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
}

.slidein .legal-slidein-title {
    font-size: var(--font-size-md);
    margin: 0 0 var(--space-3);
}

.slidein .legal-content {
    font-size: var(--font-size-sm);
    line-height: 1.6;
    color: var(--color-text);
    overflow-wrap: anywhere;
    text-align: justify;
}

.slidein .legal-sep {
    color: var(--color-border-strong);
    margin: 0 var(--space-1);
}

/* Footer with action buttons (right-aligned) */
.slidein-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

/* ----- Mobile: full width -------------------------------------------------- */
@media (max-width: 900px) {
    .slidein {
        width: 100%;
        border-left: none;
    }
}

/* Phones: tighter padding so forms and conversations get the full width. */
@media (max-width: 480px) {
    .slidein-header {
        padding: var(--space-3) var(--space-4);
    }

    .slidein-body {
        padding: var(--space-4);
    }
}
