/* Desktop Modals - Centered presentation for action drawers */

@media (min-width: 768px) {

    /* Action Card Drawer & Action Detail Sheet & Flip Sheet */
    /* High specificity to override sheets.css */
    body .slide-up-sheet.action-card-drawer .sheet-content,
    body .slide-up-sheet.action-detail-sheet .sheet-content,
    body .slide-up-sheet.action-card-flip-sheet .sheet-content {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        width: 100% !important;
        max-width: 480px !important;
        height: auto !important;
        max-height: 85vh !important;
        border-radius: 24px !important;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25) !important;
        border: 1px solid var(--brokerly-border-light) !important;

        /* Initial state - CENTERED but scaled down. No vertical offset to prevent 'drawer' feel */
        transform: translate(-50%, -50%) scale(0.95) !important;

        /* Reset sliding animation and use fade/scale instead */
        transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
        opacity: 0;
    }

    body .slide-up-sheet.active.action-card-drawer .sheet-content,
    body .slide-up-sheet.active.action-detail-sheet .sheet-content,
    body .slide-up-sheet.active.action-card-flip-sheet .sheet-content {
        opacity: 1 !important;
        transform: translate(-50%, -50%) scale(1) !important;
    }

    /* Proposed Actions (Discover) Drawer */
    /* Target via ID for maximum specificity */
    #proposed-actions-overlay.slide-up-sheet .sheet-content,
    body .slide-up-sheet.proposed-actions-drawer .sheet-content {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;
        width: 100% !important;
        max-width: 500px !important;
        height: auto !important;
        max-height: 85vh !important;
        border-radius: 24px !important;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25) !important;
        border: 1px solid var(--brokerly-border-light) !important;

        /* Initial state - CENTERED */
        transform: translate(-50%, -50%) scale(0.95) !important;

        /* Reset sliding animation */
        transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
        opacity: 0;
    }

    #proposed-actions-overlay.slide-up-sheet.active .sheet-content,
    body .slide-up-sheet.active.proposed-actions-drawer .sheet-content {
        opacity: 1 !important;
        transform: translate(-50%, -50%) scale(1) !important;
    }

    /* Hide handle */
    body .slide-up-sheet.action-card-drawer .sheet-handle,
    body .slide-up-sheet.action-detail-sheet .sheet-handle,
    body .slide-up-sheet.action-card-flip-sheet .sheet-handle,
    body .slide-up-sheet.proposed-actions-drawer .sheet-handle,
    #proposed-actions-overlay .sheet-handle {
        display: none !important;
    }

    /* Ensure backdrop covers everything */
    .sheet-backdrop {
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
    }

    /* Explicitly handle the 'card flight' landing zone */
    /* Action Card Drawer needs flex to center the card */
    body .slide-up-sheet.action-card-drawer .drawer-card-host,
    body .slide-up-sheet.action-card-flip-sheet .sheet-body {
        padding: 0 0 16px 0 !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }

    /* Action Detail Sheet uses standard block layout */
    body .slide-up-sheet.action-detail-sheet .sheet-body {
        padding: 0 0 16px 0 !important;
        width: 100% !important;
        display: block !important;
    }

    /* Right Side Panel for Drawers */
    body .slide-up-sheet.right-side-panel {
        z-index: 10000 !important;
    }

    body .slide-up-sheet.right-side-panel .sheet-content {
        position: fixed !important;
        z-index: 10001 !important;
        top: 24px !important;
        right: 24px !important;
        left: auto !important;
        bottom: auto !important;
        width: 480px !important;
        max-width: calc(100vw - 48px) !important;
        height: calc(100vh - 48px) !important;
        max-height: calc(100vh - 48px) !important;
        border-radius: 24px !important;
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12), -2px 0 8px rgba(0, 0, 0, 0.08) !important;

        /* Initial state - off screen to the right */
        transform: translateX(calc(100% + 48px)) translateZ(0) !important;

        /* Smooth slide animation */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        opacity: 1 !important;
        /* overrides any modal fade */
        border: 1px solid var(--brokerly-border-light) !important;
    }

    body .slide-up-sheet.active.right-side-panel .sheet-content {
        transform: translateX(0) translateZ(0) !important;
    }

    /* Hide the handle since it's a side panel on desktop */
    body .slide-up-sheet.right-side-panel .sheet-handle {
        display: none !important;
    }
}